I am trying to deploy a simple Flask app to Elastic beanstalk. I am able to deploy the sample version. However, I am currently struggling to deploy my own. My Python app is already named application.py and changed flask name in the code to "application" in the code. Inside my .ebextension files are the following:
我正在尝试将一个简单的Flask应用程序部署到Elastic豆茎上。我能够部署示例版本。然而,我目前正在努力部署自己的。我的Python应用程序已经命名为application.py,并将代码中的flask名称更改为代码中的“application”。在我的.eextension文件中有以下内容:
postgres.config:
postgres.config:
packages:
yum:
mariadb-devel: []
postgresql-devel: []
(edit: removed mariadb-devel. now says postgres is not available to install. More info below)
(编辑:已删除mariadb-devel。现在表示postgres无法安装。更多信息如下)
python.config:
python.config:
commands:
01_update_pip:
command: "pip install --upgrade pip setuptools"
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: application.py
I am using the AWS website for deployment. I am semi-new and still figuring it out. My directory looks like this:
我正在使用AWS网站进行部署。我是个半生不熟的人,还在想办法。我的目录如下所示:
- server (root)
- .ebextensions
- postgres.config
- python.config
- application.py
- requirements.txt
- venv
in the logs some noticeable things:
日志中有一些值得注意的内容:
[INFO] Error occurred during build: Yum does not have postgresql-devel available for installation
[ERROR] An error occurred during execution of command [app-deploy] - [PreBuildEbExtension]
[WARN]could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size
I've tried running another command that seems to at least deploy in Amazon Linux 2 but with a bad gateway error. Sadly, I do not remember it any more. Plus, I would prefer if possible to stick to the newest version. If it's easier attempting it in a different way then that's OK.
我尝试运行另一个命令,该命令似乎至少可以在AmazonLinux2中部署,但出现了一个严重的网关错误。遗憾的是,我已经不记得了。另外,如果可能的话,我更愿意坚持最新的版本。如果用不同的方式尝试更容易,那也没关系。
更多回答
优秀答案推荐
The documents for Elastic Beanstalk is not updated for AL2023 and still uses AL2, so don't just follow elastic beanstalk docs if you want to use AL2023.
Elastic Beanstalk的文档没有为AL2023更新,仍然使用AL2,所以如果你想使用AL2023,不要只遵循弹性豆茎文档。
I don't think they have postgresql-devel package for AL2023, based on this link for installed package list. Also, they changed package manager from yum to dnf, even though yum should still work, I would recommend changing yum to dnf in your file.
我不认为他们有AL2023的postgresql-devel包,基于这个已安装包列表的链接。此外,他们还将包管理器从yum更改为dnf,尽管yum应该仍然有效,但我建议在您的文件中将yum改为dnf。
If you can, it is best if you ssh into deployed elastic beanstalk instance and type "dnf search" for the exact name of package you search for. As in the link here.
如果可以的话,最好是ssh到已部署的弹性beanstall实例中,并键入“dnf-search”以获得搜索包的确切名称。如链接中所示。
更多回答
Thank you for letting me know. I got it running on AL2 for now
谢谢你告诉我。我现在在AL2上运行
我是一名优秀的程序员,十分优秀!