We Killed Our Staging Environment and Moved QA to Production Canaries
Our shared staging cluster cost $2,740/month and missed real production bugs. Here is how we killed staging and moved QA to Argo Rollouts canaries.
On a Monday morning, nine engineers found themselves stuck in a Slack thread, watching a progress bar stuck at 45 minutes. A half-baked Alembic migration had been merged into staging, locking the invoices table and causing a 502 bug on /api/v1/exports to affect paying customers in production. The hotfix finally went out four hours later, but the incident log revealed that staging had failed to catch four of the previous five production outages.
The shared staging environment had 120 clean seed rows, zero concurrent webhook traffic from Stripe, and a Redis instance that never evicted keys. In contrast, production had 18 million rows, spiky batch jobs, and legacy payloads from 2021. The company decided to stop using the shared staging cluster, costing $2,740 monthly in AWS bills.
To address the issues with shared staging, the team implemented three guardrails for real verification in production. The first guardrail involved using Argo Rollouts with automated Prometheus rollbacks. When a new container image is deployed, it receives 5% of live traffic for three minutes. An AnalysisTemplate polls Prometheus every 30 seconds, checking for 5xx error rates and p99 latency.
If the error rate exceeds 0.5% or latency exceeds 650ms, the rollout is aborted, and canary pods are drained without human intervention. This ensures shift-right testing and prevents breaking things faster.
The second guardrail incorporated shadow traffic for risky read and pricing paths. For read-only and idempotent endpoints, live production HTTP requests are mirrored to the new version asynchronously using Envoy/Nginx traffic shadowing. Users receive responses from the old stable pods, while the canary pod processes real-world JSON payloads and headers. This method caught a bug in the search query builder that had gone unnoticed for three weeks.
The third guardrail involved isolated synthetic probes to monitor the system's health. These probes help identify any potential issues before they impact users, ensuring a smoother and more reliable deployment process.
Rewritten by urgent.news; may contain errors — check the original.
Source: hackernoon.com