I'm using Amazon's Elastic Beanstalk and Django 1.8.2. Here is my container commands,
我使用的是亚马逊的弹性豆茎和Django 1.8.2。这是我的容器命令,
container_commands:
01_wsgipass:
command: 'echo "WSGIPassAuthorization On" >> ../wsgi.conf'
02_makemigrations:
command: "source /opt/python/run/venv/bin/activate && python manage.py makemigrations --merge --noinput"
leader_only: true
03_migrate:
command: "source /opt/python/run/venv/bin/activate && python manage.py migrate --noinput"
leader_only: true
For some reasons the migrate
command is being killed. All migrations are working fine even with a fresh database in my local. But following is the error appearing on eb-activity.log.
出于某些原因,迁移命令正在被杀死。所有迁移都可以正常工作,即使本地有一个新的数据库。但下面是出现在eb-activity.log上的错误。
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Installing custom SQL...
Running migrations:
Rendering model states.../bin/sh: line 1: 21228 Killed python manage.py migrate --noinput
(ElasticBeanstalk::ExternalInvocationError)
Note: The same container commands were working fine without any issues earlier at Elastic Beanstalk. I tried with --verbose 3
with migrate command but didn't get any other debug messages.
注意:相同的容器命令在弹性豆茎上运行良好,没有任何问题。我尝试了-verbose 3使用migrate命令,但是没有得到任何其他调试消息。
Any solutions? Thanks in advance.
有解决方案吗?提前谢谢。
1 个解决方案
#1
5
AWS is not developer friendly when it comes to troubleshooting with the poor logging mechanism.
当涉及到对糟糕的日志机制进行故障排除时,AWS对开发人员不友好。
As an avid AWS user who recently eval'd EBS for a Django project, I totally agree with this for the same reasons. I ended up going with Heroku for this and reasons I won't go into but I think the following pattern helps either way.
作为AWS的忠实用户,我最近为Django项目评估了EBS,出于同样的原因,我完全同意这一点。我最终和Heroku一起去了,我不会去,但是我觉得下面的模式可以帮助你。
The steps to prepare your prod environment can go in different places; they don't have to happen on your target web-server environment.
准备工作环境的步骤可以在不同的地方进行;它们不需要在您的目标web服务器环境中发生。
I ended up pulling my make/migrate tasks out of my deployment automation and into tasks that happen just before it. The only things that happen in my target web-server environment are directly related to the code on that server.
最后,我将自己的make/ migration任务从部署自动化中提取出来,放到刚好发生在部署自动化之前的任务中。在我的目标web服务器环境中发生的惟一事情是直接与该服务器上的代码相关。
In other words: I recommend if you have a CI tool for builds/tests, you pull your make/migrate and any other prep to the environment outside your webserver into your deployment pipeline. Something like:
换句话说:我建议,如果您有一个用于构建/测试的CI工具,那么您可以将您的make/ migration和任何其他准备工作放到部署管道中。喜欢的东西:
- Checkout code
- 检查代码
- Run Tests (including make/migrate on ephemeral database to test it if possible)
- 运行测试(包括在临时数据库中进行/迁移,以便在可能的情况下进行测试)
- Put app in maintenance mode (or similar, if required)
- 将app设置为维护模式(或类似,如果需要)
- Snapshot database
- 数据库快照
- Make/Migrate on production
- 制造/生产迁移
- Deploy
- 部署
- If deploy fails, rollback DB, rollback app.
- 如果部署失败,回滚DB,回滚应用程序。
Then you are separating the concerns of automation for your app server and automation for the rest of your prod environment and letting your CI handle that. You could handle them in the same place, but clearly its a bit clunky to do that using EBS's facilities.
然后,您将对应用服务器的自动化和其他prod环境的自动化进行分离,并让您的CI处理这些问题。您可以在相同的地方处理它们,但显然使用EBS的工具来处理它们有点笨拙。
#1
5
AWS is not developer friendly when it comes to troubleshooting with the poor logging mechanism.
当涉及到对糟糕的日志机制进行故障排除时,AWS对开发人员不友好。
As an avid AWS user who recently eval'd EBS for a Django project, I totally agree with this for the same reasons. I ended up going with Heroku for this and reasons I won't go into but I think the following pattern helps either way.
作为AWS的忠实用户,我最近为Django项目评估了EBS,出于同样的原因,我完全同意这一点。我最终和Heroku一起去了,我不会去,但是我觉得下面的模式可以帮助你。
The steps to prepare your prod environment can go in different places; they don't have to happen on your target web-server environment.
准备工作环境的步骤可以在不同的地方进行;它们不需要在您的目标web服务器环境中发生。
I ended up pulling my make/migrate tasks out of my deployment automation and into tasks that happen just before it. The only things that happen in my target web-server environment are directly related to the code on that server.
最后,我将自己的make/ migration任务从部署自动化中提取出来,放到刚好发生在部署自动化之前的任务中。在我的目标web服务器环境中发生的惟一事情是直接与该服务器上的代码相关。
In other words: I recommend if you have a CI tool for builds/tests, you pull your make/migrate and any other prep to the environment outside your webserver into your deployment pipeline. Something like:
换句话说:我建议,如果您有一个用于构建/测试的CI工具,那么您可以将您的make/ migration和任何其他准备工作放到部署管道中。喜欢的东西:
- Checkout code
- 检查代码
- Run Tests (including make/migrate on ephemeral database to test it if possible)
- 运行测试(包括在临时数据库中进行/迁移,以便在可能的情况下进行测试)
- Put app in maintenance mode (or similar, if required)
- 将app设置为维护模式(或类似,如果需要)
- Snapshot database
- 数据库快照
- Make/Migrate on production
- 制造/生产迁移
- Deploy
- 部署
- If deploy fails, rollback DB, rollback app.
- 如果部署失败,回滚DB,回滚应用程序。
Then you are separating the concerns of automation for your app server and automation for the rest of your prod environment and letting your CI handle that. You could handle them in the same place, but clearly its a bit clunky to do that using EBS's facilities.
然后,您将对应用服务器的自动化和其他prod环境的自动化进行分离,并让您的CI处理这些问题。您可以在相同的地方处理它们,但显然使用EBS的工具来处理它们有点笨拙。