Skip to content

Commit 05b8f60

Browse files
authored
Merge pull request #923 from helgi/background_startup
feat(boot): background the loading of DB data into Kubernetes
2 parents 1466e7b + ba12d09 commit 05b8f60

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

rootfs/bin/boot

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,28 @@ chgrp deis /var/run/docker.sock
2323
groupadd -g "$(stat -c "%g" /var/run/docker.sock)" docker || true
2424
usermod -a -G docker deis || true
2525

26+
echo ""
2627
echo "Django checks:"
2728
python /app/manage.py check --deploy api
2829

30+
echo ""
2931
echo "Health Checks:"
3032
python /app/manage.py healthchecks
3133

34+
echo ""
3235
echo "Database Migrations:"
3336
sudo -E -u deis python /app/manage.py migrate --noinput
3437

3538
# spawn a gunicorn server in the background
39+
echo ""
40+
echo "Starting up Gunicorn"
3641
sudo -E -u deis gunicorn -c /app/deis/gunicorn/config.py api.wsgi &
3742

38-
python /app/manage.py load_db_state_to_k8s
43+
echo ""
44+
echo "Loading database information to Kubernetes in the background"
45+
echo "Log of the run can be found in /app/data/logs/load_db_state_to_k8s.log"
46+
# python -u avoids output buffering
47+
nohup python -u /app/manage.py load_db_state_to_k8s > /app/data/logs/load_db_state_to_k8s.log &
3948

4049
# smart shutdown on SIGTERM (SIGINT is handled by gunicorn)
4150
function on_exit() {
@@ -46,6 +55,7 @@ function on_exit() {
4655
}
4756
trap on_exit TERM
4857

58+
echo ""
4959
echo deis-controller running...
5060

5161
wait

0 commit comments

Comments
 (0)