From e41f98de313f81a74a6ebb1131b3bd92817c4acb Mon Sep 17 00:00:00 2001 From: seth Date: Wed, 6 Sep 2023 17:50:53 -0400 Subject: hosts: remove p-body --- hosts/atlas/default.nix | 24 +++++----- hosts/default.nix | 7 +-- hosts/p-body/buildMachines.nix | 15 ------- hosts/p-body/default.nix | 67 --------------------------- hosts/p-body/grafana.nix | 25 ----------- hosts/p-body/hardware-configuration.nix | 52 --------------------- hosts/p-body/loki.nix | 80 --------------------------------- hosts/p-body/nginx.nix | 32 ------------- hosts/p-body/p-body2atlas.pub | 1 - hosts/p-body/victoriametrics.nix | 26 ----------- 10 files changed, 13 insertions(+), 316 deletions(-) delete mode 100644 hosts/p-body/buildMachines.nix delete mode 100644 hosts/p-body/default.nix delete mode 100644 hosts/p-body/grafana.nix delete mode 100644 hosts/p-body/hardware-configuration.nix delete mode 100644 hosts/p-body/loki.nix delete mode 100644 hosts/p-body/nginx.nix delete mode 100644 hosts/p-body/p-body2atlas.pub delete mode 100644 hosts/p-body/victoriametrics.nix (limited to 'hosts') diff --git a/hosts/atlas/default.nix b/hosts/atlas/default.nix index d42ae99..3f01ed7 100644 --- a/hosts/atlas/default.nix +++ b/hosts/atlas/default.nix @@ -1,6 +1,7 @@ { config, pkgs, + guzzle_api, ... }: { imports = [ @@ -18,22 +19,21 @@ networking = { domain = "mydadleft.me"; hostName = "atlas"; - firewall.allowedTCPPorts = [config.services.prometheus.exporters.node.port]; }; - nix.settings.allowed-users = ["bob"]; - - users.users = { - atlas = { - isNormalUser = true; - shell = pkgs.bash; - passwordFile = config.age.secrets.userPassword.path; + services = { + guzzle-api = { + enable = true; + url = "https://api." + config.networking.domain; + port = "8080"; + package = guzzle_api.packages.x86_64-linux.guzzle-api-server; }; + }; - bob = { - isNormalUser = true; - shell = pkgs.bash; - }; + users.users.atlas = { + isNormalUser = true; + shell = pkgs.bash; + passwordFile = config.age.secrets.userPassword.path; }; zramSwap.enable = true; diff --git a/hosts/default.nix b/hosts/default.nix index 7ec2742..42a4f35 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -29,13 +29,8 @@ }; atlas = { - system = "aarch64-linux"; - profile = profiles.server; - }; - - p-body = { modules = [inputs.guzzle_api.nixosModules.guzzle_api]; - system = "x86_64-linux"; + system = "aarch64-linux"; profile = profiles.server; }; }; diff --git a/hosts/p-body/buildMachines.nix b/hosts/p-body/buildMachines.nix deleted file mode 100644 index 07f1cd1..0000000 --- a/hosts/p-body/buildMachines.nix +++ /dev/null @@ -1,15 +0,0 @@ -_: { - nix = { - buildMachines = [ - { - hostName = "atlas"; - maxJobs = 4; - sshUser = "bob"; - supportedFeatures = ["benchmark" "big-parallel" "gccarch-armv8-a" "kvm" "nixos-test"]; - systems = ["aarch64-linux"]; - } - ]; - - settings.builders-use-substitutes = true; - }; -} diff --git a/hosts/p-body/default.nix b/hosts/p-body/default.nix deleted file mode 100644 index 299a237..0000000 --- a/hosts/p-body/default.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ - config, - guzzle_api, - pkgs, - ... -}: { - imports = [ - ./buildMachines.nix - ./grafana.nix - ./hardware-configuration.nix - ./loki.nix - ./nginx.nix - ./victoriametrics.nix - ]; - - boot = { - loader.grub = { - enable = true; - device = "/dev/sda"; - }; - - supportedFilesystems = ["btrfs"]; - }; - - networking = { - domain = "mydadleft.me"; - hostName = "p-body"; - }; - - services = { - guzzle-api = { - enable = true; - url = "https://api." + config.networking.domain; - port = "8080"; - package = guzzle_api.packages.x86_64-linux.guzzle-api-server; - }; - }; - - systemd.network = { - enable = true; - networks."10-wan" = { - matchConfig.Name = "enp1s0"; - networkConfig.DHCP = "ipv4"; - address = [ - "2a01:4ff:f0:eb52::1/64" - ]; - routes = [ - {routeConfig.Gateway = "fe80::1";} - ]; - }; - }; - - swapDevices = [ - { - device = "/swapfile"; - size = 8192; - } - ]; - - users.users.p-body = { - isNormalUser = true; - shell = pkgs.bash; - passwordFile = config.age.secrets.userPassword.path; - }; - - zramSwap.enable = true; -} diff --git a/hosts/p-body/grafana.nix b/hosts/p-body/grafana.nix deleted file mode 100644 index dcc97d1..0000000 --- a/hosts/p-body/grafana.nix +++ /dev/null @@ -1,25 +0,0 @@ -{config, ...}: let - inherit (config.networking) domain; -in { - services.grafana = { - enable = true; - settings = { - "auth.anonymous" = { - enabled = true; - hide_version = true; - org_name = "getchoosystems"; - org_role = "Viewer"; - }; - - server = { - http_addr = "127.0.0.1"; - http_port = 4000; - domain = "grafana.${domain}"; - }; - - feature_toggles = { - publicDashboards = true; - }; - }; - }; -} diff --git a/hosts/p-body/hardware-configuration.nix b/hosts/p-body/hardware-configuration.nix deleted file mode 100644 index 850ec8f..0000000 --- a/hosts/p-body/hardware-configuration.nix +++ /dev/null @@ -1,52 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ - lib, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; - - boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = []; - boot.extraModulePackages = []; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/ab44c979-e1b4-4af2-bdc6-2b2f2ee608bf"; - fsType = "btrfs"; - options = ["subvol=root" "noatime" "compress=zstd"]; - }; - - fileSystems."/home" = { - device = "/dev/disk/by-uuid/ab44c979-e1b4-4af2-bdc6-2b2f2ee608bf"; - fsType = "btrfs"; - options = ["subvol=home" "noatime" "compress=zstd"]; - }; - - fileSystems."/var/log" = { - device = "/dev/disk/by-uuid/ab44c979-e1b4-4af2-bdc6-2b2f2ee608bf"; - fsType = "btrfs"; - options = ["subvol=var_log" "noatime" "compress=zstd"]; - }; - - fileSystems."/nix" = { - device = "/dev/disk/by-uuid/ab44c979-e1b4-4af2-bdc6-2b2f2ee608bf"; - fsType = "btrfs"; - options = ["subvol=nix" "noatime" "compress=zstd"]; - }; - - swapDevices = []; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; -} diff --git a/hosts/p-body/loki.nix b/hosts/p-body/loki.nix deleted file mode 100644 index 84bb887..0000000 --- a/hosts/p-body/loki.nix +++ /dev/null @@ -1,80 +0,0 @@ -{config, ...}: { - networking.firewall.allowedTCPPorts = [config.services.loki.configuration.server.http_listen_port]; - - services.loki = { - enable = true; - configuration = { - server.http_listen_port = 3030; - auth_enabled = false; - - ingester = { - lifecycler = { - address = "127.0.0.1"; - ring = { - kvstore = { - store = "inmemory"; - }; - replication_factor = 1; - }; - }; - chunk_idle_period = "1h"; - max_chunk_age = "1h"; - chunk_target_size = 999999; - chunk_retain_period = "30s"; - max_transfer_retries = 0; - }; - - schema_config = { - configs = [ - { - from = "2022-06-06"; - store = "boltdb-shipper"; - object_store = "filesystem"; - schema = "v11"; - index = { - prefix = "index_"; - period = "24h"; - }; - } - ]; - }; - - storage_config = { - boltdb_shipper = { - active_index_directory = "/var/lib/loki/boltdb-shipper-active"; - cache_location = "/var/lib/loki/boltdb-shipper-cache"; - cache_ttl = "24h"; - shared_store = "filesystem"; - }; - - filesystem = { - directory = "/var/lib/loki/chunks"; - }; - }; - - limits_config = { - reject_old_samples = true; - reject_old_samples_max_age = "168h"; - }; - - chunk_store_config = { - max_look_back_period = "0s"; - }; - - table_manager = { - retention_deletes_enabled = false; - retention_period = "0s"; - }; - - compactor = { - working_directory = "/var/lib/loki"; - shared_store = "filesystem"; - compactor_ring = { - kvstore = { - store = "inmemory"; - }; - }; - }; - }; - }; -} diff --git a/hosts/p-body/nginx.nix b/hosts/p-body/nginx.nix deleted file mode 100644 index d52473c..0000000 --- a/hosts/p-body/nginx.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - config, - self, - ... -}: let - inherit (config.networking) domain; - inherit (self.lib.utils.nginx) mkProxy mkVHosts; -in { - server = { - acme.enable = true; - services.cloudflared.enable = true; - }; - - services.nginx = { - enable = true; - - recommendedGzipSettings = true; - recommendedOptimisation = true; - recommendedProxySettings = true; - recommendedTlsSettings = true; - - virtualHosts = mkVHosts { - "api.${domain}" = { - locations = mkProxy "/" "8080"; - }; - - "grafana.${domain}" = { - locations = mkProxy "/" "4000"; - }; - }; - }; -} diff --git a/hosts/p-body/p-body2atlas.pub b/hosts/p-body/p-body2atlas.pub deleted file mode 100644 index 100f9ab..0000000 --- a/hosts/p-body/p-body2atlas.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOtbxHjDADxqsG+AgCoiDq0uCsgcnJCIH+9rB6K5pIi9 p-body@p-body diff --git a/hosts/p-body/victoriametrics.nix b/hosts/p-body/victoriametrics.nix deleted file mode 100644 index dec893e..0000000 --- a/hosts/p-body/victoriametrics.nix +++ /dev/null @@ -1,26 +0,0 @@ -{config, ...}: let - mkScrapes = let - mkConfig = client: { - job_name = "${client}"; - static_configs = [ - { - targets = [ - "${client}:${toString config.services.prometheus.exporters.node.port}" - ]; - } - ]; - }; - in - builtins.map mkConfig; -in { - services = { - victoriametrics.enable = true; - - vmagent = { - enable = true; - prometheusConfig = { - scrape_configs = mkScrapes ["p-body" "atlas"]; - }; - }; - }; -} -- cgit v1.2.3