【发布时间】:2013-07-17 21:50:22
【问题描述】:
我有一个使用 supervisord 运行的 Tornado Web 应用程序。我从 ssh 手动启动、停止和重新启动 Supervisord 服务,它工作正常。我正在使用本地机器上的结构来执行以下操作:
- 运行单元测试
- 提交/推送到我的 git 服务器
- 从开发服务器拉取更改
- 重启 Supervisord 服务以更新应用程序
运行 fabfile 时我没有收到任何错误,但运行后我的服务器已关闭。以下是我的fabfile代码:
from fabric.api import *
from fabric.context_managers import settings
def prepare_deploy():
local('py.test')
local('git add .')
x = raw_input('what would you like your commit message to be? ')
local('git diff --quiet --exit-code --cached || git commit -m "' + x + '"')
local('git push origin master')
def dev():
prepare_deploy()
x = raw_input('Please enter the location of your keyFile for the dev server ')
if x == '':
key = 'key_file'
else:
key = x
with settings(
host_string='dev_server_name',
user='user_name',
Key_filename=key,
use_ssh_config = True):
code_dir='~/path/to/code/'
with cd(code_dir):
run("git pull origin master")
run("sudo python setup.py install")
run("sudo service supervisord restart")
完成此操作后,我的 Web 应用程序已关闭。关于为什么会发生这种情况的任何想法?
【问题讨论】:
-
主管日志中有什么内容?
-
为什么要重启 supervisord 而不仅仅是 web 应用程序?
-
@ThomasFenzl 我不熟悉 Supervisord 的工作方式。如果 Supervisord 是启动应用程序的人,我将如何重新启动应用程序?
-
@twil 我是一名主管菜鸟,我的日志当然是空的。
-
使用命令行工具supervisorctl重启服务:
sudo supervisorctl restart <service name>
标签: python fabric supervisord