collective.hostout 插件,用于在部署期间启动和停止 supervisor
项目描述
安装
hostout.supervisor 是 collective.hostout 的插件。Hostout 是一个 zc.buildout 食谱。
首先,你需要一个使用 supervisor 的正常工作的 buildout。这里有一个非常简单的例子
>>> write('buildout.cfg', ... """ ... [buildout] ... parts = helloworld ... ... [helloworld] ... recipe = zc.recipe.egg:scripts ... eggs = zc.recipe.egg ... initialization = import sys ... main=lambda: sys.stdout.write('all your hosts are below to us') ... entry-points = helloworld=__main__:main ... ... [supervisor] ... recipe = collective.recipe.supervisor ... programs = 10 helloworld bin/helloworld ... ... """)
>>> print system('bin/buildout -N') Installing helloworld. Generated script '/sample-buildout/bin/helloworld'.
>>> print system('bin/helloworld') all your hosts are belong to us
在 Google 中搜索“buildout”和您喜欢的应用框架,以了解如何构建它。
接下来,我们将 hostout 添加到我们的 buildout 中,并通过使用 extends 选项添加 hostout.supervisor 插件来扩展 hostout。
>>> write('buildout.cfg', ... """ ... [buildout] ... parts = helloworld host ... ... [helloworld] ... recipe = zc.recipe.egg:scripts ... eggs = zc.recipe.egg ... initialization = import sys ... main=lambda: sys.stdout.write('all your hosts are below to us') ... entry-points = helloworld=__main__:main ... ... [supervisor] ... recipe = collective.recipe.supervisor ... programs = 10 helloworld bin/helloworld ... ... [host] ... recipe = collective.hostout ... host = 127.0.0.1:10022 ... extends = hostout.supervisor ... parts = hellowworld supervisor ... ... """)
>>> print system('bin/buildout -N') Updating helloworld. Installing host. Generated script '/sample-buildout/bin/hostout'. ...
hostout.supervisor 命令
>>> print system('bin/hostout host') cmdline is: bin/hostout host1 [host2...] [all] cmd1 [cmd2...] [arg1 arg2...] Valid commands are: ... supervisorboot : Installs supervisor into your init.d scripts in order to ensure that supervisor is started on boot ... supervisorctl : Takes command line arguments and runs supervisorctl on the remote host supervisorshutdown : Shutdown the supervisor daemon supervisorstartup : Start the supervisor daemon ...
可以使用以下选项
- supervisor
要停止和重新启动的 supervisor 部分的名称
- init.d
如果设置,supervisord 脚本将被链接到 init.d,这样任何机器重启也将启动 supervisor。
部署期间的自动启动和关闭
此外,supervisor 插件将在预部署期间关闭 supervisor,并在后部署期间启动 supervisor。
>>> print system('bin/hostout host1 deploy') Hostout: Running command 'predeploy' from 'hostout.supervisor.fabfile' Logging into the following hosts as : 127.0.0.1 [127.0.0.1] sudo: /var/lib/plone/host1/bin/supervisorctl shutdown || echo 'Failed to shutdown' ... Hostout: Running command 'postdeploy' from 'hostout.supervisor.fabfile' ... [127.0.0.1] sudo: /var/lib/plone/host1/bin/supervisord ... [127.0.0.1] sudo: /var/lib/plone/host1/bin/supervisorctl status ... Hostout: Running command 'postdeploy' from 'collective.hostout.fabfile' ...
致谢
Dylan Jay (software at pretaweb dot com)
发布历史
1.05 (2014-05-29)
整理说明文件 [Jean Jordaan]
修复 bootstrip 安装/卸载 [Adam Terrey]
1.0a4 (2010-04-13)
允许 buildout 用户仅进行部署
1.0a3 (2010-03-21)
当需要以 root 身份启动时,引入了新的 sudosupervisor [Dylan Jay]
使其与 collective.hostout 1.0a5 兼容 [Dylan Jay]
改进了启动和关闭功能,因此使用 buildout-user + reload 而不是“supervisor shutdown” [Dylan Jay]
1.0a2 (2010-06-03)
添加 falfile 入口点
更好的 init.d 脚本
1.0a1 (2010-02-13)
从collective.hostout移除
升级到fabric 1.0和python 2.6
项目详情
hostout.supervisor-1.0a5.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 6ef6bb09bc764f96a670757332f21fbf79cf843ba300c5b6d32cbd6edce03dd4 |
|
MD5 | 2fc457e7d7cf0aadcb88a0c8914c21f4 |
|
BLAKE2b-256 | 44db55951b0a97036099455acbc62a6e1b98d6c739e5f338db7a66c7ebce820d |