Skip to content

Commit

Permalink
Change the run script (#294)
Browse files Browse the repository at this point in the history
- move from port 8000
  • Loading branch information
tudoramariei authored Jul 3, 2024
1 parent 767655e commit 1a5b87a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docker/s6-rc.d/backend/run
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
#!/command/with-contenv sh

set -e

cd /var/www/votong/backend/ || exit 1

# if ENVIRONMENT="production", then run with gunicorn
if [ "${ENVIRONMENT}" = "production" ]; then
echo "Running in production mode"

# https://docs.gunicorn.org/en/latest/design.html#how-many-workers
WORKERS=${GUNICORN_WORKERS_COUNT:-$(((2 * $(nproc)) + 1))}

echo "Starting Gunicorn with ${WORKERS} workers"

python3 -m gunicorn civil_society_vote.wsgi \
--bind "unix:///run/gunicorn.sock" \
--log-level info \
--worker-class gevent \
--workers "${WORKERS}" \
--bind 0.0.0.0:8000 \
--timeout 60
else
echo "Running in development mode"

python3 manage.py runserver 0.0.0.0:8000
fi

0 comments on commit 1a5b87a

Please sign in to comment.