试图运行一条管道,我的设置:
带有自动标度和负载均衡器的
在运行管道之后,它无法部署所有具有相同版本的实例。因此,从我的日志中,我发现它在运行container_commands时失败了。
option_settings:
"aws:elasticbeanstalk:application:environment":
DJANGO_SETTINGS_MODULE: project.settings
"PYTHONPATH": "/opt/python/current/:$PYTHONPATH"
"aws:elasticbeanstalk:container:python":
WSGIPath: project.wsgi:application
NumProcesses: 3
NumThreads: 20
"aws:elasticbeanstalk:environment:proxy:staticfiles":
/html: statichtml
/static-files: static-files
/media: media-files
**container_commands:
10_deploy_hook_permissions:
command: |
sudo find .platform/ -type f -iname "*.sh" -exec chmod -R 755 {} \;
sudo find /var/app/staging/.platform/ -type f -iname "*.sh" -exec chmod -R 755 {} \;**它执行如下:
#!/bin/sh
source /var/app/venv/staging-LQM1lest/bin/activate
python /var/app/current/manage.py collectstatic --noinput
python /var/app/current/manage.py migrate注意:当我运行"eb deploy“时,应用程序部署非常好,但是当从管道触发部署时,它会进入”降级“状态,其中实例仍在运行,但显然并不是所有实例都运行相同版本。
健康方面的错误:
over all : - Command failed on all instances.
- Incorrect application version found on all instances. Expected version
"app-221124_115515680871" (deployment 418).
instance : - Application deployment failed at 2022-11-24T11:32:55Z with exit status 1
and error: Engine execution has encountered an error.
- Incorrect application version "code-pipeline-575-
3e3311a14d472807da9bcf9f73d5778e38c9c651" (deployment 420). Expected
version "app-221124_1680871" (deployment 418).
from commands-logs
2022-11-24 15:36:24,190 P17748 [INFO] Command 10_deploy_hook_permissions
2022-11-24 15:36:24,239 P17748 [INFO] -----------------------Command Output-----------------------
2022-11-24 15:36:24,239 P17748 [INFO] find: ‘.platform/’: No such file or directory
2022-11-24 15:36:24,239 P17748 [INFO] find: ‘/var/app/staging/.platform/’: No such file or directory
2022-11-24 15:36:24,239 P17748 [INFO] ------------------------------------------------------------
2022-11-24 15:36:24,239 P17748 [ERROR] Exited with error code 1也尝试使用不同的配置:
container_commands:
01_makemigrations:
command: "source /var/app/venv/*/bin/activate && python3 manage.py makemigrations --noinput"
02_migrate:
command: "source /var/app/venv/*/bin/activate && python3 manage.py migrate --noinput"
03_collectstatic:
command: "source /var/app/venv/*/bin/activate && python3 manage.py collectstatic --noinput"
But this time I get this wrror :
2022-11-25 08:56:46,187 P2294 [INFO] Command 01_makemigrations
2022-11-25 08:56:46,222 P2294 [INFO] -----------------------Command Output-----------------------
2022-11-25 08:56:46,222 P2294 [INFO] python3: can't open file 'manage.py': [Errno 2] No such file or directory
2022-11-25 08:56:46,222 P2294 [INFO] ------------------------------------------------------------
2022-11-25 08:56:46,222 P2294 [ERROR] Exited with error code 2我还在我的弹性豆柄环境中设置了全局变量。属性
不知道该怎么办了。很明显,它无法找到文件或运行命令。
发布于 2022-11-30 09:13:00
因此,当我输入后端文件夹时,这些命令就会运行。
container_commands:
10_deploy_hook_permissions:
command: |
sudo find .platform/ -type f -iname "*.sh" -exec chmod -R 755 {} \;
sudo find /var/app/staging/backend/.platform/ -type f -iname "*.sh" -exec chmod -R 755 {} \;然而,一切看起来都很好,管道和命令明智,但服务器没有运行,我没有收到任何错误消息。
https://stackoverflow.com/questions/74560714
复制相似问题