-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcompose.sh
More file actions
executable file
·49 lines (40 loc) · 1.17 KB
/
Copy pathcompose.sh
File metadata and controls
executable file
·49 lines (40 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash -x -e
# Common variables.
env_file='./develop/compose.env'
compose_file='./develop/compose.yaml'
compose_common_arg="--file $compose_file --env-file $env_file"
# Preflight checks.
if ! test -f $env_file; then
echo "The env file ${env_file} is not found."
exit 1
fi
set +e
export $(eval "echo \"$(cat $env_file)\"")
set -e
source $env_file
if ! test -f $compose_file; then
echo "The docker compose config is not found."
exit 1
fi
# Exit functions that stops containers by Ctrl+C call.
trap ctrl_c INT
ctrl_c () {
docker compose $compose_common_arg down
}
# Run them!
#docker compose $compose_common_arg up --wait --force-recreate --renew-anon-volumes
docker compose $compose_common_arg up --force-recreate --renew-anon-volumes
# Wait for the startup process. Don't use sleep() here! Only pooling!
set +x
echo -n "Starting env ..."
while true; do
ret=$(curl -s ${CLICKHOUSE_ADDR}:${CLICKH_PORT_HTTP}/ | fgrep 'Ok.' | wc -l)
test $ret -ge 1 && break
sleep 1
echo -n "."
done
echo -e "\nDone!\n"
docker ps
# The command waits for Ctrl+C but Ctrl+C makes is trapped.
echo -e "\nPress Ctrl+C to exit and stop container(s)."
sleep $((2**30))