50c2fe2a1e
ci / lint (push) Successful in 1m19s
ci / unit (push) Failing after 1m2s
ci / integration (push) Has been skipped
ci / types (push) Successful in 1m37s
ci / security (push) Failing after 38s
ci / dockerfile (push) Successful in 14s
ci / image (api) (push) Has been skipped
ci / image (reconciler) (push) Has been skipped
ci / image (worker) (push) Has been skipped
ci / bump (push) Has been skipped
Complete working build of the system learn-python/ teaches. 164 tests, mypy --strict clean, domain coverage 99%.
30 lines
898 B
Python
30 lines
898 B
Python
"""`python -m services.api` — what the container's ENTRYPOINT runs.
|
|
|
|
One uvicorn worker per container, on purpose. Replicas are Kubernetes' job: `--workers N`
|
|
forks processes the orchestrator cannot see, size, or drain, and it breaks the in-process
|
|
Prometheus registry that /metrics depends on.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import uvicorn
|
|
|
|
from svcforge_core.settings import load_settings
|
|
|
|
|
|
def main() -> None:
|
|
"""Load settings (fail fast if the env is wrong), then serve."""
|
|
settings = load_settings()
|
|
uvicorn.run(
|
|
"services.api.main:app",
|
|
factory=True,
|
|
host="0.0.0.0", # noqa: S104 - a container binds all interfaces; the pod is the boundary
|
|
port=8000,
|
|
log_level=settings.log_level,
|
|
access_log=False, # structlog owns request logging (Module 7); two sources would double it
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|