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

View file

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

View file

@ -3,10 +3,8 @@
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
let
vs = config.vault-secrets.secrets;
in
{
let vs = config.vault-secrets.secrets;
in {
imports = [ ];
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"
},
"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" {
target_node = "nuc"
hostname = "victoriametrics"
vmid = 113
clone = 108
unprivileged = true
onboot = true
cores = 1
# resource "proxmox_lxc" "victoriametrics" {
# target_node = "nuc"
# hostname = "victoriametrics"
# vmid = 113
# clone = 108
# unprivileged = true
# onboot = true
# cores = 1
memory = 512
# memory = 512
rootfs {
storage = "local-zfs"
size = "25G"
}
# rootfs {
# storage = "local-zfs"
# size = "25G"
# }
network {
name = "eth0"
bridge = "vmbr0"
hwaddr = var.hosts.victoriametrics.mac
}
}
# network {
# name = "eth0"
# bridge = "vmbr0"
# hwaddr = var.hosts.victoriametrics.mac
# }
# }