Skip to content

Instantly share code, notes, and snippets.

@andreibosco
Created April 28, 2014 16:27
Show Gist options
  • Save andreibosco/11376968 to your computer and use it in GitHub Desktop.
Save andreibosco/11376968 to your computer and use it in GitHub Desktop.
EDX - Supervisor: gunicorn_lms.sh
#!/bin/bash
NAME="EDX-LMS" # Name of the application
USER=azureuser # the user to run as
GROUP=azureuser # the group to run as
DJANGODIR=/home/${USER}/apps/edx/edx-platform # Django project directory
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=lms.envs.dev # which settings file should Django use
DJANGO_WSGI_MODULE=lms.wsgi # WSGI module name
echo "Starting $NAME as `whoami`"
cd /home/${USER}/apps/edx/edx-platform
# Activate the virtual environment
source /home/${USER}/.virtualenvs/edx/bin/activate
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DJANGODIR:$PYTHONPATH
# Start your Django Unicorn
# Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
exec /home/${USER}/.virtualenvs/edx/bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
--log-level=debug \
--bind=127.0.0.1:8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment