|
|
|
|
|
by heavenlyhash
3585 days ago
|
|
The biggest issue I have with this model -- and git-flow as an opinion about how deploy works in general -- is that it doesn't take any account of rollbacks, and it doesn't scale well to arbitrary numbers of deployments. The history of my production deploys is not monotonically forward: if something breaks, it rolls back. Nor does production roll forward as one piece: different components of the stack roll in separate motions (the db schema vs the frontend servers for example). Git, tied to the project dev history, does not well represent these things. Reverts in the deploy branch are not semantically identical to rollbacks in production: and it's not necessarily safe or wise to merge them back into dev history. A separate git repo, referencing release numbers, or dev repo commit hashes, would work pretty well on the other hand... |
|
That said, sincerely I find rollback one of those inherently complex ideas:
- Rolling back assumes going back to the previous commit will fix everything, an unproven (unprovable?) hypothesis in the face of database migrations, job queues, etc.
- Making database migrations reversible can be nearly impossible (particularly at scale), aside from a significant engineering effort (for something that should absolutely never happen)
So I just don't contemplate the possibility of rolling back a deploy.
Instead I try things (particularly migrations) on staging rigurously:
- staging environments always ephemeral - created from scratch for a given relase
- always load fresh production DB into staging
- check that all my model objects are still `.valid?` (http://api.rubyonrails.org/classes/ActiveRecord/Validations....) after the migration
- leave staging running a few days.
- if you really can (not easy), forward production traffic to staging as well.
If things go wrong (which under my proposed discipline would be a massive screw-up), then the fix would require analysis, a regular fix (no time travelling), and a regular deploy.
Reacting instantly (i.e. without analysis) is kind of delusional thinking. I'd rather stay broken a little longer for avoiding further complications!