#!/bin/bash # Run the prerun script to init CKAN and create the default admin user sudo -u ckan -EH python3 prerun.py # Run any startup scripts provided by images extending this one if [[ -d "/docker-entrypoint.d" ]] then for f in /docker-entrypoint.d/*; do case "$f" in *.sh) echo "$0: Running init file $f"; . "$f" ;; *.py) echo "$0: Running init file $f"; python "$f"; echo ;; *) echo "$0: Ignoring $f (not an sh or py file)" ;; esac echo done fi # Check whether http basic auth password protection is enabled and enable basicauth routing on uwsgi respecfully if [ $? -eq 0 ] then if [ "$PASSWORD_PROTECT" = true ] then if [ "$HTPASSWD_USER" ] || [ "$HTPASSWD_PASSWORD" ] then # Generate htpasswd file for basicauth htpasswd -d -b -c /srv/app/.htpasswd $HTPASSWD_USER $HTPASSWD_PASSWORD # Start supervisord supervisord --configuration /etc/supervisord.conf & # Start uwsgi with basicauth sudo -u ckan -EH uwsgi -i ckan-uwsgi.ini else echo "Missing HTPASSWD_USER or HTPASSWD_PASSWORD environment variables. Exiting..." exit 1 fi else # Start supervisord supervisord --configuration /etc/supervisord.conf & # Start uwsgi sudo -u ckan -EH uwsgi -i ckan-uwsgi.ini fi else echo "[prerun] failed...not starting CKAN." fi