This repository has been archived by the owner on Aug 17, 2021. It is now read-only.
forked from benhutchins/docker-taiga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
executable file
·63 lines (54 loc) · 2.13 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
60
61
62
63
#!/bin/bash
# Sleep when asked to, to allow the database time to start
# before Taiga tries to run /checkdb.py below.
: ${TAIGA_SLEEP:=0}
sleep $TAIGA_SLEEP
# Setup database automatically if needed
if [ -z "$TAIGA_SKIP_DB_CHECK" ]; then
echo "Running database check"
python /checkdb.py
DB_CHECK_STATUS=$?
if [ $DB_CHECK_STATUS -eq 1 ]; then
echo "Failed to connect to database server or database does not exist."
exit 1
elif [ $DB_CHECK_STATUS -eq 2 ]; then
echo "Configuring initial database"
python manage.py migrate --noinput
python manage.py loaddata initial_user
python manage.py loaddata initial_project_templates
python manage.py loaddata initial_role
python manage.py compilemessages
fi
fi
# Look for static folder, if it does not exist, then generate it
if [ ! -d "/usr/src/taiga-back/static" ]; then
python manage.py collectstatic --noinput
fi
# Automatically replace "TAIGA_HOSTNAME" with the environment variable
sed -i "s/TAIGA_HOSTNAME/$TAIGA_HOSTNAME/g" /taiga/conf.json
# Look to see if we should set the "eventsUrl"
if [ ! -z "$RABBIT_PORT_5672_TCP_ADDR" ]; then
echo "Enabling Taiga Events"
sed -i "s/eventsUrl\": null/eventsUrl\": \"ws:\/\/$TAIGA_HOSTNAME\/events\"/g" /taiga/conf.json
mv /etc/nginx/taiga-events.conf /etc/nginx/conf.d/default.conf
fi
# Handle enabling/disabling SSL
if [ "$TAIGA_SSL_BY_REVERSE_PROXY" = "True" ]; then
echo "Enabling external SSL support! SSL handling must be done by a reverse proxy or a similar system"
sed -i "s/http:\/\//https:\/\//g" /taiga/conf.json
sed -i "s/ws:\/\//wss:\/\//g" /taiga/conf.json
elif [ "$TAIGA_SSL" = "True" ]; then
echo "Enabling SSL support!"
sed -i "s/http:\/\//https:\/\//g" /taiga/conf.json
sed -i "s/ws:\/\//wss:\/\//g" /taiga/conf.json
mv /etc/nginx/ssl.conf /etc/nginx/conf.d/default.conf
elif grep -q "wss://" "/taiga/conf.json"; then
echo "Disabling SSL support!"
sed -i "s/https:\/\//http:\/\//g" /taiga/conf.json
sed -i "s/wss:\/\//ws:\/\//g" /taiga/conf.json
fi
# Start nginx service (need to start it as background process)
# nginx -g "daemon off;"
service nginx start
# Start gunicorn server
exec "$@"