-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdb-service.sh
More file actions
executable file
·57 lines (47 loc) · 1.43 KB
/
db-service.sh
File metadata and controls
executable file
·57 lines (47 loc) · 1.43 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
50
51
52
53
54
55
56
57
#!/bin/bash
if [ -z "$1" ]
then
echo "No instance argument supplied"
echo "Usage: "$0" instance {start|stop|restart} [docker-compose options]"
exit 1
fi
set -o allexport
source config/$1.env
set +o allexport
if [[ -z "${CODE_BASE_DIR}" ]];
then
CODE_BASE_DIR="../uo-data-box"
fi
case "$2" in
start)
echo "[--] Starting $1 master database services..."
docker-compose --project-name=${UO_INSTANCE} \
-f ${CODE_BASE_DIR}/src/apps/master/config/timescaledb/docker-compose.yml \
up -d "${@:3}"
echo " "
;;
stop)
echo "[WARNING] This is a potentially destructive action."
echo " Data could be lost while database services are down."
echo ""
echo "Will continue in 5 seconds..."
sleep 5
echo ""
echo "[--] Stopping $1 master database services..."
docker-compose --project-name=${UO_INSTANCE} \
-f ${CODE_BASE_DIR}/src/apps/master/config/timescaledb/docker-compose.yml \
down "${@:3}"
echo " "
;;
restart)
echo "[--] Restarting $1 master database services..."
docker-compose --project-name=${UO_INSTANCE} \
-f ${CODE_BASE_DIR}/src/apps/master/config/timescaledb/docker-compose.yml \
restart "${@:3}"
echo " "
;;
*)
echo "Usage: "$0" instance {start|stop|restart} [docker-compose options]"
exit 1
esac
exit 0