有没有办法自动重新加载主管进程? [英] Is there a way to automatically reload Supervisor processes?

查看:33
本文介绍了有没有办法自动重新加载主管进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个开发服务器,我经常通过 Git 推送代码更改.每次推送后,我需要手动登录服务器并重新启动主管进程.

I have a dev server which I often push code changes to over Git. After each push, I need to manually log into the server and restart the supervisor processes.

有没有办法让 Supervisor 监视文件系统目录的更改并在更改时重新加载进程?

Is there a way to have Supervisor monitor a filesystem directory for changes and reload the process(es) on changes?

推荐答案

您应该能够使用 事件监听器,它监视文件系统(可能带有 watchdog>) 并使用 XML-RPC API 发出重新启动.从 superlance<查看 memmon 侦听器/a> 灵感包.它不需要那么复杂.由于看门狗会调用您的重启例程,您无需使用 childutils.listener.wait 读取事件.

You should be able to use an Event Listener which monitors the filesystem (with perhaps watchdog) and emits a restart using the XML-RPC API. Check out the memmon listener from the superlance package for inspiration. It wouldn't need to be that complicated. And since the watchdog would call your restart routine you don't need to read the events using childutils.listener.wait.

或者,如果要访问的 supervisord API 的权限正确(套接字权限、HTTP 密码),git 钩子可能会起作用.一种更简单但安全性较低的方法.

Alternatively, git hooks might do the trick if the permissions are correct for the supervisord API to be accessed (socket permissions, HTTP passwords). A simpler but less-secure approach.

一种更简单甚至更不安全的方法是允许您发出supervisorctl restart.运行用户必须匹配您的推送用户(或 git 或 www,具体取决于您的设置方式).有很多方法可以让它在安全方面出错.但是对于开发来说,可能还不错.

A simpler and even less-secure approach would be to allow you to issue a supervisorctl restart. The running user has to match your push user (or git, or www, depending on how you have it setup). Lot's of ways to have it go wrong security-wise. But for development, might do fine.

相关:

这篇关于有没有办法自动重新加载主管进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆