-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcosmosc2.sh
executable file
·50 lines (46 loc) · 1.66 KB
/
cosmosc2.sh
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
#!/usr/bin/env sh
set -e
usage() {
echo "Usage: $1 [start, stop, cosmos, cleanup, util]" >&2
echo "* start: start the docker-compose cosmos" >&2
echo "* stop: stop the running dockers for cosmos" >&2
echo "* cosmos: run a cosmos command ('cosmos help' for more info)" 1>&2
echo "* cleanup: cleanup network and volumes for cosmos" >&2
echo "* util: various helper commands" >&2
echo "* encode: encode a string to base64" >&2
echo "* hash: hash a string using SHA-256" >&2
echo "* save: save images to tar files" >&2
echo "* load: load images to tar files" >&2
echo "* clean: remove node_modules, coverage, etc" >&2
echo "* hostsetup: configure host for redis" >&2
echo "* cacert: update cacert.pem file" >&2
exit 1
}
if [ "$#" -eq 0 ]; then
usage $0
fi
case $1 in
start )
docker-compose -f compose.yaml up -d
;;
stop )
docker-compose -f compose.yaml down
;;
cosmos )
# Start (and remove when done --rm) the cosmos-base container with the current working directory
# mapped as volume (-v) /cosmos/local and container working directory (-w) also set to /cosmos/local.
# This allows tools running in the container to have a consistent path to the current working directory.
# Run the command "ruby /cosmos/bin/cosmos" with all parameters starting at 2 since the first is 'cosmos'
args=`echo $@ | { read _ args; echo $args; }`
docker run --rm -v `pwd`:/cosmos/local -w /cosmos/local ballaerospace/cosmosc2-base ruby /cosmos/bin/cosmos $args
;;
cleanup )
docker-compose -f compose.yaml down -v
;;
util )
scripts/linux/cosmos_util.sh $2 $3
;;
* )
usage $0
;;
esac