Live data from Hacker News

Ask HN: How do you roll back production?

news.ycombinator.com

51–60 of 156 posts

Re: Ask HN: How do you roll back production?

#51
post #46

At the agency I used to work for, we used GitLab CI/CD. We were able to do a manual rollback for each deployment from the GitLab UI. https://docs.gitlab.com/ee/ci/environments.html#retrying-and... Disclaimer: I work at GitLab now, but my old agency was also using GitLab and their CI/CD offering for client projects for a couple years while I was there. At that agency they have even open sourced their GitLab CI configs…

GitLab CI/CD is amazing. I run a private instance on a VPS with a single worker (probably the simplest setup you can imagine) and it's astoundingly powerful.

I can't say enough great things about it - solutions like Jenkins and Travis CI just feel antiquated and clunky anymore. I always thought it wouldn't really be worth it to run CI/CD on my personal projects due to the complexity inherent in setting these solutions up until I saw the light... I had a coherent "one-click" deploy setup from scratch within an hour with GitLab.

Re: Ask HN: How do you roll back production?

#53
post #47
post #45

Earlier quoted context omitted.

I'm strictly against rollbacks and I'm strictly for everything continuous. If I need to do a roll back it means that I don't trust the system nor the code base. I will do the roll back but after that there will be a very productive retro about how we can do better to avoid rollbacks in the future (aka what did we learn). But again, as I said, there is a place and time for everything! And there are many variables! Eve…

I suspect we're going to agree to disagree here, but I highly advise you to re-consider the idea of framing a roll back as an unforced failure to your team. The last dynamic you want in a retrospective is one where not only did an unexpected failure happen (a bug pushed to production), but then the team collectively 'let you down' by pulling the rollback lever, instead of thinking and working harder on fixing the iss…

"toxic hellhole", "blame culture" - I don't think we need those dark, marginal extremes to make a point

I also suspect that we're going to agree to disagree here. There are so many nuances, it's impossible to properly communicate most of those without writing a chapter of a book.

Appreciate your points though. Great food for thought right there.

Re: Ask HN: How do you roll back production?

#54

You can do rolling deployment. Setup environment with previous version of production code (which does not have issue) and then using load balancer switch the traffic to this new environment

Once automated this feels like the simplest approach, and it lets you temporarily suspend the continuous integration between source repo and the application if that turns out to be useful in managing response to an issue.

Re: Ask HN: How do you roll back production?

#55
I have multiple strategies because I've got one foot in Docker and one foot in the "old-school" realm of simple web servers.

Code rollbacks are simple as heck - I just keep the previous Docker container(s) up for a potential rollback target, and/or have a symlink cutover strategy for the webservers. I use GitLab CI/CD for the majority of what I do so the SCM is not on the server, it's deployed as artifacts (either a clean tested container and/or .tar.gz). If I need to rollback it's a manual operation for the code but I want to keep it that way because I am a strong believer in not automating edge-cases which is what running rollbacks through your CI/CD pipeline is.

Also for code I've been known to even cut a hot image of the running server just in case something goes _really_ sideways. Never had to use it though, and I will only go this far if I'm making actual changes to the CI/CD pipeline (usually).

The biggest concern for me is database changes. You may think I'm nuts but I have been burnt _sooooo_ bad on this (we were all young and dumb at one time right?)... I have multiple points of "oh %$&%" solutions. The first is good migrations - yeah yeah yell at me if you wish... I run things like Laravel for my API's and their migration rollbacks can take care of simple things. TEST YOUR ROLLBACK MIGRATIONS! The second solution is that I cut an actual readslave for each and every update of the application and then segregate it so that I have a "snapshot" that is at-most 1-2 hours out of date.

Have redundancy to your redundancy is my motto... and although my deployments take a 1-3 hours for big changes (cutting hot images of a running server, building/isolating an independent DB slave, shuffling containers, etc.) I've never had a major "lights out" issue that's lasted more than 1hr.

Re: Ask HN: How do you roll back production?

#57
post #44

Earlier quoted context omitted.

How do you deal with DB migrations?

Migrations should be separated out from other code changes. If you have a rolling deploy process, then you need to make sure your database changes are forwards and backwards compatible. Assuming you've got a CI in place, making the migrations a separate, testable commit will let you do this easily. We did this at my last company with a small GitHub bot and a CODEOWNERS file.

Exactly this. If your db changes are compatible in both directions then you are safe. It's not hard to achieve. Just make sure new columns have default values and your orm can deal with extra undefined columns and don't drop anything during migrations.

Re: Ask HN: How do you roll back production?

#58
post #16

Earlier quoted context omitted.

What about logical errors? math.pow(2, 4) vs math.pow(4, 2)

A test can test for those: "does the code give mathematically correct results?"

Even the best tests only catch like 50% of the bugs though.
Post reply on HN