forked from eallrich/checkniner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvenv_gunicorn.sh
More file actions
31 lines (24 loc) · 1.06 KB
/
Copy pathvenv_gunicorn.sh
File metadata and controls
31 lines (24 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# ============================================================================
# Utility script for starting gunicorn
# ------------------------------------
# This script is particularly useful as a command target in a Supervisor
# configuration. While Supervisor can handle activating a virtualenv, it's not
# very elegant. Here we can do everything we need to get gunicorn and django
# up and running.
# ============================================================================
SITE_ROOT=$(dirname $0)
SOCKET=$SITE_ROOT/sock/gunicorn
SOCKET_DIRECTORY=$(dirname $SOCKET)
WORKERS=3
WSGI=cotracker.wsgi
echo "Operating in $SITE_ROOT, socket will be at $SOCKET"
# Making sure the parent directories for the socket exist
test -d $SOCKET_DIRECTORY || mkdir -p $SOCKET_DIRECTORY
echo "Loading virtualenv"
# Getting all of the necessary env vars for django
source bin/activate
echo "Starting gunicorn"
# Using exec because the shell script doesn't need to keep running on its own
# after starting gunicorn.
exec gunicorn --workers $WORKERS --bind unix:$SOCKET $WSGI