From b9a18bda61292a9b6fea4dec724082d215af5425 Mon Sep 17 00:00:00 2001 From: Matt Lehman Date: Mon, 9 Feb 2026 22:44:54 -0500 Subject: [PATCH] Add root Fly config for GitHub integration --- .dockerignore | 10 ++++++++ .github/workflows/fly-deploy.yml | 5 +++- Dockerfile.fly | 21 +++++++++++++++++ README.md | 1 + docs/fly-api-rollout.md | 17 +++++--------- fly.toml | 39 ++++++++++++++++++++++++++++++++ 6 files changed, 81 insertions(+), 12 deletions(-) create mode 100644 Dockerfile.fly create mode 100644 fly.toml diff --git a/.dockerignore b/.dockerignore index 62c9889..c422e70 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,3 +11,13 @@ docs *.swp *~ .DS_Store +interview-app/node_modules +interview-app/apps.json +interview-app/data +interview-app/builds +interview-app/public/builds +interview-app/uploads +interview-app/certs +interview-app/action-log*.jsonl +interview-app/.session-state.json +interview-app/.conversation-backup.json diff --git a/.github/workflows/fly-deploy.yml b/.github/workflows/fly-deploy.yml index 681a251..ace56fb 100644 --- a/.github/workflows/fly-deploy.yml +++ b/.github/workflows/fly-deploy.yml @@ -4,6 +4,9 @@ on: push: branches: [main] paths: + - 'fly.toml' + - 'Dockerfile.fly' + - '.dockerignore' - 'interview-app/**' - '.github/workflows/fly-deploy.yml' workflow_dispatch: @@ -42,4 +45,4 @@ jobs: flyctl deploy \ --remote-only \ --app "${APP_NAME}" \ - --config interview-app/fly.toml.example + --config fly.toml diff --git a/Dockerfile.fly b/Dockerfile.fly new file mode 100644 index 0000000..de4e910 --- /dev/null +++ b/Dockerfile.fly @@ -0,0 +1,21 @@ +FROM node:22-slim + +WORKDIR /app + +ENV NODE_ENV=production + +COPY interview-app/package*.json ./ +RUN npm ci --omit=dev && npm cache clean --force + +COPY interview-app/ ./ + +RUN mkdir -p /data + +ENV PORT=8080 +ENV YAPPY_STORAGE_DIR=/data +ENV FORCE_HTTP=true +ENV AUTO_GENERATE_CERTS=false + +EXPOSE 8080 + +CMD ["node", "server.js"] diff --git a/README.md b/README.md index fe61221..87bb72e 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,7 @@ Deploy docs: `docs/github-pages.md` Distribution docs: `docs/distribution.md` Fly API rollout docs: `docs/fly-api-rollout.md` Fly CI deploy workflow: `.github/workflows/fly-deploy.yml` +Fly config: `fly.toml` Family launch docs: `docs/family-launch.md` Deploy queue docs: `docs/deploy-queue.md` Legal/supervision docs: `docs/legal-supervision.md` diff --git a/docs/fly-api-rollout.md b/docs/fly-api-rollout.md index 6e89cc7..e69bc65 100644 --- a/docs/fly-api-rollout.md +++ b/docs/fly-api-rollout.md @@ -19,20 +19,15 @@ This is the path to move Yappybara from local-only to a hosted service parents c ## Repo artifacts added for hosting -- `interview-app/Dockerfile` -- `interview-app/fly.toml.example` +- `fly.toml` (repo root; used by Fly GitHub integration) +- `Dockerfile.fly` (repo root; builds `interview-app/`) +- `interview-app/Dockerfile` (subdir deploy option) +- `interview-app/fly.toml.example` (reference config) - `interview-app/.dockerignore` - `YAPPY_STORAGE_DIR` support in `interview-app/server.js` ## Day-1 hosted deploy -From repo root: - -```bash -cd interview-app -cp fly.toml.example fly.toml -``` - Create app + volume (example region `ord`): ```bash @@ -53,7 +48,7 @@ fly secrets set ANTHROPIC_API_KEY=... \ Deploy: ```bash -fly deploy +fly deploy --config fly.toml ``` Smoke test: @@ -69,7 +64,7 @@ This repo includes `.github/workflows/fly-deploy.yml`. On every push to `main` that touches `interview-app/`, GitHub Actions runs: ```bash -flyctl deploy --remote-only --config interview-app/fly.toml.example +flyctl deploy --remote-only --config fly.toml ``` Configure in GitHub: diff --git a/fly.toml b/fly.toml new file mode 100644 index 0000000..14e708c --- /dev/null +++ b/fly.toml @@ -0,0 +1,39 @@ +app = "yappybara-api" +primary_region = "ord" + +[build] + dockerfile = "Dockerfile.fly" + +[env] + PORT = "8080" + YAPPY_MODE = "claude" + YAPPY_BILLING_MODE = "api" + YAPPY_STORAGE_DIR = "/data" + YAPPY_DEPLOY_DOMAIN = "yappybara.dev" + YAPPY_DEPLOY_PRICE_USD = "9" + FORCE_HTTP = "true" + AUTO_GENERATE_CERTS = "false" + +[http_service] + internal_port = 8080 + force_https = true + auto_start_machines = true + auto_stop_machines = true + min_machines_running = 0 + processes = ["app"] + + [[http_service.checks]] + interval = "15s" + timeout = "5s" + grace_period = "20s" + method = "GET" + path = "/api/health" + +[[vm]] + memory = "1gb" + cpu_kind = "shared" + cpus = 1 + +[[mounts]] + source = "yappybara_data" + destination = "/data"