Elastic Beanstalk 平台挂钩不再 运行
Elastic Beanstalk platform hook no longer running
我通过 elastic beanstalk 托管一个站点,我在 .platform/hooks/postdeploy
中有一个 01_migrate.sh 文件,以便将模型更改迁移到 Amazon RDS 上的 postgres 数据库:
#!/bin/sh
source /var/app/venv/staging-LQM1lest/bin/activate
python /var/app/current/manage.py migrate --noinput
python /var/app/current/manage.py createsu
python /var/app/current/manage.py collectstatic --noinput
这曾经很好用,但现在当我检查 hooks 日志时,虽然它似乎找到了文件,但没有输出表明迁移命令已经 运行
即以前即使没有新的迁移我也会得到以下信息:
2022/03/29 05:12:56.530728 [INFO] Running command .platform/hooks/postdeploy/01_migrate.sh
2022/03/29 05:13:11.872676 [INFO] Operations to perform:
Apply all migrations: account, admin, auth, blog, contenttypes, home, se_balance, sessions, sites, socialaccount, taggit, users, wagtailadmin, wagtailcore, wagtaildocs, wagtailembeds, wagtailforms, wagtailimages, wagtailredirects, wagtailsearch, wagtailusers
Running migrations:
No migrations to apply.
Found another file with the destination path 'favicon.ico'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
而现在我只得到
2022/05/23 08:47:49.602719 [INFO] Running command .platform/hooks/postdeploy/01_migrate.sh
Found another file with the destination path 'favicon.ico'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
我不知道进行此更改时发生了什么。潜在的相关性是 eb deploy 不再能够找到 01_migrate.sh 文件,所以我不得不将文件夹及其内容 .platform/hooks/postdeploy/01_migrate.sh 向上移动到父目录,然后它能够找到又来了。
根据 documentation 平台挂钩:
All files must have execute permission. Use chmod +x to set execute permission on your hook files. For all Amazon Linux 2 based platforms versions that were released on or after April 29, 2022, Elastic Beanstalk automatically grants execute permissions to all of the platform hook scripts. In this case you don't have to manually grant execute permissions.
在本地移动文件后,脚本的权限可能已更改。
再次尝试在您的脚本上设置可执行权限 - chmod +x 01_migrate.sh
- 并重新部署您的应用程序。
我通过 elastic beanstalk 托管一个站点,我在 .platform/hooks/postdeploy
中有一个 01_migrate.sh 文件,以便将模型更改迁移到 Amazon RDS 上的 postgres 数据库:
#!/bin/sh
source /var/app/venv/staging-LQM1lest/bin/activate
python /var/app/current/manage.py migrate --noinput
python /var/app/current/manage.py createsu
python /var/app/current/manage.py collectstatic --noinput
这曾经很好用,但现在当我检查 hooks 日志时,虽然它似乎找到了文件,但没有输出表明迁移命令已经 运行
即以前即使没有新的迁移我也会得到以下信息:
2022/03/29 05:12:56.530728 [INFO] Running command .platform/hooks/postdeploy/01_migrate.sh
2022/03/29 05:13:11.872676 [INFO] Operations to perform:
Apply all migrations: account, admin, auth, blog, contenttypes, home, se_balance, sessions, sites, socialaccount, taggit, users, wagtailadmin, wagtailcore, wagtaildocs, wagtailembeds, wagtailforms, wagtailimages, wagtailredirects, wagtailsearch, wagtailusers
Running migrations:
No migrations to apply.
Found another file with the destination path 'favicon.ico'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
而现在我只得到
2022/05/23 08:47:49.602719 [INFO] Running command .platform/hooks/postdeploy/01_migrate.sh
Found another file with the destination path 'favicon.ico'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
我不知道进行此更改时发生了什么。潜在的相关性是 eb deploy 不再能够找到 01_migrate.sh 文件,所以我不得不将文件夹及其内容 .platform/hooks/postdeploy/01_migrate.sh 向上移动到父目录,然后它能够找到又来了。
根据 documentation 平台挂钩:
All files must have execute permission. Use chmod +x to set execute permission on your hook files. For all Amazon Linux 2 based platforms versions that were released on or after April 29, 2022, Elastic Beanstalk automatically grants execute permissions to all of the platform hook scripts. In this case you don't have to manually grant execute permissions.
在本地移动文件后,脚本的权限可能已更改。
再次尝试在您的脚本上设置可执行权限 - chmod +x 01_migrate.sh
- 并重新部署您的应用程序。