mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-24 18:16:21 +03:00
nixos/netbox: make systemd units more consistent with upstream
This commit is contained in:
parent
0cdcc8cd25
commit
a46c5ee816
1 changed files with 29 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs, buildEnv, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
@ -261,6 +261,7 @@ in {
|
||||||
StateDirectory = "netbox";
|
StateDirectory = "netbox";
|
||||||
StateDirectoryMode = "0750";
|
StateDirectoryMode = "0750";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
RestartSec = 30;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
netbox-migration = {
|
netbox-migration = {
|
||||||
|
@ -276,13 +277,18 @@ in {
|
||||||
ExecStart = ''
|
ExecStart = ''
|
||||||
${pkg}/bin/netbox migrate
|
${pkg}/bin/netbox migrate
|
||||||
'';
|
'';
|
||||||
|
PrivateTmp = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
netbox = {
|
netbox = {
|
||||||
description = "NetBox WSGI Service";
|
description = "NetBox WSGI Service";
|
||||||
|
documentation = [ "https://docs.netbox.dev/" ];
|
||||||
|
|
||||||
wantedBy = [ "netbox.target" ];
|
wantedBy = [ "netbox.target" ];
|
||||||
after = [ "netbox-migration.service" ];
|
|
||||||
|
after = [ "network-online.target" "netbox-migration.service" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
|
||||||
preStart = ''
|
preStart = ''
|
||||||
${pkg}/bin/netbox trace_paths --no-input
|
${pkg}/bin/netbox trace_paths --no-input
|
||||||
|
@ -290,9 +296,7 @@ in {
|
||||||
${pkg}/bin/netbox remove_stale_contenttypes --no-input
|
${pkg}/bin/netbox remove_stale_contenttypes --no-input
|
||||||
'';
|
'';
|
||||||
|
|
||||||
environment = {
|
environment.PYTHONPATH = pkg.pythonPath;
|
||||||
PYTHONPATH = pkg.pythonPath;
|
|
||||||
};
|
|
||||||
|
|
||||||
serviceConfig = defaultServiceConfig // {
|
serviceConfig = defaultServiceConfig // {
|
||||||
ExecStart = ''
|
ExecStart = ''
|
||||||
|
@ -300,32 +304,37 @@ in {
|
||||||
--bind ${cfg.listenAddress}:${toString cfg.port} \
|
--bind ${cfg.listenAddress}:${toString cfg.port} \
|
||||||
--pythonpath ${pkg}/opt/netbox/netbox
|
--pythonpath ${pkg}/opt/netbox/netbox
|
||||||
'';
|
'';
|
||||||
|
PrivateTmp = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
netbox-rq = {
|
netbox-rq = {
|
||||||
description = "NetBox Request Queue Worker";
|
description = "NetBox Request Queue Worker";
|
||||||
|
documentation = [ "https://docs.netbox.dev/" ];
|
||||||
|
|
||||||
wantedBy = [ "netbox.target" ];
|
wantedBy = [ "netbox.target" ];
|
||||||
after = [ "netbox.service" ];
|
after = [ "netbox.service" ];
|
||||||
|
|
||||||
environment = {
|
environment.PYTHONPATH = pkg.pythonPath;
|
||||||
PYTHONPATH = pkg.pythonPath;
|
|
||||||
};
|
|
||||||
|
|
||||||
serviceConfig = defaultServiceConfig // {
|
serviceConfig = defaultServiceConfig // {
|
||||||
ExecStart = ''
|
ExecStart = ''
|
||||||
${pkg}/bin/netbox rqworker high default low
|
${pkg}/bin/netbox rqworker high default low
|
||||||
'';
|
'';
|
||||||
|
PrivateTmp = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
netbox-housekeeping = {
|
netbox-housekeeping = {
|
||||||
description = "NetBox housekeeping job";
|
description = "NetBox housekeeping job";
|
||||||
after = [ "netbox.service" ];
|
documentation = [ "https://docs.netbox.dev/" ];
|
||||||
|
|
||||||
environment = {
|
wantedBy = [ "multi-user.target" ];
|
||||||
PYTHONPATH = pkg.pythonPath;
|
|
||||||
};
|
after = [ "network-online.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
|
||||||
|
environment.PYTHONPATH = pkg.pythonPath;
|
||||||
|
|
||||||
serviceConfig = defaultServiceConfig // {
|
serviceConfig = defaultServiceConfig // {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
|
@ -338,10 +347,17 @@ in {
|
||||||
|
|
||||||
systemd.timers.netbox-housekeeping = {
|
systemd.timers.netbox-housekeeping = {
|
||||||
description = "Run NetBox housekeeping job";
|
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 = {
|
timerConfig = {
|
||||||
OnCalendar = "daily";
|
OnCalendar = "daily";
|
||||||
|
AccuracySec = "1h";
|
||||||
|
Persistent = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue