Skip to content

Commit 8462691

Browse files
committed
add docker compose script
Signed-off-by: sami <[email protected]>
1 parent f4e5db3 commit 8462691

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# To add this script as a cronjob,run 'crontab -e' and add the following line with the appropriate paths
4+
# @reboot /path/to/directory/start_docker_compose.sh /path/to/directory >> /path/to/save/log/cronlog.log 2>&1
5+
6+
if [ $# -ne 1 ]; then
7+
echo "Usage: $0 <directory>"
8+
exit 1
9+
fi
10+
11+
TARGET_DIR="$1"
12+
13+
cd "$TARGET_DIR" || exit
14+
15+
while ! systemctl is-active --quiet docker; do
16+
sleep 1
17+
done
18+
19+
/usr/bin/docker compose -f docker-composeOLD.yml down
20+
/usr/bin/docker compose -f docker-composeOLD.yml up -d
21+
22+
check_health() {
23+
while true; do
24+
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8000/healthcheck)
25+
if [[ "$response" -eq 200 ]]; then
26+
echo "Health check passed: Received 200 response."
27+
break
28+
else
29+
echo "Health check failed: Received $response response. Retrying..."
30+
sleep 5
31+
fi
32+
done
33+
}
34+
35+
check_health
36+
37+
/usr/bin/docker exec james james-cli AddDomain cloud.appscode.com
38+
/usr/bin/docker exec james james-cli AddUser [email protected] password

0 commit comments

Comments
 (0)