Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Heroku deploys #654

Merged
merged 6 commits into from
Jun 5, 2017
Merged

Fix Heroku deploys #654

merged 6 commits into from
Jun 5, 2017

Conversation

cmfcmf
Copy link
Member

@cmfcmf cmfcmf commented May 28, 2017

Probably due to a Postgres update, the database now is more restrictive when it comes to changing a column's type. The Heroku deployment failed for this reason. I have already confirmed this fix to be working by manually applying it to the currently deployed version. You'll see it running over here: http://workshopportal.herokuapp.com/

Things left to do:

  • Verify this doesn't break SQLite migrations. (i.e. destroy your SQLite database and see if rake db:migrate works afterwards)

@cmfcmf cmfcmf added this to the Alpha Test milestone May 28, 2017
@cmfcmf cmfcmf requested a review from bjrne May 28, 2017 15:59
@bjrne
Copy link
Collaborator

bjrne commented May 28, 2017

Brilliant catch! 💾
rake migrate doesn't work at the moment due to the error 2 is out of range for ActiveRecord::Type::Integer with limit 0. I can fix this later.
I opened an issue for the remaining tasks, #655.

@bjrne bjrne requested a deployment to workshopportal-pr-654 May 28, 2017 16:57 Pending
@bjrne bjrne temporarily deployed to workshopportal-pr-654 May 28, 2017 16:57 Inactive
@bjrne bjrne temporarily deployed to workshopportal-pr-654 May 28, 2017 16:59 Inactive
@bjrne bjrne temporarily deployed to workshopportal-pr-654 May 28, 2017 17:19 Inactive
@bjrne
Copy link
Collaborator

bjrne commented May 28, 2017

Should we really run migrations on deployment? Shouldn't we rather use db:setup in the release version? If we want to see whether it succeeds I'd rather write a test (if possible) that tries migrating with postgres.

app.json Outdated
@@ -1,6 +1,7 @@
{
"name": "workshop-portal",
"scripts": {
"postdeploy": "bundle exec rake db:schema:load db:seed"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on when this setting applies we might want to add db:populate_sample_data

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right!
I'll add more info soon.

@cmfcmf cmfcmf changed the title Fix Heroku deploys [WIP] Fix Heroku deploys May 29, 2017
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 538f7f1 on fix-heroku into 288494c on dev.

@bjrne bjrne temporarily deployed to workshopportal-pr-654 June 1, 2017 07:38 Inactive
@@ -1,6 +1,7 @@
{
"name": "workshop-portal",
"scripts": {
"postdeploy": "bundle exec rake db:schema:load db:seed db:populate_sample_data"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is called once on a review app whenever a new merge request - and a review app - is created.

@@ -1 +1,2 @@
release: bundle exec rake db:migrate
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is called "all the time" on review apps as well as on the dev deployment. As per the docs, this is called after:

  • An app build
  • A config var set by a user
  • A pipeline promotion
  • A rollback
  • A release via the platform API

I figured it would make sense to run migrations so the dev is always up to date.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only time it doesn't make sense to me is a rollback. Wouldn't you need to call rake db:rollback accordingly then? Given that a migration was added in that code, you'd want to change that back as well, wouldn't you? Or does rollback refer to a step back in the pipeline (like from dev to staging)? And if that is the case, in this example is this then called on the dev or the staging pipeline step?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think rollback means that you deploy an old commit over the current commit. I agree migrating is the wrong approach then. However, I see no other way to solve this currently. I think we should ignore this edge case.

@cmfcmf cmfcmf changed the title [WIP] Fix Heroku deploys Fix Heroku deploys Jun 1, 2017
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 79ec56d on fix-heroku into 87ef775 on dev.

Copy link
Collaborator

@bjrne bjrne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So finally: Works and should be merged asap ☝️

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 9e65724 on fix-heroku into 2f5695c on dev.

@cmfcmf cmfcmf merged commit dfad08b into dev Jun 5, 2017
@annkatrinkuessner annkatrinkuessner deleted the fix-heroku branch August 2, 2017 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants