-
Notifications
You must be signed in to change notification settings - Fork 0
/
ns1
executable file
·62 lines (53 loc) · 1.51 KB
/
ns1
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
58
59
60
61
62
#!/bin/sh
# version 1.2 - 03/26/2021 - [email protected]
#=== BEGIN Configuration Items ===#
DOCKER_COMPOSE=docker-compose.yml
TAG=3.3.1
POP_ID=lab
SERVER_ID=`hostname`
PROJECT=ddi
CONTAINERS='data core dns dhcp monitor'
#--- EDGE Node Configuration Items
CORE_HOSTS='core'
#--- CLOUDSYNC Configuration Items
CLOUDSYNC=true
CLOUDSYNC_PROJECT=cloudsync
CLOUDSYNC_DOCKER_COMPOSE=cloudsync.yml
CLOUDSYNC_TAG=1.0.4
#=== END Configuration Items ===#
export TAG POP_ID SERVER_ID CORE_HOSTS
#--- Don't start without a docker-compose file...
if [ ! -f $DOCKER_COMPOSE ]; then
echo "$DOCKER_COMPOSE does not exist! - Aborting..."
exit 1
fi
case "$1" in
start)
docker-compose -p $PROJECT -f $DOCKER_COMPOSE up -d $CONTAINERS
if [ "$CLOUDSYNC" = true ]; then
TAG=$CLOUDSYNC_TAG docker-compose -p $CLOUDSYNC_PROJECT -f $CLOUDSYNC_DOCKER_COMPOSE up -d
fi
;;
stop)
docker-compose -p $PROJECT -f $DOCKER_COMPOSE stop $CONTAINERS
if [ "$CLOUDSYNC" = true ]; then
TAG=$CLOUDSYNC_TAG docker-compose -p $CLOUDSYNC_PROJECT -f $CLOUDSYNC_DOCKER_COMPOSE stop
fi
;;
status)
docker-compose -p $PROJECT -f $DOCKER_COMPOSE ps
if [ "$CLOUDSYNC" = true ]; then
TAG=$CLOUDSYNC_TAG docker-compose -p $CLOUDSYNC_PROJECT -f $CLOUDSYNC_DOCKER_COMPOSE ps
fi
;;
delete)
if [ "$CLOUDSYNC" = true ]; then
TAG=$CLOUDSYNC_TAG docker-compose -p $CLOUDSYNC_PROJECT -f $CLOUDSYNC_DOCKER_COMPOSE down -v
fi
docker-compose -p $PROJECT -f $DOCKER_COMPOSE down -v
;;
*)
echo "Usage: $0 {start|stop|status|delete}"
exit 1
esac
exit 0