Back to course overview
Module 8Deploy: from script to a public URL 14 min

Deploying to a public URL

Containerize the app and deploy it to a platform like Render, Railway, or Fly.io — live on the internet.

The starter kit ships a Dockerfile that packages the whole app — Python deps, semantic layer, and even the database (it regenerates it at build time). A container means "works on my machine" becomes "works anywhere," which is exactly what a host needs.

Dockerfiledocker
FROM python:3.11-slim
WORKDIR /srv
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN python data/generate_data.py          # build the DB into the image
ENV PORT=8000
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT}"]

Deploy on a managed platform

Platforms like Render, Railway, and Fly.io deploy a container from a git repo with almost no config. The flow is the same everywhere:

First, put the code on GitHub

  1. 1From the semantic-agent/ folder: git init (skip if it's already a git repo), then git add . and git commit -m "Percolate analytics agent".
  2. 2On github.com, click + → New repository, name it (e.g. percolate-agent), and create it empty — no README, since you're pushing an existing project.
  3. 3Connect and push: git remote add origin <your-repo-url> then git push -u origin main.
The repo root must contain the Dockerfile

Push the semantic-agent/ folder itself as the repository — not the whole course folder with semantic-agent/ nested inside. Platforms look for a Dockerfile at the repo root; if it's buried a level down, the build won't start.

Then create the service

  1. 1Create a new Web Service on the platform and point it at the repo. It detects the Dockerfile.
  2. 2Add ANTHROPIC_API_KEY as a secret environment variable in the platform's dashboard.
  3. 3Deploy. The platform builds the image, runs it, and gives you a public HTTPS URL like https://percolate-agent.onrender.com.
  4. 4Open the URL and ask your data a question — from anywhere.
Hosting cost

All three platforms have free or low-cost tiers that comfortably run a demo app like this. Your ongoing cost is mostly the Anthropic API usage — a few cents per question. A shared portfolio project costs very little to keep online, and you can switch the MODEL constant to a smaller model if traffic ever makes it add up.

SQLite in a container is read-mostly

Because the database is baked into the image, it's perfect for this analytical, read-only app. If you later needed the app to write persistent data, you'd move to a hosted database — but for querying fabricated business data, the in-image SQLite is ideal.