diff options
| author | Minijackson <minijackson@riseup.net> | 2023-06-06 14:53:08 +0200 |
|---|---|---|
| committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2023-06-16 09:49:48 +0000 |
| commit | 83e046d4dfefce0b823f1c33f4d471feb535e4e3 (patch) | |
| tree | d35895e7e7aaf443b2f4e9967260a42f33bd27c6 | |
| parent | netbox: 3.5.0 -> 3.5.3 (diff) | |
| download | nixpkgs-origin/backport-236279-to-release-23.05.tar.gz | |
nixos/netbox: make systemd units more consistent with upstreamorigin/backport-236279-to-release-23.05
(cherry picked from commit a46c5ee816eb042b299ac9ca1c765c48a54d7424)
| -rw-r--r-- | nixos/modules/services/web-apps/netbox.nix | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/nixos/modules/services/web-apps/netbox.nix b/nixos/modules/services/web-apps/netbox.nix index 0ecb20e8c2c0..e2ef350ba4e5 100644 --- a/nixos/modules/services/web-apps/netbox.nix +++ b/nixos/modules/services/web-apps/netbox.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, buildEnv, ... }: +{ config, lib, pkgs, ... }: with lib; @@ -261,6 +261,7 @@ in { StateDirectory = "netbox"; StateDirectoryMode = "0750"; Restart = "on-failure"; + RestartSec = 30; }; in { netbox-migration = { @@ -276,13 +277,18 @@ in { ExecStart = '' ${pkg}/bin/netbox migrate ''; + PrivateTmp = true; }; }; netbox = { description = "NetBox WSGI Service"; + documentation = [ "https://docs.netbox.dev/" ]; + wantedBy = [ "netbox.target" ]; - after = [ "netbox-migration.service" ]; + + after = [ "network-online.target" "netbox-migration.service" ]; + wants = [ "network-online.target" ]; preStart = '' ${pkg}/bin/netbox trace_paths --no-input @@ -290,9 +296,7 @@ in { ${pkg}/bin/netbox remove_stale_contenttypes --no-input ''; - environment = { - PYTHONPATH = pkg.pythonPath; - }; + environment.PYTHONPATH = pkg.pythonPath; serviceConfig = defaultServiceConfig // { ExecStart = '' @@ -300,32 +304,37 @@ in { --bind ${cfg.listenAddress}:${toString cfg.port} \ --pythonpath ${pkg}/opt/netbox/netbox ''; + PrivateTmp = true; }; }; netbox-rq = { description = "NetBox Request Queue Worker"; + documentation = [ "https://docs.netbox.dev/" ]; + wantedBy = [ "netbox.target" ]; after = [ "netbox.service" ]; - environment = { - PYTHONPATH = pkg.pythonPath; - }; + environment.PYTHONPATH = pkg.pythonPath; serviceConfig = defaultServiceConfig // { ExecStart = '' ${pkg}/bin/netbox rqworker high default low ''; + PrivateTmp = true; }; }; netbox-housekeeping = { description = "NetBox housekeeping job"; - after = [ "netbox.service" ]; + documentation = [ "https://docs.netbox.dev/" ]; - environment = { - PYTHONPATH = pkg.pythonPath; - }; + wantedBy = [ "multi-user.target" ]; + + after = [ "network-online.target" ]; + wants = [ "network-online.target" ]; + + environment.PYTHONPATH = pkg.pythonPath; serviceConfig = defaultServiceConfig // { Type = "oneshot"; @@ -338,10 +347,17 @@ in { systemd.timers.netbox-housekeeping = { description = "Run NetBox housekeeping job"; - wantedBy = [ "timers.target" ]; + documentation = [ "https://docs.netbox.dev/" ]; + + wantedBy = [ "multi-user.target" ]; + + after = [ "network-online.target" ]; + wants = [ "network-online.target" ]; timerConfig = { OnCalendar = "daily"; + AccuracySec = "1h"; + Persistent = true; }; }; |
