forked from HubSpot/Singularity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev
executable file
·88 lines (81 loc) · 1.96 KB
/
dev
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
DOCKER_IP=`echo "$DOCKER_HOST" | awk -F/ '{print $3}' | awk -F: '{print $1}'`
function pull {
docker-compose -f compose-dev.yml pull
}
function remove {
echo "Removing old containers"
docker-compose -f compose-dev.yml rm
}
function build {
echo "Building new images"
mvn clean package docker:build -DskipTests
}
function stop {
echo "Stopping old containers with docker-compose $1"
docker-compose -f compose-dev.yml $1
if [ "$1" == "kill" ]; then
echo "Yep... Good and dead..."
fi
}
function start {
if [ "$1" == "attach" ]; then
echo "Starting and attaching to docker-compose up"
docker-compose -f compose-dev.yml up
else
echo "Starting via docker-compose up"
docker-compose -f compose-dev.yml up &> /dev/null &
fi
}
function help {
echo "usage:
pull -> grab needed images for docker hub
start -> start mesos clsuter in background
attach -> start mesos cluster and watch output in console
restart -> stop all containers and restart in background
rebuild -> stop all containers, rebuild Singularity and docker images, then start in background
- rebuild attach -> rebuild and watch output when started
remove -> remove stopped containers
stop -> stop all containers
kill -> kill all containers (ungraceful term)
"
}
case $1 in
pull)
echo "Grabbing the latest images from docker hub, this may take a few minutes"
pull
;;
start)
start
echo "It may take a few moments for Singularity and mesos to start up..."
echo "The Singularity UI will be available at $DOCKER_IP:7099/singularity"
echo "The Baragon UI will be available at $DOCKER_IP:8080/baragon/v2/ui"
;;
attach)
start "attach"
;;
restart)
stop "stop"
remove
start
;;
rebuild)
stop "stop"
stop "kill"
remove
build
start $2
;;
remove)
remove
;;
stop)
stop "stop"
;;
kill)
stop "kill"
;;
help)
help
;;
esac