-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker_run.sh
81 lines (73 loc) · 2.14 KB
/
docker_run.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
77
78
79
80
81
#!/bin/bash
echo "Looking Glass Website Container"
if [ "$webserver" == "yes" ]
then
## Check Certiface are exist
FILE="/etc/ssl/certs/looking-glass.crt"
if [ -f "$FILE" ];
then
echo "$FILE exists."
else
echo "$FILE does not exists."
USE_Self_Certiface=1
fi
FILE="/etc/ssl/private/looking-glass.key"
if [ -f "$FILE" ];
then
echo "$FILE exists."
else
echo "$FILE does not exists."
USE_Self_Certiface=1
fi
## Cert DIR /etc/nginx/looking_glass_cert_dir.conf
if [ "$USE_Self_Certiface" == "1" ];
then
echo "Your website certifaces are not ready."
echo "Using self certiface"
## Check Certiface are exist
FILE="/etc/ssl/certs/nginx-selfsigned.crt"
if [ -f "$FILE" ];
then
echo "$FILE exists."
else
echo "$FILE does not exists."
Create_Self_Certiface=1
fi
FILE="/etc/ssl/private/nginx-selfsigned.key"
if [ -f "$FILE" ];
then
echo "$FILE exists."
else
echo "$FILE does not exists."
Create_Self_Certiface=1
fi
if [ "$Create_Self_Certiface" == "1" ];
then
openssl req \
-x509 -nodes -days 365 \
-newkey rsa:2048 \
-keyout /etc/ssl/private/nginx-selfsigned.key \
-out /etc/ssl/certs/nginx-selfsigned.crt \
-subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=lg.example.com"
fi
echo "ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;" > /etc/nginx/looking_glass_cert_dir.conf
else
echo "ssl_certificate /etc/ssl/certs/looking-glass.crt;
ssl_certificate_key /etc/ssl/private/looking-glass.key;" > /etc/nginx/looking_glass_cert_dir.conf
fi
fi
echo "Building web"
jekyll build --trace
if [ $? -eq 0 ]
then
echo "Site successfully builded"
if [ "$webserver" == "yes" ]
then
echo "Starting Nginx"
if [ ! -d "/run/nginx/" ]; then
mkdir -p /run/nginx/
fi
nginx
fi
fi