forked from Stemweb/Stemweb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·43 lines (38 loc) · 1.48 KB
/
docker-entrypoint.sh
File metadata and controls
executable file
·43 lines (38 loc) · 1.48 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
#!/bin/bash
set -e # exit immediately if any command fails.
echo "############### ENTRYPOINT HIT — $(date) ###################"
echo "######### Using python from PATH: $(which python)"
python -V
cd /home/stemweb
# Wait for the database if necessary
if [ -n "${STEMWEB_DBHOST}" ]; then
dbport=$STEMWEB_DBPORT
if [ -z "${STEMWEB_DBPORT}" ]; then
case $STEMWEB_DBENGINE in
mysql)
dbport="3306"
;;
postgresql_psycopg2)
dbport="5432"
;;
esac
fi
echo "Waiting for ${STEMWEB_DBHOST}:${dbport} to come online"
./wait-for-it.sh "${STEMWEB_DBHOST}:${dbport}" -t 60 -- echo "######### Initialising Stemweb #########"
fi
# Do the necessary DB migrations
echo "######### Doing database migrations #########"
python manage.py makemigrations
python manage.py migrate --run-syncdb
python manage.py loaddata Stemweb/algorithms/init_algorithms.json
python manage.py loaddata Stemweb/files/files.json
#python manage.py loaddata Stemweb/home/fixtures/bootstrap.json
# Start celery worker
echo "######### Starting Celery worker #########"
#celery -A Stemweb worker --config=settings & ### The --config option for the CLI was removed in Celery 5.2.
### Set the CELERY_CONFIG_MODULE environment variable instead.
export CELERY_CONFIG_MODULE=settings ### in the django settings
celery -A Stemweb worker &
# Start Django server
echo "######### Starting Django server #########"
python manage.py runserver 0.0.0.0:8000