-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcert.sh
executable file
·37 lines (30 loc) · 1.06 KB
/
cert.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
#!/bin/bash
LARADOCK_NGINX_CONTAINER=
LARADOCK_NGINX_SERVICE_RUNNED=
CUR_PATH="$(pwd)"
echo "Laradock-multi try to get https certificate"
if [[ "$LARADOCK_NGINX_CONTAINER" == "" ]]; then
. "$(dirname "${BASH_SOURCE[0]}")/.jump_to_laradock.sh";
LARADOCK_NGINX_CONTAINER="$(docker-compose -f docker-compose.multi.yml ps -q nginx)"
cd "${CUR_PATH}";
fi;
if [ "$(docker inspect -f '{{.State.Running}}' ${LARADOCK_NGINX_CONTAINER} 2>/dev/null)" = "true" ]; then
LARADOCK_NGINX_SERVICE_RUNNED=1
else
LARADOCK_NGINX_SERVICE_RUNNED=0
fi
if [ "$LARADOCK_NGINX_SERVICE_RUNNED" = 0 ]; then
echo "try to start nginx with default configuration"
. "$(dirname "${BASH_SOURCE[0]}")/.jump_to_laradock.sh";
rm nginx/sites/*.conf
git checkout nginx/sites
docker-compose -f docker-compose.multi.yml up -d nginx
cd "${CUR_PATH}";
fi
. "$(dirname "${BASH_SOURCE[0]}")/.jump_to_laradock.sh";
docker-compose -f docker-compose.multi.yml up certbot-multi
cd "${CUR_PATH}";
if [ "$LARADOCK_NGINX_SERVICE_RUNNED" = 0 ]; then
cmd/stop.sh nginx
cmd/deploy.sh reset
fi