diff --git a/.docker/entrypoint.sh b/.docker/entrypoint.sh index ecd068c6eee03495c78c31e09e0643b5a5cb4d76..e11fcd4bf1dea8c0b96d9ef93386213e45c8a7da 100644 --- a/.docker/entrypoint.sh +++ b/.docker/entrypoint.sh @@ -32,6 +32,14 @@ if [ "$DJANGO_SUPERUSER_PASSWORD" != "" ] ;then ./manage.py createsuperuser --noinput fi +env | while IFS= read -r line; do + value=${line#*=} + name=${line%%=*} + case $name in EXTRA_DJANGO_SETTING*) + echo -e "$value" > "./AKPlanning/settings/$name.py" + esac +done + ./manage.py collectstatic --noinput ./manage.py compilemessages -l de_DE uwsgi --ini .docker/uwsgi.ini diff --git a/Dockerfile b/Dockerfile index 8743d2739cf96f1278fb28215e33741c3a0be69a..32041dcb86e187e2803dac267f672bc8f4339806 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,5 +9,7 @@ RUN pip install -r requirements.txt -r .docker/extra_requirements.txt ENV DJANGO_SETTINGS_MODULE=AKPlanning.settings_production +RUN mkdir /app/AKPlanning/settings + EXPOSE 3035 CMD ["sh", "/app/.docker/entrypoint.sh"] diff --git a/INSTALL.md b/INSTALL.md index 2c22591dcb5e622c733b9832f2b52335a7bea8cf..84e5cd8d9aa89fc9ecdf9ea1010b2e5c396d5a71 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -145,6 +145,7 @@ services: DJANGO_SUPERUSER_USERNAME: admin DJANGO_SUPERUSER_EMAIL: admin@example.com DJANGO_SUPERUSER_PASSWORD: supersecret + EXTRA_DJANGO_SETTING_FOO: DJANGO_FOO = True\nDJANGO_BAR = False depends_on: - mariadb networks: @@ -226,6 +227,12 @@ Using the environment variables `DJANGO_SUPERUSER_{USERNAME,EMAIL,PASSWORD}`. The second way is to run the following command after the container has started: `docker-compose exec -it akplanning-server ./manage.py createsuperuser` +### Extra djnago settings +For simple cases you can pass environment variables starting with `EXTRA_DJANGO_SETTING`. +The content of such variables is written into python files, which are loaded as settings. + +For more complex scenarios you can also mount a docker volume to `/app/AKPlanning/settings` and add any number of python files to the volume. + ## Updates To update the setup to the current version on the main branch of the repository use the update script ``Utils/update.sh`` or ``Utils/update.sh --prod`` in production.