Run django migrations on container start on elmo webheads
Categories
(Webtools Graveyard :: Elmo, enhancement)
Tracking
(Not tracked)
People
(Reporter: Pike, Assigned: Pike)
Details
Attachments
(1 file)
Right now, we're not running any migrations on elmo in AWS.
Doing so is also a bit tricky, as we have different infrastructure on that database.
That's why we most often won't have "atomic" migrations between a10n and elmo.
Trick is to add data first, then code to use data, then remove code using old data, then old data.
Or real bad-ass downtimes (we might need that for some parts).
I've got a patch with a migration (data changes only), and I'm adding ./manage migrate to the docker startup. Seems that socorro does that, too, from what I've found.
Filing a bug to track that decision.
That rides along with a patch to remove old ContentTypes. Django doesn't delete those by default when removing models or apps, so there's a ton of them left over.
| Assignee | ||
Comment 1•7 years ago
|
||
Brian (or Miles), can you review the docker changes?
I got an f+ from Matjaz over IRC for the django migration itself.
Comment 2•7 years ago
|
||
"Right now, we're not running any migrations on elmo in AWS."
This isn't true. We run the migrations for django every time we launch a new web server.
https://github.com/mozilla-services/cloudops-deployment/blob/master/projects/elmo/puppet/modules/elmo/manifests/migrate.pp
https://github.com/mozilla-services/cloudops-deployment/blob/master/projects/elmo/puppet/yaml/type/elmo.webapp.yaml#L6
Running it every time a web server launched isn't ideal, and in the migration to kubernetes we'll be able to fix this and have the migrations only run once per webapp deployment.
Adding it to container startup is a step backward.
| Assignee | ||
Comment 3•7 years ago
|
||
Thanks, good that I asked.
Updated the PR.
Comment 4•7 years ago
|
||
| Assignee | ||
Comment 5•7 years ago
|
||
The patch I had here is now in prod.
The migrations didn't apply on deployment, though, but required some kicking on puppet? Miles, was that a fluke or a bug?
| Assignee | ||
Comment 6•7 years ago
|
||
Comment 7•7 years ago
|
||
A bug, and one that should now be fixed. The migrations were also not properly applied in stage.
I realized that the way we were configuring migrations to run had an error in logic, so they would never work correctly the first time. We have a fix PR here: https://github.com/mozilla-services/cloudops-deployment/pull/2896.
I think we can probably mark this fixed.
| Assignee | ||
Comment 8•7 years ago
|
||
'k. The migrations we had only really showed up on the admin interface, so I couldn't actually check on stage due the lack of log-in ;-).
Updated•5 years ago
|
Description
•