-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentrypoint.sh
executable file
·76 lines (62 loc) · 1.69 KB
/
entrypoint.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/sh
if [ -z "$CERT_SSL_CA" ]
then
echo Missing CERT_SSL_CA
exit 1
fi
if [ -z "$CERT_SSL_CA_KEY" ]
then
echo Missing $CERT_SSL_CA_KEY
exit 1
fi
if [ -z "$CERT_SSL_SERVER" ]
then
echo Missing $CERT_SSL_SERVER
exit 1
fi
if [ -z "$CERT_SSL_SERVER_KEY" ]
then
echo Missing $CERT_SSL_SERVER_KEY
exit 1
fi
if [ -z "$CERT_SSL_CHAIN" ]
then
echo Missing $CERT_SSL_CHAIN
exit 1
fi
if
[ ! -e "$CERT_SSL_CA" ] ||
[ ! -e "$CERT_SSL_CA_KEY" ] ||
[ ! -e "$CERT_SSL_SERVER" ] ||
[ ! -e "$CERT_SSL_SERVER_KEY" ] ||
[ ! -e "$CERT_SSL_CHAIN" ]
then
echo Generating CA certificate
openssl genrsa -out "${CERT_SSL_CA_KEY}" 4096
openssl req -x509 -new -key "${CERT_SSL_CA_KEY}" -out "${CERT_SSL_CA}" -days 36500 -subj "/CN=WGPT-CA-cert"
openssl genrsa -out "${CERT_SSL_SERVER_KEY}" 4096
openssl req -new -nodes \
-key "${CERT_SSL_SERVER_KEY}" \
-subj "/CN=*.wgpt" \
-out "${CERT_SSL_SERVER}.csr"
openssl x509 -req \
-in "${CERT_SSL_SERVER}.csr" \
-CA "${CERT_SSL_CA}" \
-CAkey "${CERT_SSL_CA_KEY}" \
-CAcreateserial \
-out "${CERT_SSL_SERVER}" \
-days 36500
cat "$CERT_SSL_SERVER" "$CERT_SSL_CA" > "$CERT_SSL_CHAIN"
rm "${CERT_SSL_SERVER}.csr"
chmod 644 "$CERT_SSL_CA" "$CERT_SSL_CA_KEY" "$CERT_SSL_SERVER" "$CERT_SSL_SERVER_KEY" "$CERT_SSL_CHAIN"
else
echo "Cert files present"
ls -alh "$CERT_SSL_CA" "$CERT_SSL_CA_KEY" "$CERT_SSL_SERVER" "$CERT_SSL_SERVER_KEY" "$CERT_SSL_CHAIN"
fi
CMD_UWSGI="uwsgi --uid wgpt --gid wgpt --enable-threads --master -s 0.0.0.0:3031 --manage-script-name --mount /=wgpt_cd:app"
if [ -z "$TCP_WAIT" ]
then
$CMD_UWSGI
else
/wgpt/tcp-wait.sh $TCP_WAIT $CMD_UWSGI
fi