mediagoblin-docker/run.sh

18 lines
668 B
Bash

#!/bin/bash
set -e
# Based on environment variable values, replace placeholders in MediaGoblin configuration.
envsubst < /app/mediagoblin_local.ini.template > /app/mediagoblin_local.ini
chown mediagoblin.www-data /app/mediagoblin_local.ini
su - mediagoblin --command "cd /app && gmg dbupdate"
# Wait for the database to come up.
database_host=$(echo $DATABASE_URL | cut -d @ -f 2 | cut -d / -f 1)
/sbin/wait-for ${database_host}:5432
# Run uWSGI and Nginx.
chown mediagoblin.www-data /app/user_dev
/usr/bin/uwsgi --uid mediagoblin --gid www-data --master --workers 3 /etc/uwsgi/apps-enabled/mediagoblin.yaml \
& /usr/sbin/nginx -g 'daemon off; master_process on;'