From 0cdcc8cd250fcd9fb7bc8bf7cf9871962497130b Mon Sep 17 00:00:00 2001 From: Minijackson Date: Tue, 6 Jun 2023 14:52:51 +0200 Subject: [PATCH 1/2] netbox: 3.5.0 -> 3.5.3 --- pkgs/servers/web-apps/netbox/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/web-apps/netbox/default.nix b/pkgs/servers/web-apps/netbox/default.nix index 922bc181e05d..5903c5183335 100644 --- a/pkgs/servers/web-apps/netbox/default.nix +++ b/pkgs/servers/web-apps/netbox/default.nix @@ -23,8 +23,8 @@ in }; netbox = callPackage generic { - version = "3.5.0"; - hash = "sha256-LsUitX/e+ec/9mRBw+cbGOG2Idl9ZQwf/vxIC3YS5LU="; + version = "3.5.3"; + hash = "sha256-F8rsTOOxARI3ll545AF0+HFaG4wNO+RWwsl5y9kAyE4="; extraPatches = [ # Allow setting the STATIC_ROOT from within the configuration and setting a custom redis URL ./config.patch From a46c5ee816eb042b299ac9ca1c765c48a54d7424 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Tue, 6 Jun 2023 14:53:08 +0200 Subject: [PATCH 2/2] nixos/netbox: make systemd units more consistent with upstream --- nixos/modules/services/web-apps/netbox.nix | 42 +++++++++++++++------- 1 file 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; }; };