[Unit]
Description=Open-Sora FastAPI Service
After=network.target redis.service
Requires=redis.service

[Service]
Type=simple
User=ceshi
Group=ceshi
WorkingDirectory=/home/ceshi/mysora
Environment="PATH=/home/ceshi/venv/bin:/usr/local/bin:/usr/bin:/bin"

ExecStart=/home/ceshi/venv/bin/gunicorn api.main:api \
    --workers 4 \
    --worker-class uvicorn.workers.UvicornWorker \
    --bind 127.0.0.1:8000 \
    --timeout 3600 \
    --keep-alive 5 \
    --log-level info \
    --access-logfile /data/train-output/logs/api-access.log \
    --error-logfile  /data/train-output/logs/api-error.log

# 崩溃自动重启
Restart=always
RestartSec=5
StartLimitIntervalSec=60
StartLimitBurst=5

[Install]
WantedBy=multi-user.target
