diff --git a/hosts/containers/grafana/configuration.nix b/hosts/containers/grafana/configuration.nix index 57f69ced..4b45d38b 100644 --- a/hosts/containers/grafana/configuration.nix +++ b/hosts/containers/grafana/configuration.nix @@ -2,6 +2,7 @@ { imports = [ + ../../../lib ../../../lib/lxc-container.nix ../../../lib/shared.nix @@ -15,21 +16,27 @@ hq.interface = "eth0"; }; + services.openssh.enable = true; + + boot.isContainer = true; + # /sbin/init + boot.loader.initScript.enable = true; + boot.loader.grub.enable = false; + networking.hostName = "grafana"; networking.useNetworkd = true; - # Needs IPv4 for obtaining certs? - networking.useDHCP = false; - networking.interfaces.eth0.useDHCP = true; - services.resolved.enable = false; - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - vim - ]; + # Create a few files early before packing tarball for Proxmox + # architecture/OS detection. + system.extraSystemBuilderCmds = '' + mkdir -m 0755 -p $out/bin + ln -s ${pkgs.bash}/bin/bash $out/bin/sh + mkdir -m 0755 -p $out/sbin + ln -s ../init $out/sbin/init + ''; - # http https - networking.firewall.allowedTCPPorts = [ 80 443 ]; + # http https influxdb + networking.firewall.allowedTCPPorts = [ 80 443 8086 ]; # collectd networking.firewall.allowedUDPPorts = [ 25826 ]; @@ -37,8 +44,8 @@ enable = true; agree = true; config = '' - grafana.hq.c3d2.de - proxy / localhost:3000 + grafana.hq.c3d2.de + proxy / localhost:3000 ''; }; services.grafana = { @@ -49,32 +56,31 @@ }; users.allowSignUp = true; }; - services.influxdb = - let - collectdTypes = pkgs.stdenv.mkDerivation { - name = "collectd-types"; - src = ./.; - buildInputs = [ pkgs.collectd ]; - buildPhase = '' - mkdir -p $out/share/collectd - cat ${pkgs.collectd}/share/collectd/types.db >> $out/share/collectd/types.db - echo "stations value:GAUGE:0:U" >> $out/share/collectd/types.db - ''; - installPhase = '' - cp -r . $out - ''; - }; - in { - enable = true; - extraConfig = { - logging.level = "debug"; - collectd = [{ - enabled = true; - database = "collectd"; - typesdb = "${collectdTypes}/share/collectd/types.db"; - }]; - }; + services.influxdb = let + collectdTypes = pkgs.stdenv.mkDerivation { + name = "collectd-types"; + src = ./.; + buildInputs = [ pkgs.collectd ]; + buildPhase = '' + mkdir -p $out/share/collectd + cat ${pkgs.collectd}/share/collectd/types.db >> $out/share/collectd/types.db + echo "stations value:GAUGE:0:U" >> $out/share/collectd/types.db + ''; + installPhase = '' + cp -r . $out + ''; }; + in { + enable = true; + extraConfig = { + logging.level = "debug"; + collectd = [{ + enabled = true; + database = "collectd"; + typesdb = "${collectdTypes}/share/collectd/types.db"; + }]; + }; + }; # This value determines the NixOS release with which your system is to be # compatible, in order to avoid breaking some software such as database @@ -82,4 +88,3 @@ # should. system.stateVersion = "18.09"; # Did you read the comment? } -