GrowthOps_OS / supervisor.sh
Corin1998's picture
Upload 4 files
c01f819 verified
[supervisord]
nodaemon=true
logfile=/var/log/supervisor/supervisord.log
[program:redis]
command=/usr/bin/redis-server --save "" --appendonly no
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
priority=10
; Postgres is optional: controlled by USE_INTERNAL_POSTGRES env
[program:postgres]
command=/bin/bash -lc "if [ \"$USE_INTERNAL_POSTGRES\" = \"true\" ]; then \
mkdir -p /data/postgres && \
chown -R postgres:postgres /data/postgres && \
su - postgres -c '/usr/lib/postgresql/15/bin/initdb -D /data/postgres' || true && \
su - postgres -c \"/usr/lib/postgresql/15/bin/pg_ctl -D /data/postgres -l /data/postgres/logfile start\" && \
sleep 2 && \
su - postgres -c \"psql -c 'CREATE USER %%(POSTGRES_USER)s WITH PASSWORD '\\''%%(POSTGRES_PASSWORD)s'\\'';'\" || true && \
su - postgres -c \"psql -c 'CREATE DATABASE %%(POSTGRES_DB)s OWNER %%(POSTGRES_USER)s;'\" || true && \
tail -f /data/postgres/logfile; \
else \
echo 'USE_INTERNAL_POSTGRES != true; skipping postgres start' && tail -f /dev/null; \
fi"
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
priority=15
environment=POSTGRES_USER=%(ENV_POSTGRES_USER)s,POSTGRES_PASSWORD=%(ENV_POSTGRES_PASSWORD)s,POSTGRES_DB=%(ENV_POSTGRES_DB)s
[program:celery]
command=/bin/bash -lc "cd /app && celery -A app.tasks.celery_app worker --loglevel=INFO"
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
priority=20
[program:uvicorn]
command=/bin/bash -lc "python -m app.main"
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
priority=30