跳转到主要内容

Python虚拟环境流程管理器

项目描述

Build Status PyPI version

The Procfile & Deployfile process manager for Python Virtual Environments.

Bureaucrat提供基于Deployfile的部署任务管理的支持。Deployfile基本上是另一个名字的Procfile。它用于定义项目的部署命令并启动运行它所需的过程。

Deployfile命令必须是幂等的。

如果您使用Docker,您可能会发现这有助于自动化容器的构建。

安装

使用以下命令从PyPI安装

pip install bureaucrat

或从源代码安装

pip install git+https://github.com/adlibre/python-bureaucrat.git#egg=bureaucrat

配置

要使用Bureaucrat,您需要在虚拟环境根目录下创建Procfile、Deployfile和.env文件。

示例Procfile

以下将启动一个单独的gunicorn网络进程。

web: gunicorn project.wsgi:application --workers $WORKERS --log-file $LOGFILE --bind 0.0.0.0:$PORT --timeout 300

示例Deployfile

以下适用于部署Django应用程序。

pip: pip install -r requirements.txt
migrate: manage.py migrate --noinput
collectstatic: manage.py collectstatic --noinput

示例.env

WORKERS=4
LOGFILE=/var/log/django-project.log
PORT=8000

用法

基本选项是startstoprestartdeployinit

usage: Bureaucrat [-h] {start,stop,restart,deploy,init} ...

Bureaucrat - the Procfile & Deployfile manager for Python Virtual Environments

positional arguments:
  {start,stop,restart,deploy,init}
    start               Starts Procfile processes
    stop                Stops Procfile processes
    restart             Restarts Procfile processes
    deploy              Run tasks in Deployfile
    init                Run Deployfile tasks and then start Procfile processes
                        in foreground

optional arguments:
  -h, --help            show this help message and exit

启动/停止/重启参数

指定自定义位置以指定Procfile.env和日志文件的额外参数。

usage: Bureaucrat start [-h] [--venv VENV] [--app APP] [--procfile PROCFILE]
                        [--envfile ENVFILE] [--logpath LOGPATH]
                        [--pidpath PIDPATH]
                        [process [process ...]]

positional arguments:
  process              Procfile Process Name

optional arguments:
  -h, --help           show this help message and exit
  --venv VENV          Virtualenv root
  --app APP            Application root
  --procfile PROCFILE  Procfile path
  --envfile ENVFILE    .env file path
  --logpath LOGPATH    log file path
  --pidpath PIDPATH    pid file path

示例

$ bureaucrat start
Spawning web: gunicorn project.wsgi:application --log-file log/gunicorn.$LOGFILE --bind unix:run/gunicorn.sock

部署参数

usage: Bureaucrat deploy [-h] [--venv VENV] [--app APP]
                         [--deployfile DEPLOYFILE] [--envfile ENVFILE]
                         [--logpath LOGPATH]

optional arguments:
  -h, --help            show this help message and exit
  --venv VENV           Virtualenv root
  --app APP             Application root
  --deployfile DEPLOYFILE
                        Deployfile path
  --envfile ENVFILE     .env file path
  --logpath LOGPATH     log file path

示例

$ bureaucrat deploy
Running task syncdb: manage.py syncdb --noinput
Running task migrate: manage.py migrate --noinput
Running task collectstatic: manage.py collectstatic --noinput

状态

该版本由Panubo用于支持Python环境。

项目详情


下载文件

下载适合您平台的文件。如果您不确定该选择哪个,请了解有关安装包的更多信息。

源分布

bureaucrat-0.3.6.tar.gz (8.1 kB 查看哈希值)

上传时间

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面