From cc613ba7b9cb356aa9742cf570627be182930f55 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Tue, 20 Feb 2024 16:33:35 +0100 Subject: [PATCH] feat(storage01): Deploy influxdb2 on influx.dgnum.eu --- machines/storage01/_configuration.nix | 1 + machines/storage01/influxdb.nix | 47 ++++++++++++++++++ .../secrets/influxdb2-initial_password_file | 29 +++++++++++ .../secrets/influxdb2-initial_token_file | 28 +++++++++++ .../secrets/influxdb2-telegraf_token_file | Bin 0 -> 1547 bytes machines/storage01/secrets/secrets.nix | 3 ++ 6 files changed, 108 insertions(+) create mode 100644 machines/storage01/influxdb.nix create mode 100644 machines/storage01/secrets/influxdb2-initial_password_file create mode 100644 machines/storage01/secrets/influxdb2-initial_token_file create mode 100644 machines/storage01/secrets/influxdb2-telegraf_token_file diff --git a/machines/storage01/_configuration.nix b/machines/storage01/_configuration.nix index 429bd13..241238b 100644 --- a/machines/storage01/_configuration.nix +++ b/machines/storage01/_configuration.nix @@ -13,6 +13,7 @@ lib.extra.mkConfig { "forgejo" "forgejo-runners" "garage" + "influxdb" "netbird" "peertube" "prometheus" diff --git a/machines/storage01/influxdb.nix b/machines/storage01/influxdb.nix new file mode 100644 index 0000000..cb80ad5 --- /dev/null +++ b/machines/storage01/influxdb.nix @@ -0,0 +1,47 @@ +{ config, ... }: + +let + secret = name: config.age.secrets."influxdb2-${name}".path; + token = user: secret "${user}_token_file"; + + host = "influx.dgnum.eu"; +in + +{ + services.influxdb2 = { + enable = true; + + provision = { + enable = true; + + organizations = { + dgnum = { + description = "DGNum org"; + buckets.telegraf.description = "Telegraf bucket"; + auths.telegraf = { + writeBuckets = [ "telegraf" ]; + tokenFile = token "telegraf"; + }; + }; + }; + + initialSetup = { + tokenFile = token "initial"; + passwordFile = secret "initial_password_file"; + organization = "main"; + bucket = "main"; + }; + }; + }; + + services.nginx.virtualHosts.${host} = { + enableACME = true; + forceSSL = true; + + locations."/" = { + proxyPass = "http://127.0.0.1:8086"; + }; + }; + + age-secrets.autoMatch = [ "influxdb2" ]; +} diff --git a/machines/storage01/secrets/influxdb2-initial_password_file b/machines/storage01/secrets/influxdb2-initial_password_file new file mode 100644 index 0000000..a9d12ed --- /dev/null +++ b/machines/storage01/secrets/influxdb2-initial_password_file @@ -0,0 +1,29 @@ +age-encryption.org/v1 +-> ssh-ed25519 rHotTw aUhvFpB9QDL+oohGVVj/Pz+GEIJ3t37mdeev+qtZ9wI +f9qJ4kuwgZSx/1RDGUEXFkxSuxmNHc52hHf3Dhb7GYA +-> ssh-ed25519 jIXfPA JFzockRIF7T73pJDbcRDnNqE0AdRIg3VJMNDrAtVW3U ++tKWVsdtT9I+XOTo4So+h+YA7BBAh+FSZme3d8Yz6Po +-> ssh-ed25519 QlRB9Q sMwPcrwBSF762n8y8v1sKI1olReLPPSMywwCVtlyBCs +BxCK6wePrK6zA8IlJfmFYvlcsDdvY4D1tOLytlUZ8g8 +-> ssh-ed25519 r+nK/Q S57xzI2QbZ0UlFAbRDHzZZLRjH6oFQOodkwAyJ5TG0M +0HCA4xsM4XlLrTxdb2JmcGUadaI+oCvJ3FOUK2FBf7E +-> ssh-rsa krWCLQ +wiIUWtOR0SgpCtZqZpeP1B+yAYyeeENBhzxG0UrmPrQXAmqoHGw0Q+HWUN/WO17O +oeBmHlmwDG4n5dpa0AXuKTHgGHa799UpguAtMoAmiQN3Q4WY/karVMMHeng+hsT0 +x5t+2yJmWyoNjVMrWFpgQknHL+pvAhuianVVSerDutEArjOMZAB6VrNdIw3gSiDu +ivQt4unOlWsv3JSeQB2TqXj3QAHLwXO1FnttWtGOp0XZXSiR395xA1MvkK9baaw8 +OGSqco1nZfZA7U4Eays0cKgKFvr52LCPfYNmFMp5Xoa58Cl/k2YVBkNao6SEVSJK +9IjeSqYTxqd3mCYszr6gAQ +-> ssh-ed25519 /vwQcQ 8jp5DvR1TKerKA1KRWjYVjh44OzT77hvxl24YGeHF0g +FNxMHUWdP/qWixbTSMZmHPLgLM2uekEoomUqqYSNYaw +-> ssh-ed25519 0R97PA QelvpAYX68iL0N5Hf6eHEidmTBkvnO6pHlYweMWU1U0 +S9S9kIovk3Hyq5t1wZb2D2EhpagfwsN+K2jEK/TEJEM +-> ssh-ed25519 JGx7Ng krXmiDkx9ZcaG2VWasNuyVzZQhd3pfevwrVY6eBBIAM +ZvZf0ZUTpw35GwTRTSLn07hioTW0iGiCGdYnqxFoSVw +-> ssh-ed25519 5SY7Kg OdYEnGDmEYfQ76PSsbA6p+3AZwkh5rDSRX+ce8uVvUE +sTzuWRNS6shGNkfy2Ke6rE3AT8iujYJ73Ub3I1LpFMQ +-> ssh-ed25519 p/Mg4Q TagIdFQ3SLwOrHbM/VO49OtYz2b1WE8ddJhuMO9IKlw +IXcm5zj1xaB0cVzKJSDeLoJ5rrqJseDK6A9uVvWWeiQ +--- CgZCjEubWqtTR4ub9uFx3ATyZsZld6QyAtgUltiSOVc + +`D5԰Զ͓EY4LCdKܵ4!Ѹw>+@" 'CAn \ No newline at end of file diff --git a/machines/storage01/secrets/influxdb2-initial_token_file b/machines/storage01/secrets/influxdb2-initial_token_file new file mode 100644 index 0000000..e6f352f --- /dev/null +++ b/machines/storage01/secrets/influxdb2-initial_token_file @@ -0,0 +1,28 @@ +age-encryption.org/v1 +-> ssh-ed25519 rHotTw 30ZnanGXmCGVx2Xu39wpdQuBo7F3B895713GnghoRhc +mgtElQ/7WD7nllSmEhamZdWsLl556x9RXatR+2Kv+/0 +-> ssh-ed25519 jIXfPA 1PRfVY+DaTCy9AsXO+PrNE+BVUB0ZFnkDESMXzYNqjo +j0uOs5MJHZ9kHGuQcu1jHuS51SivMFwLWL+7PGxENz0 +-> ssh-ed25519 QlRB9Q YZq7XswQpqtgrc+d1pTrAWWsN22QRf11Othe76HonGs +fS2EEsG8B5MjB1ncaFq16DWumnitVyYIcOP5UlifwbE +-> ssh-ed25519 r+nK/Q md6ylkhr1hR0/177il/thBy83LfnWJFxZgFYRvnNrws +kgLLVOCjmGTCg7cv+YFN70J2c9Lx9c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