Skip to content

[INFRA 4] Deterministic deploys: Render deploy-hook API, staging environment, worker as separate service #157

Description

@m-khan-97

Objective

Replace hope-based deployment with a deterministic pipeline, add a staging tier, and stop running the scan worker as a background subshell inside the web container.

Current state

  • deploy.yml literally runs sleep 120 and then polls /health, assuming Render finished building — no build identity, no rollback, races on slow builds
  • No staging environment: dev and main both smoke-test against the production URL
  • startup.sh backgrounds the worker inside the Gunicorn container: it dies invisibly on dyno restarts mid-scan and cannot scale independently

Scope

  • Trigger deploys via Render's deploy-hook/API and poll the deploy status endpoint until live (no fixed sleeps), gating on the reported deploy ID
  • render.yaml blueprint defining services declaratively: openshield-api-staging (auto-deploy from dev) and openshield-api (from main)
  • Smoke tests run against staging for dev pushes, production for main
  • Worker moved to a Render background worker service sharing the image/env (depends on stale-scan recovery already in DatabaseManager — present)
  • Documented rollback procedure (redeploy previous commit via API)

Out of scope

Acceptance criteria

  • Deploy workflow fails or succeeds based on Render's actual deploy status, not a timer
  • Staging URL serves dev; production serves main
  • Worker runs as its own service; killing the web service does not kill in-flight scans
  • CI passes, base branch dev

Category

Infrastructure / Deployment

Metadata

Metadata

Labels

enhancementNew feature or requestinfraInfrastructure, CI/CD, deployment, and platform engineeringpriority: highImportant, should be fixed in the current sprint

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
🔨 In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions