mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-11 21:10:29 +01:00
Replace supervisord with systemd #2387
Closed
opened 2025-12-29 17:25:35 +01:00 by adam
·
26 comments
No Branch/Tag Specified
main
update-changelog-comments-docs
feature-removal-issue-type
20911-dropdown
20239-plugin-menu-classes-mutable-state
21097-graphql-id-lookups
feature
fix_module_substitution
20923-dcim-templates
20044-elevation-stuck-lightmode
feature-ip-prefix-link
v4.5-beta1-release
20068-import-moduletype-attrs
20766-fix-german-translation-code-literals
20378-del-script
7604-filter-modifiers-v3
circuit-swap
12318-case-insensitive-uniqueness
20637-improve-device-q-filter
20660-script-load
19724-graphql
20614-update-ruff
14884-script
02496-max-page
19720-macaddress-interface-generic-relation
19408-circuit-terminations-export-templates
20203-openapi-check
fix-19669-api-image-download
7604-filter-modifiers
19275-fixes-interface-bulk-edit
fix-17794-get_field_value_return_list
11507-show-aggregate-and-rir-on-api
9583-add_column_specific_search_field_to_tables
v4.5.0
v4.4.10
v4.4.9
v4.5.0-beta1
v4.4.8
v4.4.7
v4.4.6
v4.4.5
v4.4.4
v4.4.3
v4.4.2
v4.4.1
v4.4.0
v4.3.7
v4.4.0-beta1
v4.3.6
v4.3.5
v4.3.4
v4.3.3
v4.3.2
v4.3.1
v4.3.0
v4.2.9
v4.3.0-beta2
v4.2.8
v4.3.0-beta1
v4.2.7
v4.2.6
v4.2.5
v4.2.4
v4.2.3
v4.2.2
v4.2.1
v4.2.0
v4.1.11
v4.1.10
v4.1.9
v4.1.8
v4.2-beta1
v4.1.7
v4.1.6
v4.1.5
v4.1.4
v4.1.3
v4.1.2
v4.1.1
v4.1.0
v4.0.11
v4.0.10
v4.0.9
v4.1-beta1
v4.0.8
v4.0.7
v4.0.6
v4.0.5
v4.0.3
v4.0.2
v4.0.1
v4.0.0
v3.7.8
v3.7.7
v4.0-beta2
v3.7.6
v3.7.5
v4.0-beta1
v3.7.4
v3.7.3
v3.7.2
v3.7.1
v3.7.0
v3.6.9
v3.6.8
v3.6.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
1.0.0
Labels
Clear labels
beta
breaking change
complexity: high
complexity: low
complexity: medium
needs milestone
netbox
pending closure
plugin candidate
pull-request
severity: high
severity: low
severity: medium
status: accepted
status: backlog
status: blocked
status: duplicate
status: needs owner
status: needs triage
status: revisions needed
status: under review
topic: GraphQL
topic: Internationalization
topic: OpenAPI
topic: UI/UX
topic: cabling
topic: event rules
topic: htmx navigation
topic: industrialization
topic: migrations
topic: plugins
topic: scripts
topic: templating
topic: testing
type: bug
type: deprecation
type: documentation
type: feature
type: housekeeping
type: translation
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/netbox#2387
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @candlerb on GitHub (Feb 15, 2019).
Change Type
[ ] Addition
[ ] Correction
[X] Deprecation
[ ] Cleanup (formatting, typos, etc.)
Proposed Changes
I propose changing the installation instructions to remove supervisord and configure systemd instead.
supervisord depends on python2, which is soon to be end of life. Installing supervisord pulls in python2 as a dependency, introducing two python versions on a previously python3-only system.
Furthermore, the mainstream modern Linux distros already use systemd as default (RedHat 7, Ubuntu 16.04+, Debian Stretch+) and there is no need to introduce another daemon manager into those systems. Anyone choosing to run a different system can work out for themselves how to supervise a daemon.
Detail
Since gunicorn is installed via pip rather than system packages, we need to provide the unit file. The following is tested under Ubuntu 16.04.
Create a unit file
/etc/systemd/system/netbox.service:Then activate it:
A similar file would be required for rqworker, if that's in use.
Notes
This relates to #2457. That was rejected because of the overhead of documenting systemd alongside supervisord. Here I propose getting rid of supervisord entirely.
#2457 includes multiple files, including configuration for a special flavour of Nginx called "unit". I don't think that should be included. Out-of-the-box packages for Nginx and Apache2 will already have suitable systemd unit files, so only one is required for Netbox (plus optional second one for rqworker).
@kasimon commented on GitHub (Feb 15, 2019):
FWIW, that's almost exactly what I do (with the one difference that our inhouse netbox debian package ships its own virtualenv environment and thus its own gunicorn binary).
Both very valid points. I would welcome this update to the documentation.
@goebelmeier commented on GitHub (Feb 15, 2019):
Works perfect for me without the need of another daemon manager.
@DanSheps commented on GitHub (Feb 15, 2019):
I think a better approach, would be to include a "contrib" directory and instead use envirovars to control certain settings in the unit file. Less overhead and less chance for a mistake.
Would streamline the install process too.
@candlerb commented on GitHub (Feb 15, 2019):
I am only proposing a simple swapout of supervisord config file with systemd config file.
@DanSheps: sorry I don't understand what you're saying. What exactly would you put in the "contrib" directory? What environment variables would "control certain settings", and how would the user be expected to set them?
@DanSheps commented on GitHub (Feb 15, 2019):
contrib would have:
contrib/netbox@.service
contrib/netbox.env
In the netbox.env, you have:
If @jeremystretch is willing, I can do this as a PR, but I will need someone to sanity it as I only run CentOS.
@DanSheps commented on GitHub (Feb 15, 2019):
If someone could sanity check my last commit for ubuntu, I think that will work for most instances, I can submit a PR assuming this is approved.
@Grokzen commented on GitHub (Feb 20, 2019):
My 2 cents on this is that you should not replace this "yet". But instead to provide both solutions in the documentation for a period of time, but recommend/prefer the systemd solution.
@candlerb commented on GitHub (Feb 20, 2019):
Why? What's the benefit of supervisord?
@tb-killa commented on GitHub (Feb 20, 2019):
Why doesn't provide multiple install choices on documentation side and let the user select the right ones themselve ?
I think it's a bit of overhead to build all this stuff up because if someone is using netbox the person should know what he is doing.
@candlerb commented on GitHub (Feb 20, 2019):
That was suggested in #2457, and rejected because of the overhead of maintaining two parallel sets of documentation.
I repeat: why is supervisord a better choice than systemd? Why not just document systemd, which is the standard for all mainstream Linux distributions? Then if as you say "the person should know what he is doing" they can install something else if they choose.
@pobk commented on GitHub (Feb 21, 2019):
I would avoid putting any recommendations on system level processes entirely.
In answer to the question "why is supervisord better than systemd?": because supervisord is trying to do one job very well... unlike systemd which is trying to do all the jobs, but it's doing them badly. Case in point: systemd DNS resolver subsystem is very broken and does not comply with standard operational tennants. Also, why do you want your init system doing DHCP or managing your network or fiddling with your system clock? Why do you need it managing ALL THE THINGS?
Systemd is trying to undertake things, which personally, I believe the authors have little experience of, whereas the authors of things like syslog-ng or rsyslog, in the case of logging for example, have a great deal of experience in handling that data and their core remit is to handle ONLY that data...You don't see syslog-ng suddenly taking over DHCP-Client functions?
But back to my original point here: I can see a point for having a separate repo of init-scripts and docs around other extras for those who wish to contribute to in order to facilitate the installation of NetBox... I do not think systemd implementations should be a core part of the distribution/installation.
I've ansiblised NetBox on FreeBSD in an iocage. Systemd is (very thankfully) irrelevant in my environment.
@Grokzen commented on GitHub (Feb 21, 2019):
You can argue that since python2 still has one year left before EOL it can still be in but put into deprecated state and migrated out over time.
Another argument that can be done is that is not a good deprecation and migration strategy to rip the old out and replace it with something new right away within one major release cycle.
@candlerb commented on GitHub (Feb 21, 2019):
I am not suggesting that users should remove supervisord: I said to remove supervisord from the netbox documentation. Existing installations can continue to use supervisord without any changes.
In any case, neither supervisord nor systemd is part of netbox.
@pobk commented on GitHub (Feb 21, 2019):
Agreed, although in defence of supervisord... It does abstract the process supervision away very nicely from any operating system requirements. Supervisord works on most *nix based operating systems I've worked with and the overall init system is abstracted away from the applications.
I've just checked... supervisord does have support for Py3 in development... From the github repo:
And also, from the supervisor issues list #1060 Python 3 support?
Looks like it is very much in progress and this issue is more of a non-issue.
@kasimon commented on GitHub (Feb 21, 2019):
@pobk your systemd ranting is mostly unrelated to what this issue is about, please refrain from doing so. The systemd dns resolver for example has nothing to do with running netbox on a system.
@kasimon commented on GitHub (Feb 21, 2019):
Let me add my 0.02 $currency: Currently, the setup documentation is specific to ubuntu 18.04 (which is using systemd). So I don't really see a point in installing additional software and running another service when what the system already contains is more than enough. This would certainly make the current documentation simpler and the resulting system a little bit easier to manage (the same management commands can be used that are already used for any other service on the system, no need to learn how to use supervisord).
One point that speaks for using supervisord in the documentation would be that it would make the documentation a little easier to be translated to other operating systems. But every freebsd (or non-linux/non-systemd) admin I know would have no problem to translate that simple systemd service description to something working on his/her system. And using a systemd service description in the documentation would make it easily translatable to almost any current mainstream linux distribution.
Summary: A systemd based setup would simplify the instructions without losing any features relevant to the scope of the document.
@DanSheps commented on GitHub (Feb 21, 2019):
Unfortunately, this is going to be part of the installation of almost any system, look at httpd, sql, etc. Most of them handle the automatic creation of the systemd or initd scripts. Netbox has no automatic installation
I think there is a mis-understanding of what systemd is, and what it isn't.
systemd is a system configurator and service bootstrapper. It actually does very well with managing services and system configuration.
systemd is not a single binary, it is actually composed of separate binaries in one project. So, when you refer to the "resolver", you are actually referring to "resolved". systemd-resolved it is a daemon made by the maker of systemd, and it is not enabled by default on CentOS7 (not sure about Ubuntu or any other flavours).
If you feel that way, I don't think supervisord should be included either. It is still a service bootstrapper.
Your usage is most likely not mainstream. However, thankfully these instructions are not REQUIRED for netbox to function. If you want to go outside the setup docs, you are more or less on your own as far as getting it to work, which it sounds like you did anyways.
The main argument for using systemd, from what I can see, is it reduces a dependency from Netbox. Systemd is in most major Linux versions around now, so apart from BSD, systemd will be available on most systems running the software.
By removing supervisord, you also reduce the chance that there is a failure somewhere along the line. supervisord is also started by systemd on almost all systems covered by the installation docs. So all that is being done is removing a middleware that could potentially fail or introduce failures along the way.
@DanSheps commented on GitHub (Feb 21, 2019):
@candlerb Thanks for taking a look and sanity checking the commit, I did a few more updates.
@pobk commented on GitHub (Feb 22, 2019):
@kasimon: I would ask that you refrain grandstanding and throwing around admonishments at anyone as you have done to me. My systemd ranting, while very ranty and verbose (for which I will offer an apology), is related to the discussion and very much on-topic, whereas admonitions are irrelevant.
WIth respect to "FreeBSD admins will be able to translate systemd"... That's horrifically short sighted and exclusionist: Yes, why not make the documentation impenetrable to new engineers or those that aren't as experienced. Lets write documentation that focuses on a single OS.
The documentation already says:
Focusing the documentation even more on a singular init system is a poor idea.
Documenting the deployment process on Supervisord keeps things agnostic. You don't need Py3 support for Supervisor for netbox to function and you don't exclude non-linux OS users.
The alternative, as suggested elsewhere is to write specific integration guides elsewhere. I would be happy to write a BSD flavour if this is a viable alternative.
@kasimon commented on GitHub (Feb 22, 2019):
I was a bit harsh, I'm sorry for that. Please let us all try to stay as close as possible to what this issue is about, there is more than enough room elsewhere on the net to have general systemd discussions.
Well, netbox is not a very complicated program to install and to run. Providing an example documentation that will fit probably >90% of those needing help with their setup seems not a bad idea to me.
I was referring to https://netbox.readthedocs.io/en/stable/installation/3-http-daemon/:
Which I think is a good way to handle this.
@pobk commented on GitHub (Feb 22, 2019):
Accepted and agreed.
It's not very complicated to us. Asking others might give you a different perspective.
For HTTPDs, I would agree entirely. What we are discussing here, however, is the supervisord/gunicorn side. My contention is:
@candlerb commented on GitHub (Feb 22, 2019):
Each OS will have its own standard mechanism for starting/stopping processes, which happens to be systemd for those OSes mentioned in the documentation.
But I wouldn't recommend supervisord to anyone, for this reason alone:
In other words, supervisord is abandonware. And pulling in legacy python2 as a dependency causes debugging headaches.
@pobk commented on GitHub (Feb 22, 2019):
So remove it, instead of bleating on about some other poor software simply because a majority of users might be using an operating system that utilises it.
You're complaining about one "poor" piece of software and suggesting replacing it with another "poor" piece of software.
But as has been mentioned previously, they are working on that exact problem. It is very much not abandonware. Now you're just being sensationalist and obtuse.
@mnaberez commented on GitHub (Apr 6, 2019):
Supervisor 4.0.0 (PyPI package; supports Python 3.4+ and 2.7)
@davidc commented on GitHub (Jul 8, 2019):
Ranting aside (I don't like systemd either), it is simply a fact that a lot of OSes ship with systemd as standard these days, whereas none that I know of ship with supervisord. Changing the default installation instructions to systemd would make sense - creating less work for the sysadmin installing Netbox and resulting in fewer packages installed. As has already been mentioned, a competent sysadmin could use whatever they wanted anyway, so this just makes the standard installation use-case simpler.
(Perhaps keep the old supervisor file and instructions in a contrib directory as already suggested).
@DanSheps commented on GitHub (Sep 6, 2019):
Closed in #3017