Merge pull request #236279 from minijackson/netbox-3.5.3

This commit is contained in:
Ryan Lahfa 2023-06-16 11:49:13 +02:00 committed by GitHub
commit a056d3567c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 15 deletions

View file

@ -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;
};
};

View file

@ -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