wolf.r: add netbox docker-compose
This commit is contained in:
parent
30a90e48b9
commit
27f3c2cd53
@ -43,6 +43,8 @@ in
|
|||||||
## write collectd statistics to wolf.shack
|
## write collectd statistics to wolf.shack
|
||||||
<stockholm/krebs/2configs/collectd-base.nix>
|
<stockholm/krebs/2configs/collectd-base.nix>
|
||||||
{ services.influxdb.enable = true; }
|
{ services.influxdb.enable = true; }
|
||||||
|
|
||||||
|
<stockholm/krebs/2configs/shack/netbox.nix>
|
||||||
];
|
];
|
||||||
# use your own binary cache, fallback use cache.nixos.org (which is used by
|
# use your own binary cache, fallback use cache.nixos.org (which is used by
|
||||||
# apt-cacher-ng in first place)
|
# apt-cacher-ng in first place)
|
||||||
|
39
krebs/2configs/shack/netbox.nix
Normal file
39
krebs/2configs/shack/netbox.nix
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
environment.systemPackages = [ pkgs.docker-compose ];
|
||||||
|
virtualisation.docker.enable = true;
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
virtualHosts."netbox.shack".locations."/".proxyPass = "http://localhost:18080";
|
||||||
|
};
|
||||||
|
# we store the netbox config there:
|
||||||
|
# state = [ "/var/lib/netbox" ];
|
||||||
|
systemd.services.backup-netbox = {
|
||||||
|
after = [ "netbox-docker-compose.service" ];
|
||||||
|
startAt = "daily";
|
||||||
|
path = with pkgs; [ docker-compose docker gzip coreutils ];
|
||||||
|
script = ''
|
||||||
|
cd /var/lib/netbox
|
||||||
|
mkdir -p backup
|
||||||
|
docker-compose exec -T -upostgres postgres pg_dumpall \
|
||||||
|
| gzip > backup/netdata_$(date -Iseconds).dump.gz
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.netbox-docker-compose = {
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "network-online.target" "docker.service" ];
|
||||||
|
environment.VERSION = "v2.5.13";
|
||||||
|
serviceConfig = {
|
||||||
|
WorkingDirectory = "/var/lib/netbox";
|
||||||
|
# TODO: grep -q NAPALM_SECRET env/netbox.env
|
||||||
|
# TODO: grep -q NAPALM_SECRET netbox-netprod-importer/switches.yml
|
||||||
|
ExecStartPre = "${pkgs.docker-compose}/bin/docker-compose pull";
|
||||||
|
ExecStart = "${pkgs.docker-compose}/bin/docker-compose up";
|
||||||
|
Restart = "always";
|
||||||
|
RestartSec = "10";
|
||||||
|
StartLimitIntervalSec = 60;
|
||||||
|
StartLimitBurst = 3;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user