-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanage.sh
executable file
·66 lines (52 loc) · 1.48 KB
/
manage.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
#!/bin/bash
set -e
IN_OPERATION="${1}"
BASE_DIR=$(dirname $(readlink -f "${0}"))
DOCKER_COMPOSE_CONF="${BASE_DIR}/docker-compose.yaml"
source "${BASE_DIR}/env.config"
function init_env () {
# git -C "${BASE_DIR}" submodule update --init --recursive
sudo mkdir -p "${VOLUME_PATH}"
sudo chown 900:900 -R "${VOLUME_PATH}"
sed -e "s#{{WEB_SERVER_PORT}}#${WEB_SERVER_PORT}#g" \
-e "s#{{WEB_SERVER_NAME}}#${WEB_SERVER_NAME}#g" \
"${BASE_DIR}/nginx/nginx.conf.tpl" > "${BASE_DIR}/nginx/nginx.conf"
echo "Updating nginx.conf"
}
case "${IN_OPERATION}" in
init)
init_env
docker-compose -f "${DOCKER_COMPOSE_CONF}" build
;;
status)
docker-compose -f "${DOCKER_COMPOSE_CONF}" ps
;;
debug)
init_env
docker-compose -f "${DOCKER_COMPOSE_CONF}" up --force-recreate --build
;;
start)
init_env
docker-compose -f "${DOCKER_COMPOSE_CONF}" up -d --no-recreate
;;
stop)
docker-compose -f "${DOCKER_COMPOSE_CONF}" down
;;
clean)
$0 stop
docker rmi nginx cgit || true
;;
*)
cat << EOF
Usage: $0 ACTION
ACTION:
init [Optional] generate config files,
check ssl keys, build required images
status get containers status
debug run docker-compose in foreground
start start all containers in background
stop stop all containers
EOF
exit 1
;;
esac