Add entrypoint
authorLorin Hochstein <lhochstein@netflix.com>
Tue, 24 Jan 2017 06:14:21 +0000 (22:14 -0800)
committerLorin Hochstein <lhochstein@netflix.com>
Tue, 24 Jan 2017 06:14:21 +0000 (22:14 -0800)
ch13/ansible/roles/mezzanine/files/entrypoint.sh [new file with mode: 0644]

diff --git a/ch13/ansible/roles/mezzanine/files/entrypoint.sh b/ch13/ansible/roles/mezzanine/files/entrypoint.sh
new file mode 100644 (file)
index 0000000..57ba6ea
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+# Adapted from https://github.com/ansible/django-gulp-nginx
+MANAGE=/srv/project/manage.py
+
+set -x
+
+if [[ $@ == *"gunicorn"* || $@ == *"runserver"* ]]; then
+       if [[ -f $MANAGE ]]; then
+       $MANAGE migrate --noinput
+       $MANAGE collectstatic --noinput
+       /srv/bin/setsite.py
+       /srv/bin/setadmin.py
+       fi
+fi
+
+