【问题标题】:How do I set up WSGI in Elastic Beanstalk when running AWS Deep Learning Base AMI (Amazon Linux 2)?运行 AWS Deep Learning Base AMI (Amazon Linux 2) 时,如何在 Elastic Beanstalk 中设置 WSGI?
【发布时间】:2020-10-31 15:57:17
【问题描述】:

在我的 elasticbeanstalk 中,我有:

Platform:
  PlatformArn: arn:aws:elasticbeanstalk:us-east-2::platform/Python 3.7 running on 64bit Amazon Linux 2/3.0.3
OptionSettings:
  aws:autoscaling:launchconfiguration:
    RootVolumeSize: "90"
    IamInstanceProfile: aws-elasticbeanstalk-ec2-role
    ImageId: ami-017ff046baf80c98c
  ...

该 ami 是 https://aws.amazon.com/marketplace/pp/B07NMRZ463(AWS 深度学习基础 AMI (Amazon Linux 2))。

我有一个带有 application.py 的烧瓶应用程序:

....
# run the app.
if __name__ == "__main__":
    # Setting debug to True enables debug output. This line should be
    # removed before deploying a production app.
    # application.debug = True
    print('Starting application')
    application.run(host='0.0.0.0')

当我加载它时,我的.platform/hooks/prebuild 运行(我在/var/log/eb-hooks.log 中看到日志)。但是我的应用服务器似乎没有启动。

如果重要的话,我的代码在 /var/app/staging 中,并且没有移到 /var/app/current

我做错了什么?

【问题讨论】:

  • 您在日志中发现任何错误吗?
  • 不。但我认为深度学习 AMI 不是为 WSGI 设置的
  • 我认为你是对的。
  • 如何运行 WSGI?并确保我的应用程序被移动到当前?
  • 暂时不知道。但是在常规 EB AMI 上安装 ML 库不是更容易吗?我不确定深度学习 AMI 有什么,所以可能无法完成?

标签: python linux amazon-web-services flask amazon-elastic-beanstalk


【解决方案1】:

我做了更多的挖掘工作,我认为一种方法是创建您自己的自定义平台表单 EB:

您可以通过向 Elastic Beanstalk 提供 Packer 模板以及模板调用以构建 AMI 的脚本和文件来创建平台。

但是:

Elastic Beanstalk 不支持基于 Amazon Linux 2 AMI 的自定义平台。

并不完美,但也许可以进一步探索此选项以将深度学习 AMI 与 EB 结合使用。

【讨论】:

  • 如果是这种情况,那么我可以使用 Amazon Linux 2 并简单地运行预构建来安装我认为的 CUDA 驱动程序。我想这会有些困难。或者,我可以使用 Ubuntu 实例并在其上设置 CUDA。但是我将如何设置 WSGI?
  • @Shamoon 也许是在当前的 EB 实例上安装 CUDA?
猜你喜欢
  • 2021-01-12
  • 2020-10-18
  • 2020-07-23
  • 2021-01-22
  • 2020-09-25
  • 2015-07-12
  • 2018-01-03
  • 2020-01-18
  • 2021-03-21
相关资源
最近更新 更多