-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
49 lines (35 loc) · 1.11 KB
/
docker-entrypoint.sh
File metadata and controls
49 lines (35 loc) · 1.11 KB
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
#!/bin/bash
set -e
COMMAND=$1
# Run commands
if [ "$COMMAND" = 'basic' ] || [ "$COMMAND" = 'all' ];
then
# Initialized?
if [ "$COMMAND" = 'init' ]; then
rm /etc/emstrack/emstrack.initialized
fi
if docker-entrypoint-init.sh; then
echo "> Initialization complete"
fi
echo "> Starting basic services"
echo "> Waiting for postgres"
timer="5"
until pg_isready -U postgres -h $DB_HOST --quiet; do
>&2 echo "Postgres is unavailable - sleeping for $timer seconds"
sleep $timer
done
if [ "$COMMAND" = 'all' ]; then
echo "> Starting mqttclient"
# python manage.py mqttclient > /etc/emstrack/log/mqttclient.log 2>&1 &
/etc/init.d/mqtt-client.sh start
fi
echo "> Starting uWSGI"
# nohup bash -c "uwsgi --touch-reload=/home/worker/app/reload --http 0.0.0.0:8000 --module emstrack.wsgi > /etc/emstrack/log/uwsgi.log 2>&1 &"
# python manage.py runserver 0.0.0.0:8000
touch /app/reload
uwsgi --touch-reload=/app/reload --ini uwsgi.ini
else
echo "> No services started"
echo "> Running '$@'"
exec "$@"
fi