我正在设置一个服务器来托管一个Django应用程序,它具有:
uWSGI 应用程序由ubuntu的uWSGI init脚本启动celeryd 从...开始 supervisord所以我正在编写一个部署脚本,它将:
uWSGI重启,所以它将获取新代码.celeryd重启,所以它也会获取新代码.uWSGI 有这个配置功能:
touch-reload
gracefully reload the uWSGI stack when a file/directory changes.
Run Code Online (Sandbox Code Playgroud)
因此,我的脚本由非特权用户运行,在该用户下运行所有应用程序的进程.
重启uWSGI我可以简单touch ~/.restart_uwsgi.
有没有办法,我可以做同样的事情,celeryd在supervisord没有授予sudo访问权限的情况下运行,以便他可以supervisorctl restart celeryd?
由于我还没有找到更好的方法来做到这一点,这就是我现在正在做的:
# restart_my_proc.sh:
#!/bin/sh
supervisorctl restart <my_proccess_name>
chmod +x restart_my_proc.sh
# sudoers:
<site_user> ALL= NOPASSWD:/path/to/restart_my_proc.sh
# my_deploy_script.sh
sudo /path/to/restart_my_proc.sh
Run Code Online (Sandbox Code Playgroud)
所以我使用 sudo,这不是最好的解决方案,但它有效。
如果有人对此有更好的答案,我很乐意更改已接受的答案。
| 归档时间: |
|
| 查看次数: |
1787 次 |
| 最近记录: |