Skip to content

Add a separate dev environment (api-dev.veri-fact.ai) - #175

Merged
Param-Raval merged 4 commits into
mainfrom
dev-env
Oct 21, 2026
Merged

Param-Raval merged 4 commits into
mainfrom
dev-env

Conversation

@NardinNakhla

Copy link
Copy Markdown
Collaborator

Summary

Adds a dev environment that copies prod for end-to-end testing, served at https://api-dev.veri-fact.ai. It's deployed from the dev-env branch with DEPLOY_ENV=dev ./infrastructure/deploy.sh.

Dev runs in the same GCP project but has its own VPC, GKE cluster, Cloud SQL instance, static IP, certificate and Terraform state (terraform/dev). Setup, day-to-day use and teardown are in docs/dev-environment.md.

Changes

  • infrastructure/terraform-dev/ (new): a copy of the prod Terraform config with -dev names, IP ranges that don't overlap prod, and its own state. The dev node service account also gets roles/artifactregistry.reader, which it needs to pull images. Prod's account has that access through roles granted by hand.
  • infrastructure/deploy.sh: setting DEPLOY_ENV=dev selects the dev cluster, Terraform config and health URL. Dev deploys:
    • only run from the dev-env branch
    • stop early if service-account.json is missing
    • create the cluster first on a brand-new environment
    • create the vertex-ai-credentials secret if it doesn't exist
  • Terraform variables: the API key and secret variables are marked sensitive in both dev and prod, so plans no longer print them in plain text.
  • app/main.py: adds the dev frontend's Vercel URL to the CORS allow_origins list.
  • docs/dev-environment.md (new): setup and usage guide, including the manual Cloudflare DNS step.

Impact on prod

  • ./infrastructure/deploy.sh without DEPLOY_ENV behaves exactly as before.
  • Prod Terraform: the only change is the sensitive flags, which hide values in output and change no infrastructure.
  • After the next prod deploy, prod accepts CORS requests from the dev frontend URL.

Testing

  • Deployed dev from dev-env: both plans showed only creates, the rollout succeeded, and /v1/health returned 200 over HTTPS.
  • Prod /v1/health returned 200 throughout.

Manual steps (not in code)

  • Cloudflare: an A record for api-dev pointing to the dev static IP, set to DNS only (grey cloud). Already done.
  • service-account.json must be in the repo root before a dev deploy.

Param Raval and others added 4 commits October 20, 2026 16:16
- Grant dev node SA roles/artifactregistry.reader so pods can pull images
- Mark API key/secret Terraform variables sensitive in dev and prod
- Fail dev deploys early when service-account.json is missing
- Document the manual Cloudflare api-dev record and service-account.json prerequisite
@Param-Raval
Param-Raval merged commit d2e98a1 into main Oct 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants