Open jvanasco opened 9 years ago
Yes, please!!!
:+1:
:+1:
:+1:
When I first posted this, I was told by one of the package maintainers (in a private email, or comment since deleted?):
This will be pretty difficult to implement and will be confused with the existing machinery (add and remove commands). I would rather see this done in a plugin.
With my knowledge of Supervisor, I thought I could patch this into the core distro β but I have no idea how to do this as a plugin. I tried, and it didn't seem doable with the available hooks.
I know the possibility to disable services from Solaris' SMF. It feels pretty wird that supervisor does not have something similar. Removing to disable a service feels like removing a symlink to the good old init.d-files.
The crusty workaround I've been using is managing servers with two directories:
The actual config files are in services-all, they are symlinked into services-enabled which is what supervisord reads. This is the same approach to how some os distros package apache and nginx.
The shortcoming is that you have to disable the process in supervisor AND on the disk; then enable the process in both places as well -- otherwise the service will start up on a reboot. It's really confusing, but it works.
@jvanasco not a direct fix, but you should give Ansible a try. Works very well once you invest a little bit of time to write proper playbooks.
+1
+200
Anything new on this front?
+1 as well!
This can be easily implemented with the help of symlinks, in the same way http servers are doing like apache and nginx.
Please just create such folder structure to support the feature. Please see for more details about site-available and site-enable https://help.ubuntu.com/lts/serverguide/httpd.html
@varunpalekar no, this can't be easily implemented with symlinks like apache/nginx (which I also covered above as a bad interim solution, and many people already do)
Apache and Nginx are entirely controlled by the presence of files in the include directories. If a file is in "/sites-enabled", then it is enabled on application setup. There is no in-process system to change that -- in order to start/stop a configured host, one would edit or symlink a file and then restart the service.
Supervisorctl is a process supervisor. Placing a configuration file in "/sites-enabled" or "/sites-available" makes the service available for Supervisor -- but Supervisor also has in-process controls that handle that service being started or stopped... and a configuration may or may not "autostart" a service. Supervisor itself wouldn't be able to use symlinks, because the process configurations could be inline within a single file -- meaning a feature like that would not work on many configurations in-the-wild.
Supervisorctl simply needs to persist into a small datafile (pickle, json, whatever) the name of "stopped" items, so they are not auto-started if the system reboots.
I think the best place to do this might be in a secondary config file called supervisor.status
or similar, which would be created/read from the same directory as the active configuration file.
@jvanasco I just suggest a simple tweak through which you can gain what you need.
You can achieve your goal by just following point:
For enable service script,
ln -s /etc/supervisor/conf-available.d/program1.conf /etc/supervisor/conf.d/program1.conf
supervisorctl update
For disable service script.
rm /etc/supervisor/conf.d/program1.conf
supervisorctl update
You can also make above script parameterized and move to any PATH
folder so that you can access from anywhere
Above process is just a tweak, it will help in your scenario. If you want it in supervisor itself PR requests are welcome.
@varunpalekar Please read the entire thread, as everything you say has been addressed.
supervisorctl
is a daemon that listens for commands to stop/start services, so commands issued within that control process need to be persisted. There is no guarantee the entity acting as a "client" who starts/stops the service managed by Supervisor is a "system user" -- much less one who is privileged to edit the configuration files. Disabling as you suggest would remove the task from the list of manageable processes.+1
+1 I've created the: https://github.com/Supervisor/supervisor/issues/877 as I it's a crucial feature for my use case. It's been closed, as we have #591, but in principal the idea is quite the same.
@varunpalekar
I think your approach renders supervisorctl stop
and supervisorctl start
command useless.
Any time you use stop
or start
it will make your config being not in sync with the current process state.
Yes we could only use the symlinks as you've suggested, but going even deeper why to use supervisord
in first place, maybe we can "hack" around just upstart and systemd with some bash tooling around.
The lack of this feature has brought me to look for a new process manager.
This has happened twice in the past week:
supervisorctl stop process
Now either I've:
The amount of extra coding and administration needed to support this lack of a basic feature is substantial. We're migrating off.
:+1:
ππ»
+1
@varunpalekar , seems a good workaround for now. But I believe that a "disable" and "enable" options, are still the best, since that it is something that is well-know for managing services, since SysV script managers like "chkconfig" and "update-rc.d". I understand that the purpose of Supervisor is a little bit different (better than SysV concept), but in fact, it gets easier to manage Supervisor services. Everyone gave a thumbs up here for this improvement. I feel in a kind of duty to also give my here :).
+1
Thanks for all the keep Supervisor. You rock :)!
+1
Another +1 from me. Any progress on this matter?
+1
Quite bizarre supervisor doesn't have this feature.
+1
+1 i really need such a feature
+1
+1
+1
+1
+1 Really needed this today. Sadly there is no such feature
+1
+1
+1
I was just reading the docs, looking for this feature.
Default: enable=true
adding enable=false
means the program is not started.
@dlangille Not sure where you read that, but i can't see any mention of that behaviour in the docs.
Also: +1
@dlangille Not sure where you read that, but i can't see any mention of that behaviour in the docs.
I don't know. I don't recall posting this, but I do recall reading this issue. I should have posted a link.
Closest I could find now was autostart.
+1
The simplest solution is actually to stop the supervisord service. Consider this bad? Supervisor should implement a disable/enable per-process option. As a workaround it obviously doesn't respect any processes you might want to keep running, but it involves zero hacks and tends to meet my 'maintenance mode' needs and is very clean. Your mileage may vary.
+1
I need this feature as well.
As a workaround, I'm doing like this: Rename the .conf file to be something like .conf.disable and then update it. For example:
root@123:/etc/supervisor/conf.d# mv supervisor-program-1.conf supervisor-program-1.conf.disable
root@123:/etc/supervisor/conf.d# supervisorctl update all
supervisor-program-1: stopped
supervisor-program-1: removed process group
Would also like this. Thanks for the mentioned workaround @praditha-hidayat!
+1
+1
Wow, such basic and essential functionality is still not implemented. Unbelievable.
This function is available in the version 0.13 of the Supvisors plugin: XML-RPC enable XML-RPC disable
supervisorctl disable <program_name>
supervisorctl enable <program_name>
When disabled, all the processes linked to the program are stopped.
When enabled, the processes are started depending on their autorestart
configuration.
The persistence is made through a simple JSON file that can be set in the plugin options (refer to the disabilities_file
option in the section rpcinterface:supvisors
Trying to start a disabled process will raise a RPCError with a DISABLED
code (Supervisor Faults is patched on-the-fly when Supvisors is starting).
The current disabled status is made available through the web UI (state in grey) or using: XML-RPC get_local_process_info
supervisorctl local_status <a process_name linked to program>
I'd like to suggest a new feature: disable/enable a program.
disabled
flag on the disk. "disabled" processes will not be considered for "all" commands or on restart.disabled
flag on the disk.Rationale:
I often have to "disable" a process during maintenance, for fear that the system could restart and supervisord would restart the process. In order to do this, I have to essentially unregister the service by editing the supervisord config files. Even if using symlinks in a directory, this is awkward and tedious -- and I lose the program's status from within supervisor. Trying to find out if something is "disabled" is a chore, because I have to match a list of available configurations with active ones.
I think a better solution would be to simply mark the status as "disabled" and persist that to disk. The program would still be registered to supervisord and ready to
enable
at any time. The supervisorctl app andstatus
command would clearly report that the configuration is "disabled".I looked through the source and this seems relatively easy to do -- except for persisting the data to disk. I can't figure out a good place to store this.
If the maintainers think this is an acceptable idea and can suggest a place/mechanism for storing data, I think I can fork and PR.