Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differences between reread, reload, restart, update? #720

Closed
flaugher opened this issue Feb 13, 2016 · 34 comments
Closed

Differences between reread, reload, restart, update? #720

flaugher opened this issue Feb 13, 2016 · 34 comments
Labels

Comments

@flaugher
Copy link

Perhaps I missed it but is there a good explanation anywhere as to the differences between these four commands? I didn't see them discussed in the supervisord online documentation. I've noticed on ServerFault and Stackoverflow that other users don't understand their differences either.

For example, if I change the configuration in one program section, I know I must do "supervisorctl reread" to have those changes made available. But how do you restart just that one program? supervisorctl restart doesn't work. Instead if appears that you must either run "supervisorctl update" or restart the supervisor daemon itself. However, this seems to have the unintended effect of restarting all programs, not just the one that changed.

Thanks.

@mnaberez
Copy link
Member

Perhaps I missed it but is there a good explanation anywhere as to the differences between these four commands?

No, this should be added to the documentation. I've added the docs label and will leave this issue open so we do that.

@bfleming-ciena
Copy link

Still find the current docs confusing.

@pawelad
Copy link

pawelad commented Dec 13, 2016

What helped me - http://www.onurguzel.com/supervisord-restarting-and-reloading/

@bfleming-ciena
Copy link

bfleming-ciena commented Dec 13, 2016 via email

@pawelad
Copy link

pawelad commented Dec 14, 2016

@flaugher I still think it's worth keeping this issue open, as the docs still don't have the relevant information.

I was actually planning to look into making a PR on the weekend.

@flaugher
Copy link
Author

flaugher commented Dec 14, 2016 via email

@pawelad
Copy link

pawelad commented Dec 14, 2016

As a non project member or issue creator I can't open it, but I do get your point completely.

BTW - As far as I know you can unsubscribe from the notifications on the right side menu in issue view

Lastly - sorry for the spam : -)

@ivanleoncz
Copy link

Hi everyone.

IMHO, I agree with the re-opening of this issue.

Although the doc bellow can shed a light on the issue, it seems a little bit vague regarding the definitions.

Regarding the "update" action, I believe that there are more things to be described or better described, for example.

Here is the scenario: when you create a configuration for a process to be managed by "supervisord", you run "supervisorctl update" and then comes the message "your_configured_process: added process group". Is there any kind of group controlled by "supervisord", which must contain a record that specifies that your process is now managed by "supervidord"?

In my last searches on Google, I also found this man page at Ubuntu website, and it doesn't seem to have explanations for supervisorctl actions..

Can anyone (member of the project) reopen this issue? Seems like that I'm not the only one who believes that this must be done.

Thanks
@ivanleoncz

@631068264
Copy link

So where the answer ?

@nilstoedtmann
Copy link

+1 for re-opening. reread|reload|restart|update are still undocumented.

@zelf
Copy link

zelf commented Mar 27, 2017

Hi, Sorry to be this guy, but, could we re-open that issue? Thanks.

@chrisspen
Copy link

@pawelad How did that help you? The second sentence is flat out wrong.

However it does not have a reload option.

Supervisor most certainly has a reload option...

@BrunoDesthuilliers
Copy link

Yet someone else here that would really appreciate some usable documentation...

@cornfeedhobo
Copy link

Wow. I can not believe this issue exists. Thanks @ivanlmj for the informative links.

@ivanleoncz
Copy link

You're welcome, @cornfeedhobo . Thank you for regarding this issue :).

@ocervell
Copy link

Someone please explain the reload action: what I'm expecting from this one is basically a reread + update. Is that what the current behaviour is ?

@cornfeedhobo
Copy link

It most certainly is not, but you would think so! Man some updated docs would be great right about now ....

@ocervell
Copy link

@mnaberez can we have clear definition of every one of those terms ?
If you can detail them here, I'd be happy to make a pull request to the docs.

@ocervell
Copy link

ocervell commented Jan 21, 2018

Would the following definitions work for the documentation ?

reread - Reread supervisor configuration. Do not update or restart the running services.
update - Restart service(s) whose configuration has changed. Usually run after 'reread'.
reload - Reread supervisor configuration, reload supervisord and supervisorctl, restart services that were started.
restart - Restart service(s)

@ivanleoncz
Copy link

Pretty nice!
Have you certified that these are the real aspects of each action, @ocervell ? If you are sure about it, it would be nice to send a PR for the documentation! Just saying :)! Thanks!

@chaosreload
Copy link

I tried supervisorctl reread and update, and found that 'update' just does the reread's job: reload the application config. so what's the need for the 'reread' action? I found confused

@mindojo-victor
Copy link

$ supervisorctl help update
update			Reload config and add/remove as necessary, and will restart affected programs
update all		Reload config and add/remove as necessary, and will restart affected programs
update <gname> [...]	Update specific groups

So reread is not needed?

@Wouter0100
Copy link

I find it still a little confusing. Currently I run update and restart all on an update of our software. This could be:

  • A supervisor configuration file is changed
  • A script is changed and requires restarting.

But when a supervisor configuration is updated, the script is restarted twice (because update and restart all). I also tried reread and restart all, but in this case new config files didn't start automatically.

Is there a command or combination of commands that will reload all configuration files and restart all scripts without restarting them twice and loading and starting new configuration files found?

@oviliz
Copy link

oviliz commented Jan 23, 2019

Nobody on @Wouter0100 's question?

@MCapitani
Copy link

@Wouter0100 Considering you "restart all" what you want might be best accomplished by a "realod", although in a slightly different way:
Reload will stop the supervisor daemon, reload the configuration and then restart the daemon. Assuming your processes have autostart=true (the default) everything will be restarted exactly once.

If you need something less sweeping, I fear you are out of luck: reread will not start new processes found (as you have noticed) and update will restart only if the configuration changes, and it will not restart processes (e.g.) whose (supervisord) config stayed the same, but whose executable changed to a new version.

@AlekSi
Copy link

AlekSi commented Aug 5, 2019

I posted another solution at #1264.

@Wouter0100
Copy link

@AlekSi not really a solution, as this requires specifying every file individually.

@AlekSi
Copy link

AlekSi commented Aug 6, 2019

Well, that depends on your use case. In my case that Ansible task works:

    - name: Restart services
      command: supervisorctl {{ item.1 }} {{ item.0 }}
      with_nested:
        - ['x', 'y', 'z']
        - ['stop', 'remove', 'add']

@mnaberez
Copy link
Member

Questions posted on duplicate issue #1264:

It is somewhat a continuation of #720 that is closed but contains comments from a lot of confused people.

My problem

I need to restart service X exactly once after its package is updated. It contains service binary and a part of supervisord configuration that is include-ed from the main file.

My attempts

1. `supervisorctl update` does not restart service if configuration file did not change, old binary is still running.

2. `supervisorctl restart` restarts service with the old configuration, the new configuration is not used.

3. `supervisorctl reread && supervisorctl restart` does the same as the one above – and that is very surprising!

4. `supervisorctl update && supervisorctl restart` restarts service twice if configuration file changed.

My solution

supervisorctl reread

supervisorctl stop X
supervisorctl remove X
supervisorctl add X  # that also starts X as I have `autostart = true` in configuration

That works. But is it really the best way?
And why attempt 3 did not work?

@mnaberez
Copy link
Member

That works. But is it really the best way?

Yes

And why attempt 3 did not work?

The command reread causes supervisord to reread the configuration file and become aware of the changes, but it does not apply any of those changes to the active configuration. The remove and add commands are used to apply those changes to the active configuration.

@tgs
Copy link

tgs commented Aug 20, 2021

So is this an accurate diagram of the operations that are available?

supervisord config changes

Command Will it restart the supervised program?
reread no
reload yes (along with supervisord itself)
restart yes
update only if config changes have been made
reread; stop; remove; add; start yes ("start" isn't needed if "autostart" is enabled, the default)

@qwertfisch
Copy link

qwertfisch commented Sep 7, 2021

That summarizes most of it, but I don’t know if update includes an implicit reread (which means, supervisord will be aware of the changes), or if it’s a shortcut (as stated in your diagram) where the process will be restarted with the new configuration – if there are changes – but supervisord still doesn’t know about the changes.

In the latter case, this would be quite confusing because the process would run in a new configuration but supervisord does not know anything about it. In the former case, update would be the same as “reread; update”?

Also maybe it would be nice to have update extended with a --force option to save the whole dance of up to four(!) commands (stop; remove; add; start).

@tgs
Copy link

tgs commented Nov 22, 2021

Yup, from the documentation, update will "Reload config and add/remove as necessary, and will restart affected programs"

@melroy89
Copy link

Yup, from the documentation, update will "Reload config and add/remove as necessary, and will restart affected programs"

And here is the docs: http://supervisord.org/running.html#supervisorctl-actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests