简体   繁体   English

AWS Elastic Beanstalk 中的 Python:私有 package 依赖项

[英]Python in AWS Elastic Beanstalk: Private package dependencies

I would like to deploy a Python Flask application on beanstalk.我想在 beanstalk 上部署一个 Python Flask 应用程序。

The application depends on external packages (eg geopy ) and internal packages (eg adam_geography ).应用程序依赖于外部包(例如geopy )和内部包(例如adam_geography )。

The manual 手册

Create a requirements.txt file and place it in the top-level directory of your source bundle.创建一个 requirements.txt 文件并将其放在源包的顶级目录中。

This would probably fetch geopy and its dependencies, but would not fetch adam_geography which is available from a custom repo inside my VPC.这可能会获取geopy及其依赖项,但不会获取可从我的 VPC 中的自定义存储库获得的adam_geography

How do I specify/upload private, internal Python package dependencies in a Beanstalk application?如何在 Beanstalk 应用程序中指定/上传私有的内部 Python package 依赖项?

1) copy internal Python package to server 1) 将内部 Python package 复制到服务器

2) use Pip's "editable installs" feature to install the private package: 2) 使用 Pip 的“可编辑安装”功能安装私有 package:

pip install -e path/to/SomeProject

http://pip.readthedocs.org/en/latest/reference/pip_install.html#editable-installs http://pip.readthedocs.org/en/latest/reference/pip_install.html#editable-installs

Use ebextensions to specify custom commands you can use to download files on all your EC2 instances.使用 ebextensions 指定可用于在所有 EC2 实例上下载文件的自定义命令。 These ebextensions can be used to run pip like @shavenwarthog suggested in his answer.这些 ebextensions 可用于运行 pip 就像@shavenwarthog 在他的回答中建议的那样。 Create a directory called .ebextensions in your app source root directory.在您的应用程序源根目录中创建一个名为.ebextensions的目录。 Inside this directory create a file with a .config extension say 01-custom-files.config .在此目录中创建一个扩展名为.config的文件,例如01-custom-files.config This file can contain custom unix commands you want to run on each EC2 instance.此文件可以包含您要在每个 EC2 实例上运行的自定义 unix 命令。 You can run your own scripts here.您可以在此处运行自己的脚本。

You can also use container_commands which are executed after unzipping your app source on the EC2 instance.您还可以使用在 EC2 实例上解压缩应用程序源后执行的 container_commands。

Read more about commands and container_commands here.在此处阅读有关命令和 container_commands 的更多信息。 You can also find examples here:您还可以在此处找到示例:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-commands http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-commands

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-container_commands http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-container_commands

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Amazon AWS Elastic Beanstalk 部署私有 python pip 依赖项? - How to deploy private python pip dependency with Amazon AWS Elastic Beanstalk? 将Python和依赖项部署到Elastic Beanstalk - Deploying Python and Dependencies to Elastic Beanstalk 在AWS Elastic Beanstalk上部署Python - Deploying Python on AWS Elastic Beanstalk AWS Elastic Beanstalk 错误地使用 Python 2 和 Python 3? - AWS Elastic Beanstalk Using Python 2 and Python 3 in error? Python中的AWS Elastic Beanstalk环境变量 - AWS Elastic Beanstalk Environment Variables in Python 使用Python在AWS Elastic Beanstalk上创建DynamoDB时遇到问题 - Trouble creating DynamoDB on AWS Elastic Beanstalk with Python 在AWS Elastic Beanstalk上部署python Web服务器 - Deploy python web server on AWS Elastic Beanstalk 使用 python (django) 进行 AWS Elastic Beanstalk 日志记录 - AWS Elastic Beanstalk logging with python (django) AWS Elastic Beanstalk 无法使用 requirements.txt Git Pip 安装 Python 包 - AWS Elastic Beanstalk failed to install Python package using requirements.txt Git Pip AWS Elastic Beanstalk 无法使用 requirements.txt 安装 Python package - Firebase-Admin - AWS Elastic Beanstalk failed to install Python package using requirements.txt - Firebase-Admin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM