ucast/deploy/entrypoint.py
ThetaDev f79220515b
All checks were successful
continuous-integration/drone/push Build is passing
add dockerfile
2022-06-26 23:23:16 +02:00

30 lines
636 B
Python
Executable file

#!/usr/bin/env python
import os
import subprocess
import sys
from honcho import manager
def run_cmd(cmd):
returncode = subprocess.call(cmd)
if returncode != 0:
sys.exit(returncode)
n_workers = int(os.environ.get("UCAST_N_WORKERS", "1"))
run_cmd(["ucast-manage", "collectstatic", "--noinput"])
run_cmd(["ucast-manage", "migrate"])
m = manager.Manager()
m.add_process("ucast", "gunicorn ucast_project.wsgi")
m.add_process("nginx", "nginx")
for i in range(n_workers):
m.add_process(f"worker_{i}", "ucast-manage rqworker")
m.add_process("scheduler", "ucast-manage rqscheduler")
m.loop()
sys.exit(m.returncode)