Running migrations when deploying django app to heroku with codeship
Asked Answered
H

1

1

I'm trying to set up a continous integration pipeline for my python 3.5.1 / django 1.9.7 project.

The project is running fine on heroku, and the codeship deployment pipeline for heroku works well as long as my database is unchanged.

If I want to run migrations, I have to do so manually by entering heroku run python manage.py migrate on my computer which I would like to avoid.

I added a "Custom Script" in my codeship deployment pipeline after the "heroku"-pipeline containing heroku run python manage.py migrate, but when coedship attempts to execute it, it fails with the

Cannot run more than 1 Free size dynos.

message. I assume this is because the server is already up and running and I don't have more worker processes available? (please correct me if I'm wrong) EDIT: This is where I was wrong - I had an additional process running (see answer)

Is there any way to include the database migration step in the heroku deployment pipeline? Or did I do something wrong?

Horsemint answered 7/6, 2016 at 15:9 Comment(0)
H
4

Ifound the answer here: Heroku: Cannot run more than 1 Free size dynos

My assumption about theweb server beeing the blocking dyno was wrong, I had a zombie process (createsuperuser) running I did not know about.

I used heroku ps to show all running prcesses. Output was:

=== web (Free): gunicorn my_app.wsgi --log-file - (1)
web.1: idle 2016/06/07 17:09:06 +0200 (~ 13h ago)

=== run: one-off processes (1)
run.7012 (Free): up 2016/06/07 15:19:13 +0200 (~ 15h ago): python manage.py createsuperuser

I killed the process by typing

heroku ps:stop run.7012

and afterwards my migration via codeship custom script worked as expected.

Horsemint answered 8/6, 2016 at 4:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.