A FastAPI application running on Uvicorn, managed by Velos.
- API:
uvicorn main:appwith 4 workers, 512 MB memory limit - Auto-restart: restarts on crash, up to 10 attempts
- Log rotation: 20 MB per file, 14 rotated files retained
- Env profiles:
productionanddevelopment
# Install dependencies
pip install -r requirements.txt
# Start with Velos
velos start --config velos.toml
# Start in development (with file watching)
# Set watch = true in velos.toml first
velos start --config velos.toml --env development
# Test the API
curl http://localhost:8000/
curl http://localhost:8000/health
# View logs
velos logs apiThe config includes a commented-out Celery worker section. To enable it:
- Install Celery:
pip install celery[redis] - Uncomment the
[apps.celery]section invelos.toml - Start a Redis broker:
redis-server - Run:
velos start --config velos.toml
PYTHONUNBUFFERED=1ensures Python output appears in logs immediately- Adjust
--workersbased on your CPU cores (rule of thumb:2 * cores + 1) - For development, set
watch = trueto auto-reload on code changes