Supervisord: is there any way to touch - restart the child?

I am setting up a server to host a Django application that has:

  • uWSGI application launched by ubuntu uWSGI init script
  • celeryd launched supervisord

So, I am writing a spread script that will be:

  • Pull code from git
  • DB Transfer
  • Tell uWSGI to reboot, so it will pick up the new code.
  • Tell celeryd to reload, so he will also pick up the new code.

uWSGI has the following configuration function:

 touch-reload gracefully reload the uWSGI stack when a file/directory changes. 

So, my script is run by an unprivileged user, under which all application processes are launched.

To restart uWSGI , I can just touch ~/.restart_uwsgi .

Is there a way to do the same for celeryd running under supervisord without giving sudo access to an unprivileged user so that he can supervisorctl restart celeryd ?

+5
source share
1 answer

Since I still have not found a better way to do this, here is what I am doing right now:

 # 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 

So, I'm using sudo, not the best solution, but it works.

If someone has a better answer to this question, I will gladly change the accepted answer.

0
source

Source: https://habr.com/ru/post/958888/


All Articles