mirror of
https://github.com/workhardbekind/workout-challenge.git
synced 2026-07-04 01:13:32 -04:00
78 lines
No EOL
2.9 KiB
Text
78 lines
No EOL
2.9 KiB
Text
# Working directory has to be the top directory "workout_challenge" that contains the sub-folders "src-frontend" and "src-backend"
|
|
|
|
[supervisord]
|
|
nodaemon=true
|
|
|
|
# Supervisord frontend to see status / restart / stop the below processes
|
|
[inet_http_server]
|
|
port = 9001
|
|
priority=100
|
|
|
|
# Redis sever for caching and celery backend
|
|
[program:redis]
|
|
directory=/workout_challenge/src-backend/data
|
|
command=/usr/bin/redis-server
|
|
stdout_logfile=/dev/stdout
|
|
stderr_logfile=/dev/stderr
|
|
stderr_logfile_maxbytes=0
|
|
stdout_logfile_maxbytes=0
|
|
autorestart=true
|
|
priority=200
|
|
stopwaitsecs=20
|
|
|
|
# Celery for Django for task queuing
|
|
[program:celery-worker]
|
|
directory=/workout_challenge/src-backend
|
|
command=sh -c 'while ! nc -z localhost 6379 </dev/null; do echo "celery-worker waiting for redis at port :6379"; sleep 3; done && celery -A workout_challenge worker --loglevel INFO --without-mingle --without-gossip --autoscale=4,1 --events'
|
|
stdout_logfile=/dev/stdout
|
|
stderr_logfile=/dev/stderr
|
|
stderr_logfile_maxbytes=0
|
|
stdout_logfile_maxbytes=0
|
|
autorestart=true
|
|
priority=300
|
|
stopwaitsecs=20
|
|
|
|
# Celery Beat for task scheduling
|
|
[program:celery-beat]
|
|
directory=/workout_challenge/src-backend
|
|
command=sh -c 'while ! nc -z 0.0.0.0 8000 </dev/null; do echo "celery-beat waiting for django at port :8000"; sleep 3; done && celery -A workout_challenge beat --scheduler django_celery_beat.schedulers:DatabaseScheduler --loglevel INFO'
|
|
stdout_logfile=/dev/stdout
|
|
stderr_logfile=/dev/stderr
|
|
stderr_logfile_maxbytes=0
|
|
stdout_logfile_maxbytes=0
|
|
autorestart=true
|
|
priority=600
|
|
stopwaitsecs=20
|
|
|
|
# Celery Flower as frontend to view task que and task status
|
|
[program:celery-flower]
|
|
directory=/workout_challenge/src-backend
|
|
command=sh -c 'while ! nc -z localhost 6379 </dev/null; do echo "celery-flower waiting for redis at port :6379"; sleep 3; done && celery -A workout_challenge flower --persistent=True'
|
|
stdout_logfile=/dev/stdout
|
|
stderr_logfile=/dev/stderr
|
|
stderr_logfile_maxbytes=0
|
|
stdout_logfile_maxbytes=0
|
|
autorestart=true
|
|
priority=400
|
|
|
|
# Backend Django
|
|
[program:backend-django]
|
|
directory=/workout_challenge/src-backend
|
|
command=sh -c 'while ! nc -z localhost 6379 </dev/null; do echo "django gunicorn waiting for redis at port :6379"; sleep 3; done && python manage.py makemigrations && python manage.py migrate && /usr/local/bin/gunicorn workout_challenge.wsgi:application --workers=3 --worker-class=gevent --chdir /workout_challenge/src-backend --bind 0.0.0.0:8000 --timeout 120'
|
|
stdout_logfile=/dev/stdout
|
|
stderr_logfile=/dev/stderr
|
|
stderr_logfile_maxbytes=0
|
|
stdout_logfile_maxbytes=0
|
|
autorestart=true
|
|
priority=500
|
|
stopwaitsecs=20
|
|
|
|
# Nginx proxy for React frontend and backend redirect to gunicorn running Django
|
|
[program:nginx]
|
|
command=sh -c 'echo "window.RUNTIME_CONFIG = { REACT_APP_SENTRY_DSN: \"${REACT_APP_SENTRY_DSN}\" };" > /usr/share/nginx/html/config.js && /usr/sbin/nginx -g "daemon off;"'
|
|
stdout_logfile=/dev/stdout
|
|
stderr_logfile=/dev/stderr
|
|
stderr_logfile_maxbytes=0
|
|
stdout_logfile_maxbytes=0
|
|
autorestart=true
|
|
priority=700 |