-
Notifications
You must be signed in to change notification settings - Fork 4
/
manager.sh
executable file
·76 lines (62 loc) · 1.71 KB
/
manager.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
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
#!/bin/bash
function buildapps(){
docker-compose -f docker-compose.$1.yml build www_builder
docker-compose -f docker-compose.$1.yml up www_builder
#sleep 1
#docker run --rm -it --link elcanoiepg_pgsql_1:${POSTGRES_HOST} -v $(pwd)/www:/app -e "POSTGRES_HOST=${POSTGRES_HOST}" -e "POSTGRES_DB=${POSTGRES_DB}" -e "POSTGRES_USER=${POSTGRES_USER}" -e "POSTGRES_PASSWORD=${POSTGRES_PASSWORD}" geographica/elcano_iepg_webbuilder
}
function build(){
buildapps $1;
#docker rm -f tmp_build_db
docker-compose -f docker-compose.$1.yml build
docker build -t geographica/elcano_iepg_api www-srv
}
function prerequisites(){
echo -n "Installing prerequisites..."
# Fetching submodules
git submodule init
git submodule update
#docker build -t geographica/elcano_iepg_webbuilder www
# Install scripts to upload to amazon s3. If this line fails and you don't want to upload it to Amazon S3/CloudFront just comment it.
#gem install s3_website
}
source config.env;
case $1 in
start)
docker-compose -f docker-compose.$2.yml start
nginx refresh
shift
;;
restart)
docker-compose -f docker-compose.$2.yml stop
docker-compose -f docker-compose.$2.yml start
nginx refresh
shift # past argument=value
;;
refresh)
prerequisites;
build $2;
docker-compose -f docker-compose.$2.yml stop
docker-compose -f docker-compose.$2.yml rm -f
docker-compose -f docker-compose.$2.yml up -d
nginx refresh
shift
;;
prerequisites)
prerequisites;
shift
;;
buildapps)
prerequisites;
buildapps $2;
shift
;;
stop)
docker-compose -f docker-compose.$2.yml stop
shift
;;
*)
echo "Bad parameters"
exit
;;
esac