DRILLS.ai · Chapter 10
Deploying and operating
The frontend is on GitHub Pages, the backend on Render. Two hosts, two deployments that know nothing of each other. This chapter describes how the product is delivered, protected, observed, and how to roll back.
The concept
Each proof says one thing. A commit proves a change is versioned; a green CI, that its tests pass; a green /health, that the service answers. None of them alone proves the journey works online.
The delivery topology
| Service | Configuration | Watch out |
|---|---|---|
| GitHub Pages | main → Deploy to GitHub Pages WorkflowA sequence of steps decided by code: the model steps in at set points, but does not choose what comes next.See in the glossary → |
Astro base /drills.ai/, with the trailing slash |
| Render | feat/hackathon-mvp in render.yaml |
Temporary mirror of main, not a competing branch |
| Render runtime | Python 3.12.10 and free plan declared | The real dashboard was not checked again |
| Backend build | pip install -r requirements-mcp.txt |
Includes the API requirements and the MCPModel Context Protocol: a standard for exposing tools and data sources to any agent. An MCP tool is discovered by its name, description and schema.See in the glossary → SDK |
| Start | uvicorn api.main:app --host 0.0.0.0 --port $PORT |
Port provided by the host |
| Health | /health |
Does not test an OpenAI request |
| Frontend | DRILLS_API_URL → PUBLIC_DRILLS_API_URL |
Injected at the GitHub Actions build |
| Secret | Backend environment | Never in the static site |
CI: what it checks, and what it does not
The CI/CDThe checks (CI) and deployments (CD) run automatically on each push. A green CI does not prove a deployed service is healthy.See in the glossary → fits in three workflows.
| Workflow | Checks |
|---|---|
| Full-stack validation | Frontend contracts, build, UI tests, offline Python suite |
| Python AgentA program that uses a language model to decide what to do (search, call a tool, answer, refuse), in a loop, with stopping rules.See in the glossary → pipeline tests | Python 3.12 and the full pytest suite |
| Deploy to GitHub Pages | npm install, build, publishing |
Careful with the word “gate”. The Pages workflow depends on its own build, not on Full-stack validation passing. Workflows can run in parallel. Publishing only when every test passes would need extra coordination. The four runs attached to the documented commit passed; their statuses were read again on October 30, without rerunning the suites.
Changing without losing history
git switch main
git pull --ff-only
git switch -c feat/name-of-the-change
Then: the change, the tests, the DiffThe exact list of lines added and removed in a file. It's what counts, not what the assistant announces.See in the glossary → read, a commit of the intended files only, a PR to main. As long as Render follows the mirror branch, I sync it explicitly, if it is clean:
git fetch origin
git switch feat/hackathon-mvp
git merge --ff-only origin/main
git push origin feat/hackathon-mvp
A refused Fast-forwardAn update where the branch simply moves forward to the target commit, with no merge. --ff-only refuses if the histories diverge.See in the glossary → signals a divergence to look at. I do not work around it with a force-push. Moving Render to main is planned, not done: check main, change the branch in the Render settings, set branch: main in render.yaml, check the deployment, and only then delete branches. Changing the YAML alone does not prove the service followed.
Routes and limits
| Route | Use | Declared limit |
|---|---|---|
GET /health |
Health, key present or not | No generation |
POST /api/profile-import |
Reading the PDF | 3 per minute, 10 per hour |
POST /api/assessment |
Assessment without drafts | 3 per minute, 20 per hour |
POST /api/application-drafts |
Deferred drafting | 3 per minute, 20 per hour |
POST /api/application |
Old full journey | 3 per minute, 20 per hour |
GET /api/jobs |
Job list | 10 per minute |
/mcp/ |
MCP transport, if enabled | Bounded body; not necessarily the same quotas |
POST /api/drills, interview routes |
Removed features | 410 for a valid request |
POST /api/coach |
Historical companion | Still active, 10 per minute, not in the journey |
Candidate operations share a 2-slot SemaphoreA counter that limits how many operations run at the same time. When it is full, the next request is refused or waits.See in the glossary → per process. They have an overall limit of 95 seconds; the OpenAI client has a 90-second TimeoutA maximum waiting time. Past it, you abandon the call and return a readable refusal, instead of waiting forever.See in the glossary → and max_retries=0. The business corrective attempt is not a network retry. These per-IP and per-process Rate limitA maximum number of requests per period, for example 3 per minute. It protects a demo; it is not authentication.See in the glossary → protect a demo: they are not authentication, not a spending cap, and not a limit shared across instances.
From the repository (code written with the help of ChatGPT and Codex):
application_slots = asyncio.Semaphore(2)
async def run_application_operation(operation, stage="application"):
if not os.getenv("OPENAI_API_KEY"):
raise HTTPException(status_code=503, detail="Application service is not configured.")
if application_slots.locked():
raise HTTPException(status_code=429, detail="Application service is busy. Please try again shortly.")
async with application_slots:
...
result = await asyncio.wait_for(operation(), timeout=95)
A single anonymous call to /health goes out when the app opens, so the host’s wake-up (the Cold startThe slowness of the first call to a service that just started. You measure it: it's a number, not a failure verdict.See in the glossary →) happens while the candidate types. It is not a keep-alive, and it does not guarantee a warm instance.
Logging without exposing
The candidate journey logs durations and fixed codes, never the text of the CV, the posting or the drafts:
PDF extraction route=text duration_ms=...
Application stage=assessment duration_ms=... outcome=ok
Application preparation rejected: candidate_quote:0
Private responses carry Cache-Control: no-store and Server-Timing. The server duration does not include all the network transport.
Rolling back
Find the last healthy commit, make a controlled revert on the working branch, read the diff and the tests, then resync the deployment references. Never a brutal reset of the remote history, nor wiping browser dossiers to fix a code failure. An emergency RollbackGoing back to the last version that worked, described in advance by an action, a number and a unit.See in the glossary → through the host must then be reconciled with Git.
Before a demo
- Open the normal link in a test browser, with no personal dossier.
- Check the deployed commit, frontend and backend.
/health, then a real journey with ConsentThe person's explicit agreement before their data goes to a service. Without it, the request is rejected before any call.See in the glossary → and fictional data.- Import a text PDF, paste a posting and its link, read score and conditions.
- Request the documents, edit a sentence, test the export.
- Check that sending only counts after an explicit action.
- Switch language, and check the dossier stays.
- Keep the published video as a backup, presented as a recording.
What I keep
- Two independent deployments, so two checks.
- A demo limit is not security: I say what it protects.
- Logs say where and how long, never what.
The Python mechanisms
- My Python for AI 101, chapter 10 · Network, time and concurrency: card 65, the two-slot semaphore and the 95-second wait.
- My Python for AI 101, chapter 8 · Decorators, context and files: card 64, the MiddlewareA function that wraps every request of a web server, to apply the same rule to every response.See in the glossary → that sets
no-storeandServer-Timing. - My Python for AI 101, chapter 10 · Network, time and concurrency: card 49, measuring a duration and bounding a wait (here the asyncio version, with
wait_for); card 52, the lock, to compare with the two-slot semaphore. - My Python for AI 101, chapter 2 · Organizing the project: card 3, refusing to work without configuration (here, 503 without a key).
The defense question
Does a green CI prove Render is healthy?
No. Render and GitHub Pages each deploy on their own. You have to check the deployed commit and make a real call, with fictional data.