python-uvicorn.yaml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # process-compose.yaml — Python uvicorn/FastAPI/Django service
  2. #
  3. # Pattern: Python web service with health endpoint, always-restart, dedicated log file.
  4. # Copy + adapt to your stack.
  5. version: "0.5"
  6. processes:
  7. myapp:
  8. # Wrap pythonw exe path in single quotes if it contains spaces; use forward
  9. # slashes inside or single-quote backslash-paths to avoid YAML escapes.
  10. command: "pythonw -m uvicorn myapp.main:app --host 127.0.0.1 --port 8000"
  11. working_dir: "X:/path/to/myapp"
  12. environment:
  13. - "PYTHONUNBUFFERED=1"
  14. - "DJANGO_SETTINGS_MODULE=myapp.settings.local"
  15. # Don't put secrets here — source from gitignored .env via boot-start wrapper
  16. readiness_probe:
  17. http_get:
  18. host: localhost
  19. port: 8000
  20. path: / # bare root if no /health endpoint; redirects count as healthy
  21. initial_delay_seconds: 5
  22. period_seconds: 10
  23. timeout_seconds: 3
  24. failure_threshold: 3
  25. availability:
  26. restart: always
  27. backoff_seconds: 5
  28. max_restarts: 20
  29. log_location: "logs/myapp.log"