使用codeship将django app部署到heroku时运行迁移(Running migrations when deploying django app to heroku with codeship)

我正在尝试为我的python 3.5.1 / django 1.9.7项目建立一个连续的集成管道。

该项目在heroku上运行正常,只要我的数据库没有改变,heroku的代码行部署管道就可以正常运行。

如果我想运行迁移,我必须通过在我的计算机上输入heroku run python manage.py migrate来手动执行此操作,我希望避免这种情况。

在包含heroku run python manage.py migrate的“heroku”-pipeline之后,我在我的代码部署管道中添加了一个“自定义脚本”,但是当coedship尝试执行它时,它失败了

Cannot run more than 1 Free size dynos.

信息。 我认为这是因为服务器已经启动并运行,我没有更多的工作进程可用? (如果我错了,请纠正我) 编辑:这是我错的地方 - 我有一个额外的过程运行(见答案)

有没有办法在heroku部署管道中包含数据库迁移步骤? 或者我做错了什么?

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?

最满意答案

如果答案在这里: Heroku:不能运行超过1个自由尺寸的dynos

我对网络服务器的阻塞dyno的假设是错误的,我有一个僵尸进程(createsuperuser)运行,我不知道。

我使用heroku ps来显示所有正在运行的prcesses。 产量是:

=== 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

我打字就杀了这个过程

heroku ps:stop run.7012

然后我通过代码行自定义脚本的迁移按预期工作。

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.

使用codeship将django app部署到heroku时运行迁移(Running migrations when deploying django app to heroku with codeship)

我正在尝试为我的python 3.5.1 / django 1.9.7项目建立一个连续的集成管道。

该项目在heroku上运行正常,只要我的数据库没有改变,heroku的代码行部署管道就可以正常运行。

如果我想运行迁移,我必须通过在我的计算机上输入heroku run python manage.py migrate来手动执行此操作,我希望避免这种情况。

在包含heroku run python manage.py migrate的“heroku”-pipeline之后,我在我的代码部署管道中添加了一个“自定义脚本”,但是当coedship尝试执行它时,它失败了

Cannot run more than 1 Free size dynos.

信息。 我认为这是因为服务器已经启动并运行,我没有更多的工作进程可用? (如果我错了,请纠正我) 编辑:这是我错的地方 - 我有一个额外的过程运行(见答案)

有没有办法在heroku部署管道中包含数据库迁移步骤? 或者我做错了什么?

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?

最满意答案

如果答案在这里: Heroku:不能运行超过1个自由尺寸的dynos

我对网络服务器的阻塞dyno的假设是错误的,我有一个僵尸进程(createsuperuser)运行,我不知道。

我使用heroku ps来显示所有正在运行的prcesses。 产量是:

=== 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

我打字就杀了这个过程

heroku ps:stop run.7012

然后我通过代码行自定义脚本的迁移按预期工作。

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.