Skip to content

Commit 61c447c

Browse files
committed
docker scripts upd
1 parent 85cd770 commit 61c447c

File tree

3 files changed

+51
-54
lines changed

3 files changed

+51
-54
lines changed

docker/start_db_cluster.sh

Lines changed: 42 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,35 @@
55
# ./start_db_cluster.sh <dockerImage>
66

77
# EXAMPLE:
8-
# ./start_db_cluster.sh docker.io/arangodb/arangodb:3.5.1
8+
# ./start_db_cluster.sh docker.io/arangodb/arangodb:3.5.3
99

1010
docker pull "$1"
1111

1212
LOCATION=$(pwd)/$(dirname "$0")
1313

1414
docker network create arangodb --subnet 172.28.0.0/16
1515

16-
echo "Averysecretword" >"$LOCATION"/jwtSecret
17-
docker run --rm -v "$LOCATION"/jwtSecret:/jwtSecret "$1" arangodb auth header --auth.jwt-secret /jwtSecret >"$LOCATION"/jwtHeader
16+
echo "Averysecretword" > "$LOCATION"/jwtSecret
17+
docker run --rm -v "$LOCATION"/jwtSecret:/jwtSecret "$1" arangodb auth header --auth.jwt-secret /jwtSecret > "$LOCATION"/jwtHeader
1818
AUTHORIZATION_HEADER=$(cat "$LOCATION"/jwtHeader)
1919

20+
echo "Starting containers..."
21+
22+
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.1.1 --name agent1 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator false --auth.jwt-secret /jwtSecret
23+
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.1.2 --name agent2 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator false --starter.join agent1 --auth.jwt-secret /jwtSecret
24+
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.1.3 --name agent3 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator false --starter.join agent1 --auth.jwt-secret /jwtSecret
25+
26+
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.2.1 --name dbserver1 "$1" arangodb --cluster.start-dbserver true --cluster.start-coordinator false --starter.join agent1 --auth.jwt-secret /jwtSecret
27+
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.2.2 --name dbserver2 "$1" arangodb --cluster.start-dbserver true --cluster.start-coordinator false --starter.join agent1 --auth.jwt-secret /jwtSecret
28+
29+
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.3.1 --name coordinator1 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator true --starter.join agent1 --auth.jwt-secret /jwtSecret
30+
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.3.2 --name coordinator2 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator true --starter.join agent1 --auth.jwt-secret /jwtSecret
31+
2032
debug_container() {
2133
running=$(docker inspect -f '{{.State.Running}}' "$1")
2234

23-
if [ "$running" = false ]; then
35+
if [ "$running" = false ]
36+
then
2437
echo "$1 is not running!"
2538
echo "---"
2639
docker logs "$1"
@@ -31,58 +44,40 @@ debug_container() {
3144

3245
debug() {
3346
for c in agent1 \
34-
agent2 \
35-
agent3 \
36-
dbserver1 \
37-
dbserver2 \
38-
dbserver3 \
39-
coordinator1 \
40-
coordinator2; do
41-
debug_container $c
47+
agent2 \
48+
agent3 \
49+
dbserver1 \
50+
dbserver2 \
51+
coordinator1 \
52+
coordinator2 ; do
53+
debug_container $c
4254
done
4355
}
4456

4557
wait_server() {
46-
# shellcheck disable=SC2091
47-
until $(curl --output /dev/null --silent --head --fail -i -H "$AUTHORIZATION_HEADER" "http://$1/_api/version"); do
48-
printf '.'
49-
debug
50-
sleep 1
51-
done
58+
# shellcheck disable=SC2091
59+
until $(curl --output /dev/null --silent --head --fail -i -H "$AUTHORIZATION_HEADER" "http://$1/_api/version"); do
60+
printf '.'
61+
debug
62+
sleep 1
63+
done
5264
}
5365

54-
echo "Starting containers..."
55-
56-
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.1.1 --name agent1 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator false --auth.jwt-secret /jwtSecret
57-
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.1.2 --name agent2 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator false --starter.join agent1 --auth.jwt-secret /jwtSecret
58-
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.1.3 --name agent3 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator false --starter.join agent1 --auth.jwt-secret /jwtSecret
59-
60-
echo "Waiting for agents..."
61-
wait_server 172.28.1.1:8531
62-
wait_server 172.28.1.2:8531
63-
wait_server 172.28.1.3:8531
64-
65-
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.2.1 --name dbserver1 "$1" arangodb --cluster.start-dbserver true --cluster.start-coordinator false --starter.join agent1 --auth.jwt-secret /jwtSecret
66-
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.2.2 --name dbserver2 "$1" arangodb --cluster.start-dbserver true --cluster.start-coordinator false --starter.join agent1 --auth.jwt-secret /jwtSecret
67-
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.2.3 --name dbserver3 "$1" arangodb --cluster.start-dbserver true --cluster.start-coordinator false --starter.join agent1 --auth.jwt-secret /jwtSecret
68-
69-
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.3.1 --name coordinator1 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator true --starter.join agent1 --auth.jwt-secret /jwtSecret
70-
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.3.2 --name coordinator2 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator true --starter.join agent1 --auth.jwt-secret /jwtSecret
71-
docker run -d -v "$LOCATION"/jwtSecret:/jwtSecret -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.3.3 --name coordinator3 "$1" arangodb --cluster.start-dbserver false --cluster.start-coordinator true --starter.join agent1 --auth.jwt-secret /jwtSecret
72-
73-
echo "Waiting for dbservers and coordinators..."
74-
wait_server 172.28.2.1:8530
75-
wait_server 172.28.2.2:8530
76-
wait_server 172.28.2.3:8530
77-
wait_server 172.28.3.1:8529
78-
wait_server 172.28.3.2:8529
79-
wait_server 172.28.3.3:8529
66+
echo "Waiting..."
8067

81-
# wait for port mappings
82-
wait_server 127.0.0.1:8529
68+
# Wait for agents:
69+
for a in 172.28.1.1:8531 \
70+
172.28.1.2:8531 \
71+
172.28.1.3:8531 \
72+
172.28.2.1:8530 \
73+
172.28.2.2:8530 \
74+
172.28.3.1:8529 \
75+
172.28.3.2:8529 ; do
76+
wait_server $a
77+
done
8378

8479
docker exec coordinator1 arangosh --server.authentication=false --javascript.execute-string='require("org/arangodb/users").update("root", "test")'
8580

86-
rm "$LOCATION"/jwtHeader "$LOCATION"/jwtSecret
81+
#rm "$LOCATION"/jwtHeader "$LOCATION"/jwtSecret
8782

8883
echo "Done, your cluster is ready."

docker/start_db_single.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99

1010
docker pull "$1"
1111

12-
docker run -d -e ARANGO_ROOT_PASSWORD=test -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" -p 8529:8529 "$1"
12+
docker network create arangodb --subnet 172.28.0.0/16
13+
14+
docker run -d -e ARANGO_ROOT_PASSWORD=test -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.3.1 "$1"
1315

1416
echo "waiting for arangodb ..."
1517

1618
# shellcheck disable=SC2091
17-
until $(curl --output /dev/null --silent --head --fail -i -u root:test 'http://localhost:8529/_api/version'); do
18-
printf '.'
19-
sleep 1
19+
until $(curl --output /dev/null --silent --head --fail -i -u root:test 'http://172.28.3.1:8529/_api/version'); do
20+
printf '.'
21+
sleep 1
2022
done
2123
echo "READY!"

docker/start_db_single_ssl.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# ./start_db_single_ssl.sh <dockerImage>
66

77
# EXAMPLE:
8-
# ./start_db_single_ssl.sh docker.io/arangodb:3.5.0
8+
# ./start_db_single_ssl.sh docker.io/arangodb/arangodb:3.5.1
99

1010
docker pull "$1"
1111

@@ -15,7 +15,7 @@ echo "waiting for arangodb ..."
1515

1616
# shellcheck disable=SC2091
1717
until $(curl --output /dev/null --silent --head --fail -i --insecure -u root:test 'https://127.0.0.1:8529/_api/version'); do
18-
printf '.'
19-
sleep 1
18+
printf '.'
19+
sleep 1
2020
done
2121
echo "READY!"

0 commit comments

Comments
 (0)