Question

I'm setting up a server to host a Django app which has:

  1. uWSGI app started by ubuntu's uWSGI init script
  2. celeryd started by supervisord

So I'm writing a deploy script which will:

  1. Pull code from git
  2. Migrate the DB
  3. Tell uWSGI to restart, so it will pick up the new code.
  4. Tell celeryd to restart, so it will pick up the new code as well.

uWSGI has this configuration feature:

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

So my script is run by the unprivileged user under which all the app's processes are run.

To restart uWSGI I can simply touch ~/.restart_uwsgi.

Is there any way I can do the same thing for celeryd running under supervisord without granting sudo access to the unprivileged user so he can supervisorctl restart celeryd?

Was it helpful?

Solution

Since I still haven't found a better way to do this, here's what I'm 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, I'll gladly change the accepted answer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top