blob: 5aa9c2abac36e912ed8c201987b4207bf51dcf79 (
plain) (
blame)
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
|
#!/bin/bash
GCP_PROJECT=${1:-fcuny-devel}
DOCKER_MACHINE_NAME=${2:-gcp}
COMMAND=$1
usage() {
echo "$0: [create|start|stop|status|ssh|scp|tmux-status]" >&2
exit 1
}
__create() {
docker-machine create "${DOCKER_MACHINE_NAME}" \
-d google \
--google-project="${GCP_PROJECT}" \
--google-machine-type n1-highcpu-4
}
__start() {
docker-machine start "${DOCKER_MACHINE_NAME}"
}
__stop() {
docker-machine stop "${DOCKER_MACHINE_NAME}"
}
__status() {
docker-machine status "${DOCKER_MACHINE_NAME}"
}
__ssh() {
docker-machine ssh "${DOCKER_MACHINE_NAME}"
}
__scp() {
echo "This is not implemented yet."
exit 2
}
__tmux-status() {
[ $(__status) == 'Running' ] && echo "Docker GCP up"
}
if [[ -z "${COMMAND}" ]]; then
usage
fi
case "${COMMAND}" in
create)
__create
;;
start)
__start
;;
stop)
__stop
;;
status)
__status
;;
ssh)
__ssh
;;
scp)
__scp
;;
tmux-status)
__tmux-status
;;
*)
usage
;;
esac
|