add victoriametrics
This commit is contained in:
parent
05e84cf6fa
commit
a427307797
6 changed files with 92 additions and 46 deletions
42
flake.nix
42
flake.nix
|
@ -24,13 +24,14 @@
|
||||||
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"
|
||||||
"${nixpkgs}/nixos/modules/virtualisation/lxc-container.nix"
|
] ++ (if lxc then [
|
||||||
./nixos/common/generic-lxc.nix
|
"${nixpkgs}/nixos/modules/virtualisation/lxc-container.nix"
|
||||||
] else
|
./nixos/common/generic-lxc.nix
|
||||||
[ ./nixos/common/generic-vm.nix ]);
|
] else
|
||||||
|
[ ./nixos/common/generic-vm.nix ]);
|
||||||
specialArgs = { inherit hosts inputs; };
|
specialArgs = { inherit hosts inputs; };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -75,19 +76,20 @@
|
||||||
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} = {
|
||||||
type = "app";
|
vault-push-approles = {
|
||||||
program = "${pkgs.vault-push-approles self}/bin/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";
|
vault-push-approle-envs = {
|
||||||
program =
|
type = "app";
|
||||||
"${pkgs.vault-push-approle-envs self}/bin/vault-push-approle-envs";
|
program =
|
||||||
};
|
"${pkgs.vault-push-approle-envs self}/bin/vault-push-approle-envs";
|
||||||
|
};
|
||||||
apps.x86_64-linux.tfvars = {
|
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`
|
||||||
|
|
|
@ -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";
|
||||||
|
|
|
@ -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";
|
||||||
|
|
46
nixos/hosts/victoriametrics/configuration.nix
Normal file
46
nixos/hosts/victoriametrics/configuration.nix
Normal 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. It‘s 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";
|
||||||
|
};
|
||||||
|
}
|
|
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
|
|
Loading…
Reference in a new issue