control.sh 1.06 KB
Newer Older
TonyFord's avatar
TonyFord committed
1
2
3
#!/bin/bash
export RUNNER_UID=`id -u`
export RUNNER_GID=`id -g`
TonyFord's avatar
ts    
TonyFord committed
4
5
6
7
8
if [ -d ../${CI_PROJECT_NAME}.tmp ]; then
  export `cat ./${CI_PROJECT_NAME}.tmp/*`
else
  export `cat ./env/*`
fi
TonyFord's avatar
TonyFord committed
9
10

case $1 in
TonyFord's avatar
TonyFord committed
11
12
13
  "exec")
      docker-compose exec $2 $3
    ;;
TonyFord's avatar
add ps    
TonyFord committed
14
15
16
  "ps")
      docker-compose ps
    ;;
TonyFord's avatar
TonyFord committed
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  "build")
      chmod +x create_db.sh
      cat ${CCE_CONF} > ./cce.conf
      docker-compose down
      docker-compose build
    ;;
  "start")
      cat ${CCE_CONF} > ./cce.conf
      cat ${SERVER_CONF} > ./server.conf
      docker-compose stop
      docker-compose up -d
      docker-compose exec -T app python3 websrv.py
    ;;
  "stop")
TonyFord's avatar
TonyFord committed
31
      docker-compose stop $2
TonyFord's avatar
TonyFord committed
32
33
34
35
36
    ;;
  "uninstall")
      docker-compose stop
      docker-compose down
    ;;
37
38
39
40
41
42
43
44
45
46
  "nginx-install")
      cp ${CI_PROJECT_NAME} > /etc/nginx/sites-available/
      certbot certonly --nginx --domain ${CI_PROJECT_NAME}
      ln -s /etc/nginx/sites-available/${CI_PROJECT_NAME} /etc/nginx/sites-enabled/
      nginx -s reload
    ;;
  "nginx-uninstall")
      rm /etc/nginx/sites-enabled/${CI_PROJECT_NAME}
      nginx -s reload
    ;;
TonyFord's avatar
TonyFord committed
47
esac