forked from AnyBucket-Lab/circleci-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
executable file
·59 lines (48 loc) · 1.29 KB
/
docker-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
#!/bin/bash
set -ex
KEY_FILE=/frontend/nginx/etc/nginx/ssl/star.circlehost.key
CERT_FILE=/frontend/nginx/etc/nginx/ssl/star.circlehost.crt
SERVER_CERT_FILE=/frontend/nginx/etc/nginx/ssl/star.circlehost.pem
if [[ "$1" = 'start' ]]
then
# Generate Cert if none is present
if [[ ! -s ${KEY_FILE} ]]
then
mkdir -p /frontend/nginx/etc/nginx/ssl
openssl req -batch -new \
-x509 -newkey rsa:2048 -sha256 -nodes -days 365 \
-subj '/C=US/ST=California/L=San Francisco/O=CircleCI/CN=*.circlehost' \
-keyout ${KEY_FILE} \
-out ${CERT_FILE}
fi
if [[ ! -s ${SERVER_CERT_FILE} ]]
then
cat ${KEY_FILE} ${CERT_FILE} > ${SERVER_CERT_FILE}
fi
(cat <<EOF
global
daemon
maxconn 4096
listen http
bind 0.0.0.0:13000
bind 0.0.0.0:14443 ssl crt ${SERVER_CERT_FILE}
mode tcp
server master 127.0.0.1:3000
timeout client 3600s
timeout connect 3600s
timeout server 3600s
listen figwheel
bind 0.0.0.0:14444 ssl crt ${SERVER_CERT_FILE}
mode tcp
server master docker.for.mac.localhost:3449
timeout client 3600s
timeout connect 3600s
timeout server 3600s
EOF
) > /etc/haproxy/haproxy.cfg
# Generate HAProxy
haproxy -f /etc/haproxy/haproxy.cfg
lein repl :headless &
lein run
fi
exec "$@"