6.7 KiB
| phase | plan | type | wave | depends_on | files_modified | autonomous | requirements | must_haves | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 01-infrastructure-and-deployment | 01 | execute | 1 |
|
true |
|
|
Purpose: Provide a deployable container image that the Terraform stack (Plan 02) will reference. The health endpoint proves the service is running correctly.
Output: Docker image viktorbarzin/f1-stream:v2.0.0 pushed to Docker Hub, containing a working FastAPI server.
<execution_context> @/Users/viktorbarzin/.claude/get-shit-done/workflows/execute-plan.md @/Users/viktorbarzin/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/research/STACK.mdExisting files to replace/modify:
@stacks/f1-stream/files/Dockerfile @stacks/f1-stream/files/redeploy.sh
Task 1: Create FastAPI backend application with health endpoint stacks/f1-stream/files/backend/main.py, stacks/f1-stream/files/backend/requirements.txt Create the directory `stacks/f1-stream/files/backend/`.Create stacks/f1-stream/files/backend/requirements.txt with pinned versions:
fastapi==0.132.0
uvicorn[standard]
Create stacks/f1-stream/files/backend/main.py with a minimal FastAPI application:
- Import FastAPI
- Create app instance with title "F1 Streams"
- Add
GET /healthendpoint that returns{"status": "ok"} - Add
GET /root endpoint that returns{"service": "f1-streams", "version": "2.0.0"} - Add an
if __name__ == "__main__"block that runs uvicorn on host 0.0.0.0 port 8000
This is intentionally minimal -- just enough to prove the deployment works. Later phases will add schedule, extractor, and proxy routes.
Do NOT add any other dependencies or routes beyond the health check and root. Keep it simple.
Run python3 -c "import ast; ast.parse(open('stacks/f1-stream/files/backend/main.py').read()); print('Syntax OK')" to verify the Python file is valid.
Verify requirements.txt exists and contains fastapi and uvicorn.
backend/main.py exists with a valid FastAPI app that has /health and / endpoints. requirements.txt lists fastapi and uvicorn.
FROM python:3.13-slim-bookworm
WORKDIR /app
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY backend/ ./backend/
EXPOSE 8000
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]
Key points:
- Single-stage build (no build stage needed for Python -- interpreted language)
- Use
python:3.13-slim-bookwormas base (from stack research) - Install deps first for Docker layer caching
- Expose port 8000 (FastAPI default, different from old Go app's 8080)
- Run via uvicorn pointing to
backend.main:app
Update stacks/f1-stream/files/redeploy.sh:
#!/usr/bin/env bash
set -e
docker build -t viktorbarzin/f1-stream:v2.0.0 -t viktorbarzin/f1-stream:latest .
docker push viktorbarzin/f1-stream:v2.0.0
docker push viktorbarzin/f1-stream:latest
kubectl -n f1-stream rollout restart deployment f1-stream
Then build and push the image by running the redeploy script from the stacks/f1-stream/files/ directory. Only run the docker build and push steps (skip the kubectl rollout -- that happens after Terraform apply in Plan 02).
Build command: cd stacks/f1-stream/files && docker build -t viktorbarzin/f1-stream:v2.0.0 -t viktorbarzin/f1-stream:latest . && docker push viktorbarzin/f1-stream:v2.0.0 && docker push viktorbarzin/f1-stream:latest
IMPORTANT: The old Go application files (main.go, go.mod, go.sum, internal/, node_modules/, package.json, package-lock.json, index.html, static/) should be removed from stacks/f1-stream/files/ since they are no longer needed. Keep only: Dockerfile, redeploy.sh, and backend/.
Run docker images | grep f1-stream to confirm the image was built.
Run docker run --rm -d -p 18000:8000 --name f1-test viktorbarzin/f1-stream:v2.0.0 && sleep 2 && curl -s http://localhost:18000/health && docker stop f1-test to verify the container starts and the health endpoint responds.
Docker image viktorbarzin/f1-stream:v2.0.0 is built, pushed to Docker Hub, and serves a 200 response on GET /health when run locally.
<success_criteria>
- Docker image viktorbarzin/f1-stream:v2.0.0 exists on Docker Hub
- The image runs a FastAPI server on port 8000 with a working /health endpoint
- Old Go application files are cleaned up </success_criteria>