r/devops • u/ikraaaaa • Jul 25 '26
Discussion How do you reduce risk when deploying to prod?
I’m researching how engineers make safer production changes.
Many teams now use strategies like automated tests, regression tests, canary releases, automated rollbacks, and better observability, but production incidents still happen after deployments.
I’m curious about real experiences from engineers:
- What type of change makes you the most cautious before deploying?
- What was the last deployment that made you nervous and why?
- What gives you enough confidence to press the deploy button?
For me, database migrations are still one of the hardest categories.
Would love to learn how other teams approach this.
2
u/mikeismug Jul 25 '26
The last deployment that made me nervous was changes to an existing Terraform module creating new resources (public IPs) and applying additional configuration to existing resources (IPs and DNATs) in a public cloud connectivity zone serving many app and infra teams. The Terraform plan said the full changes wouldn't be known until apply, but it did say it was going to delete things I wanted to be sure were going to come back. I had no test environment and the level of risk was not acceptable to me.
I ended up breaking it down and instead of running the pipeline that would normally do the terraform plan and apply, I did it manually in steps using
terraform apply --targetso I could add the new resources needed for a full plan of the remaining changes to be 100% known.Now that I understand the process, combination of resources, and dependency graph, my team confidently runs the plan and apply in the pipeline.
24
u/AsterYujano Jul 25 '26
Careful PR reviews, staging/QA environments, tests, unit tests, integration tests.
Automatic rollback under high error rate.
Canary deployments.
Great observability ofc.
I don't think I was stressed to deploy any applications in the last years once good guardrails are in place. (Ofc, deploying things like ingress, DBs and cluster changes are another story...).
3
u/Factmin Jul 25 '26
Small & frequent changes are still the best answer for me, unfortunately in many enterprises this is often not practically possible. The bigger the change is and the longer since the previous change, the more likely it is that something will go wrong.
From my experience, nobody is really reviewing a several-thousand line PR properly so it just becomes theatre. Equally, you can bet if you are deploying massive changes on a quarterly basis that there will be some unexpected fuckery in the environment or surrounding infrastructure that wasn't properly documented.
- What type of change makes you the most cautious before deploying? Anything touching centralised infrastructure (ingress, databases, auth, cluster itself)
- What was the last deployment that made you nervous and why? I can't really remember, I was a bit nervous changing our (managed) network policy and CNI for the cluster because it was a one way trip but we'd tested it extensively so it still wasn't so bad. In my first DevOps role things were a mess and the culture sucked so every deployment made me nervous.
- What gives you enough confidence to press the deploy button? In a normal week we're probably deploying (small changes) to prod anywhere from 10-30 times depending on what we scoped in so it's not a big deal. 3 environments before prod, 2 of which are readonly outside of IaC and deployment pipelines. Kubernetes already handles safe rollouts if pods fail and we can quickly revert otherwise. Sometimes things break a little, we learn and move on. Nobody will yell at each other for a breaking change, so we do not have stress in that sense.
2
u/Max-P Jul 25 '26
Foresight.
I don't deploy things I'm not 100% confident is ready and solid. When I make changes, I always evaluate what's the worst that can possibly happen, and design the stuff so it can handle the absolute worst case scenario. When you're ready for the worst, small incidents feel like a minor roadbump.
If I deploy a database migration, I query the numbers in prod before deploying so I know in advance how many rows will be migrated and tailor the strategy around that. Handful of rows that needs fixups? Standard Rails migration will work. Giant table gets a new column? I make a new table, migrate to the new table in the background, lock the original table, swap them and unlock so it's a tiny almost atomic swap.
If a deployment can fail, the deployment includes an easy and fast way to rollback and alerts to tell me I need to initiate the rollback.
A lot of "unexpected" breakages are really more like, work fast ship fast couldn't be bothered to fully analyze the impact of the change. If you're gonna call a new API on every page load you better have evaluated the impact of calling that API every page load. More often than not the frontend team just ships it, the backend team just ships it, and it falls on ops to deal with the incident when it inevitably blows up the server because nobody cared to ask what the impact would be and if it's cacheable. It's effectively incident-driven development.
17
u/chocopudding17 Jul 25 '26
LLM slop. Stop.
7
u/Difficult-Ad-3938 Jul 25 '26
I pray to the server god
1
u/sokjon Jul 25 '26
Decouple release and deployment
1
u/marcusbell95 Jul 27 '26
two things moved the needle for us more than i expected:
continuous synthetic checks against prod that i actually trust. we didn't prioritize this until a deploy masked an existing flaky dependency and we spent 2hrs blaming the wrong thing. once you know your monitors fire within ~60s of a real failure (and you've actually tested them, not just assumed they work), deploying gets way less stressful. the anxiety is rarely about the change itself - it's about not knowing how fast you'll find out.
for db migrations: we gate every migration on a test run against a clone at actual prod row counts. index scans on 500k rows vs 50M in prod is a completely different world, and PR review doesn't catch it. got burned once, made it a hard pipeline gate.
and if something still feels scary after canary/rollback/feature flags are in place, that feeling is usually data. either the change is too big, the blast radius is too wide, or you don't actually trust your rollback. worth figuring out which one before pressing deploy.
6
u/Rocketninja16 Jul 25 '26
I keep a paper bag nearby to breathe into.
2
u/redblueberry1998 Jul 25 '26
Just straight up deploy to prod like a chad and pray AWS doesn't break. Have faith in yourself.
Jokes aside, I personally don't feel too nervous because most of our changes are reviewed before being merged. We run another cluster ala blue-green to test for any potential issues when changes could be breaking, like deploying another microservice container. Fuck ups are bound to happen every now and then(misconfig, missing env, etc), so we have serviceops on standby to rollback in case that happens.
1
u/keldani Jul 25 '26
Integration tests. For web services integration tests provide so much value. They cover so much more than unit tests and they are rarely broken by code changes. And if they are it likely means you made a breaking change that you shouldn't do. For DB migrations its about developer discipline and not make breaking changes. You want to drop a table and migrate to a new table? Only way to safely do so is 2 separate deployments where the first creates and migrates data to the new table while a second deployment drops the old table after you're certain it's no longer needed
1
u/Floss_Patrol_76 Jul 25 '26
the thing that de-risked prod for us more than any canary was decoupling schema changes from code deploys. every migration is expand first (add the new column, backfill, ship code that reads both shapes), then contract in a separate deploy once nothing references the old one. no single deploy is ever a big-bang that way, and rollbacks stop being scary because the schema is always compatible with the version right before it.
1
u/ben_bliksem Jul 25 '26
- unit tests and a full build that must pass on PRs
- thorough reviews
- automatic deployment to dev/integration branches as soon as merge is complete. No fucking around with long lived feature branches or a development branch with a once a sprint release nonsense - every merge is to main and each becomes a release candidate
- automated progression to test envs - do not underestimate the power of the humble "scream test"
- rolling deployments
And most importantly - you need to trust your deployment pipeline is quick. You want to be able to release a fix double time (5 min from dev to production)
If you are too scared to deploy something intra day during market open, something is wrong. Not saying you should, but you shouldn't be scared to.
1
u/2skip Jul 25 '26
Deployment 'Rings' (sets of targeted machines): Create a deployment plan | Microsoft Learn
Example: Canaries > Early Adopters > Users (If no issues with the machines in a ring, continue deployment to the set of machines to the right, else stop deployment, make fixes, and start again at the leftmost ring.)
1
u/malik22531 Jul 25 '26
Secrets and configs are managed correctly.
Careful PR reviews with proper branching strategy to avoid the conflicts.
CI setup which includes the code and image scans.
CD with gitops if deployed on Kubernetes. And a proper rollback strategy to avoid the uninvited downtime.
1
u/elliotones Jul 25 '26
“If it hurts, do it more often”
We deploy to prod on average just over 10 times per day. We can and do deploy at 4:55 on a Friday. Most changes are a single line, some are a single file, very few span multiple files. Smaller PRs are easier to review, easier to validate, and easier to roll back if needed.
Find the bottleneck and fix it. If you can’t deploy every day because of your review process, fix your review process. A very strict linting setup helps. If downtime is scary, architect for zero downtime deployments. If your testing environments don’t inspire confidence, make them reflect prod more accurately. These are all investments in your agility and they all pay off, but you have to choose to do them first.
1
u/spunkyfingers Jul 25 '26
Just test it in prod bro
1
u/claw-1 Jul 25 '26
Feature flags. Release rings. APIM setup to gradually route traffic.
1
u/[deleted] Jul 25 '26
How can a 1 year old account have so little posts but in consecutive days? What is this shit
1
u/Dolapevich Jul 25 '26
Find and document SPOF ( Single point of failure ). Sometimes is obvious, PROD DB down means no app, and sometimes it is not so obvious.
1
u/Intrepid_Standard378 Aug 19 '26 edited Aug 19 '26
you cant flip migrations so make those reversible by hand and never rename all at once. confidence past that is small batches and tying a bad metric back to exact one change fast which falls under the runtime-tool territory like hud though a lot of is is just deploy markers on graph.
0
u/Raja-Karuppasamy Jul 26 '26
biggest one for me is env var handling across environments, had a NEXT_PUBLIC_* var that worked fine locally but silently broke in prod because it needed to be baked in at build time, not injected at runtime. no crash, just wrong behavior.
that’s part of why I got into scoring deploy risk before merge, files touched, blast radius, whether config/migrations are involved. most teams eyeball that instead of actually scoring it.
migrations agreed though, that’s the one category where rollback usually can’t save you.
0
u/Shazvox Jul 25 '26
I haven't tried it yet, but Blue-Green deployment sounds nice.
0
u/toughrogrammer Jul 26 '26
Test is everything.
Review don't help to reduce risk. It's just sharing context.