Closed Bug 1520769 Opened 7 years ago Closed 7 years ago

Run django migrations on container start on elmo webheads

Categories

(Webtools Graveyard :: Elmo, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

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.

Brian (or Miles), can you review the docker changes?

I got an f+ from Matjaz over IRC for the django migration itself.

Attachment #9037196 - Flags: review?(bpitts)

"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.

Thanks, good that I asked.

Updated the PR.

Commit pushed to develop at https://github.com/mozilla/elmo https://github.com/mozilla/elmo/commit/819b32af58412a15e0b452fe7ca633e1dcf9e79b bug 1520769, clean up ContentType and permissions in db through migration. We've taken a couple of migrations that removed apps and models that didn't remove the content types or the permissions for them. Remove them now. The migration depends on that latest migration of all elmo apps with data, so it's OK to access them virtually in the migration via get_model.

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?

Flags: needinfo?(miles)
Comment on attachment 9037196 [details] [review] PR for data migration and docker changes Got an r- on the docker parts.
Attachment #9037196 - Flags: review?(bpitts) → review-

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.

Flags: needinfo?(miles)

'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 ;-).

Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: