add victoriametrics

This commit is contained in:
Vivian 2021-12-02 16:34:48 +01:00
parent 05e84cf6fa
commit a427307797
6 changed files with 92 additions and 46 deletions

View file

@ -24,9 +24,10 @@
mkConfig = { hostname, profile ? hostname, lxc ? true, ... }: { mkConfig = { hostname, profile ? hostname, lxc ? true, ... }: {
"${profile}" = lib.nixosSystem { "${profile}" = lib.nixosSystem {
inherit system; inherit system;
modules = modules = [
[ ./nixos/common "${./.}/nixos/hosts/${profile}/configuration.nix" ] ./nixos/common
++ (if lxc then [ "${./.}/nixos/hosts/${profile}/configuration.nix"
] ++ (if lxc then [
"${nixpkgs}/nixos/modules/virtualisation/lxc-container.nix" "${nixpkgs}/nixos/modules/virtualisation/lxc-container.nix"
./nixos/common/generic-lxc.nix ./nixos/common/generic-lxc.nix
] else ] else
@ -75,20 +76,21 @@
lib.foldr (el: acc: acc // mkConfig el) { } nixHosts; lib.foldr (el: acc: acc // mkConfig el) { } nixHosts;
deploy.nodes = lib.foldr (el: acc: acc // mkDeploy el) { } nixHosts; deploy.nodes = lib.foldr (el: acc: acc // mkDeploy el) { } nixHosts;
apps.x86_64-linux.vault-push-approles = { apps.${system} = {
vault-push-approles = {
type = "app"; type = "app";
program = "${pkgs.vault-push-approles self}/bin/vault-push-approles"; program = "${pkgs.vault-push-approles self}/bin/vault-push-approles";
}; };
apps.x86_64-linux.vault-push-approle-envs = { vault-push-approle-envs = {
type = "app"; type = "app";
program = program =
"${pkgs.vault-push-approle-envs self}/bin/vault-push-approle-envs"; "${pkgs.vault-push-approle-envs self}/bin/vault-push-approle-envs";
}; };
tfvars = {
apps.x86_64-linux.tfvars = {
type = "app"; type = "app";
program = "${genTFVars}/bin/gen-tf-vars"; program = "${genTFVars}/bin/gen-tf-vars";
}; };
};
# Use by running `nix develop` # Use by running `nix develop`
devShell.${system} = pkgs.mkShell { devShell.${system} = pkgs.mkShell {

View file

@ -84,8 +84,8 @@
} }
{ {
hostname = "victoriametrics"; hostname = "victoriametrics";
ip = "10.42.42.18"; ip = "10.42.42.19";
mac = "A9:E4:AA:7C:7E:EB"; mac = "9E:91:61:35:84:1F";
} }
{ {
hostname = "nuc"; hostname = "nuc";

View file

@ -3,10 +3,8 @@
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }: { config, pkgs, ... }:
let let vs = config.vault-secrets.secrets;
vs = config.vault-secrets.secrets; in {
in
{
imports = [ ]; imports = [ ];
networking.hostName = "minio"; networking.hostName = "minio";

View file

@ -0,0 +1,46 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
let
vmPort = 8428;
vs = config.vault-secrets.secrets;
in {
imports = [ ];
networking.hostName = "victoriametrics";
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.11"; # Did you read the comment?
# Additional packages
environment.systemPackages = with pkgs; [ ];
networking.firewall.allowedTCPPorts = [ vmPort config.services.grafana.port ];
networking.firewall.allowedUDPPorts = [ vmPort ];
services.victoriametrics = {
enable = true;
listenAddress = ":${toString vmPort}";
# Data Retention period in months
retentionPeriod = 12;
};
vault-secrets.secrets.grafana = {
user = "grafana";
group = "grafana";
};
services.grafana = {
enable = true;
addr = "0.0.0.0";
port = 2342;
security.adminPasswordFile = "${vs.grafana}/password";
};
}

View file

@ -49,7 +49,7 @@
"mac": "16:2B:87:55:0C:0C" "mac": "16:2B:87:55:0C:0C"
}, },
"victoriametrics": { "victoriametrics": {
"mac": "A9:E4:AA:7C:7E:EB" "mac": "9E:91:61:35:84:1F"
} }
} }
} }

View file

@ -253,25 +253,25 @@ resource "proxmox_lxc" "dhcp" {
} }
} }
resource "proxmox_lxc" "victoriametrics" { # resource "proxmox_lxc" "victoriametrics" {
target_node = "nuc" # target_node = "nuc"
hostname = "victoriametrics" # hostname = "victoriametrics"
vmid = 113 # vmid = 113
clone = 108 # clone = 108
unprivileged = true # unprivileged = true
onboot = true # onboot = true
cores = 1 # cores = 1
memory = 512 # memory = 512
rootfs { # rootfs {
storage = "local-zfs" # storage = "local-zfs"
size = "25G" # size = "25G"
} # }
network { # network {
name = "eth0" # name = "eth0"
bridge = "vmbr0" # bridge = "vmbr0"
hwaddr = var.hosts.victoriametrics.mac # hwaddr = var.hosts.victoriametrics.mac
} # }
} # }