feat(nimbolus): init a http terraform backend
All checks were successful
Check meta / check_dns (pull_request) Successful in 15s
Check workflows / check_workflows (pull_request) Successful in 18s
Check meta / check_meta (pull_request) Successful in 18s
Run pre-commit on all files / pre-commit (push) Successful in 27s
Build all the nodes / Jaccess01 (pull_request) Successful in 28s
Build all the nodes / Jaccess04 (pull_request) Successful in 28s
Build all the nodes / netcore01 (pull_request) Successful in 27s
Run pre-commit on all files / pre-commit (pull_request) Successful in 33s
Build all the nodes / ap01 (pull_request) Successful in 41s
Build all the nodes / netcore02 (pull_request) Successful in 26s
Build all the nodes / bridge01 (pull_request) Successful in 59s
Build all the nodes / geo02 (pull_request) Successful in 59s
Build all the nodes / hypervisor03 (pull_request) Successful in 1m4s
Build all the nodes / lab-router01 (pull_request) Successful in 1m4s
Build all the nodes / hypervisor02 (pull_request) Successful in 1m4s
Build all the nodes / hypervisor01 (pull_request) Successful in 1m8s
Build all the nodes / geo01 (pull_request) Successful in 1m8s
Build all the nodes / cof02 (pull_request) Successful in 1m9s
Build all the nodes / build01 (pull_request) Successful in 1m10s
Build all the nodes / iso (pull_request) Successful in 1m9s
Build all the nodes / tower01 (pull_request) Successful in 50s
Build all the nodes / vault01 (pull_request) Successful in 1m2s
Build all the nodes / rescue01 (pull_request) Successful in 1m11s
Build the shell / build-shell (pull_request) Successful in 31s
Build all the nodes / web02 (pull_request) Successful in 50s
Build all the nodes / krz01 (pull_request) Successful in 1m43s
Build all the nodes / web01 (pull_request) Successful in 1m15s
Build all the nodes / web03 (pull_request) Successful in 1m3s
Build all the nodes / zulip01 (pull_request) Successful in 47s
Build all the nodes / storage01 (pull_request) Successful in 1m37s
Build all the nodes / compute01 (pull_request) Successful in 2m27s
All checks were successful
Check meta / check_dns (pull_request) Successful in 15s
Check workflows / check_workflows (pull_request) Successful in 18s
Check meta / check_meta (pull_request) Successful in 18s
Run pre-commit on all files / pre-commit (push) Successful in 27s
Build all the nodes / Jaccess01 (pull_request) Successful in 28s
Build all the nodes / Jaccess04 (pull_request) Successful in 28s
Build all the nodes / netcore01 (pull_request) Successful in 27s
Run pre-commit on all files / pre-commit (pull_request) Successful in 33s
Build all the nodes / ap01 (pull_request) Successful in 41s
Build all the nodes / netcore02 (pull_request) Successful in 26s
Build all the nodes / bridge01 (pull_request) Successful in 59s
Build all the nodes / geo02 (pull_request) Successful in 59s
Build all the nodes / hypervisor03 (pull_request) Successful in 1m4s
Build all the nodes / lab-router01 (pull_request) Successful in 1m4s
Build all the nodes / hypervisor02 (pull_request) Successful in 1m4s
Build all the nodes / hypervisor01 (pull_request) Successful in 1m8s
Build all the nodes / geo01 (pull_request) Successful in 1m8s
Build all the nodes / cof02 (pull_request) Successful in 1m9s
Build all the nodes / build01 (pull_request) Successful in 1m10s
Build all the nodes / iso (pull_request) Successful in 1m9s
Build all the nodes / tower01 (pull_request) Successful in 50s
Build all the nodes / vault01 (pull_request) Successful in 1m2s
Build all the nodes / rescue01 (pull_request) Successful in 1m11s
Build the shell / build-shell (pull_request) Successful in 31s
Build all the nodes / web02 (pull_request) Successful in 50s
Build all the nodes / krz01 (pull_request) Successful in 1m43s
Build all the nodes / web01 (pull_request) Successful in 1m15s
Build all the nodes / web03 (pull_request) Successful in 1m3s
Build all the nodes / zulip01 (pull_request) Successful in 47s
Build all the nodes / storage01 (pull_request) Successful in 1m37s
Build all the nodes / compute01 (pull_request) Successful in 2m27s
This commit is contained in:
parent
4adf9b2286
commit
41fb436140
5 changed files with 147 additions and 1 deletions
|
@ -28,6 +28,7 @@ lib.extra.mkConfig {
|
||||||
"mastodon"
|
"mastodon"
|
||||||
# "netbox"
|
# "netbox"
|
||||||
"nextcloud"
|
"nextcloud"
|
||||||
|
"nimbolus"
|
||||||
"ollama-proxy"
|
"ollama-proxy"
|
||||||
"opengist"
|
"opengist"
|
||||||
"outline"
|
"outline"
|
||||||
|
|
35
machines/nixos/compute01/nimbolus.nix
Normal file
35
machines/nixos/compute01/nimbolus.nix
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin@dgnum.eu>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
|
{ pkgs, sources, ... }:
|
||||||
|
let
|
||||||
|
host = "nimbolus.dgnum.eu";
|
||||||
|
port = 9008;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.nimbolus-tf = {
|
||||||
|
enable = true;
|
||||||
|
package = (import sources.kat-pkgs { inherit pkgs; }).nimbolus-tf-backend;
|
||||||
|
environment = {
|
||||||
|
LISTEN_ADDR = "127.0.0.1:${toString port}";
|
||||||
|
STORAGE_BACKEND = "s3";
|
||||||
|
STORAGE_S3_ENDPOINT = "s3.dgnum.eu";
|
||||||
|
STORAGE_S3_USE_SSL = "true";
|
||||||
|
STORAGE_S3_BUCKET = "monorepo-terraform-state";
|
||||||
|
|
||||||
|
# TODO: configure openBAO
|
||||||
|
# AUTH_BASIC_ENABLED = "false";
|
||||||
|
# AUTH_JWT_OIDC_ISSUER_URL = "https://vault.dgnum.eu/v1/identity/oidc";
|
||||||
|
};
|
||||||
|
secretEnvironment = {
|
||||||
|
# FIXME: use agenix and real secrets
|
||||||
|
KMS_KEY = pkgs.writeText "nimbolus-kms-unsecure" "nVbFN9o4rIP2qi0SWtcgNZlWolrF61/Drx3YxeQTSZk=";
|
||||||
|
STORAGE_S3_ACCESS_KEY = pkgs.writeText "unsecure" "KEYID";
|
||||||
|
STORAGE_S3_SECRET_KEY = pkgs.writeText "unsecure" "KEYSECRET";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
dgn-web.simpleProxies.nimbolus = {
|
||||||
|
inherit host port;
|
||||||
|
};
|
||||||
|
}
|
|
@ -82,6 +82,7 @@ let
|
||||||
"gist" # Opengist
|
"gist" # Opengist
|
||||||
"grafana" # Grafana
|
"grafana" # Grafana
|
||||||
"netbox-v2" # Netbox
|
"netbox-v2" # Netbox
|
||||||
|
"nimbolus" # Nimbolus Terraform Backend
|
||||||
"nms" # LibreNMS
|
"nms" # LibreNMS
|
||||||
"pads" # Hedgedoc
|
"pads" # Hedgedoc
|
||||||
"pass" # Vaultwarden
|
"pass" # Vaultwarden
|
||||||
|
|
|
@ -37,8 +37,9 @@
|
||||||
"dgn-web"
|
"dgn-web"
|
||||||
"django-apps"
|
"django-apps"
|
||||||
"extranix"
|
"extranix"
|
||||||
"openbao"
|
|
||||||
"forgejo-multiuser-nix-runners"
|
"forgejo-multiuser-nix-runners"
|
||||||
|
"nimbolus-tf"
|
||||||
|
"openbao"
|
||||||
])
|
])
|
||||||
++ [
|
++ [
|
||||||
"${sources.agenix}/modules/age.nix"
|
"${sources.agenix}/modules/age.nix"
|
||||||
|
|
108
modules/nixos/nimbolus-tf.nix
Normal file
108
modules/nixos/nimbolus-tf.nix
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin@dgnum.eu>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: EUPL-1.2
|
||||||
|
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
escapeShellArg
|
||||||
|
getExe
|
||||||
|
mkEnableOption
|
||||||
|
mkIf
|
||||||
|
mkOption
|
||||||
|
;
|
||||||
|
inherit (lib.types)
|
||||||
|
attrsOf
|
||||||
|
package
|
||||||
|
path
|
||||||
|
str
|
||||||
|
;
|
||||||
|
|
||||||
|
# from nixpkgs, commit b1371135b5db3fcf728114d92d5bd0218109598a
|
||||||
|
# FIXME: Should be replaced by nixpkgs lib when going to nixos-25.05
|
||||||
|
concatMapAttrsStringSep =
|
||||||
|
sep: f: attrs:
|
||||||
|
lib.concatStringsSep sep (lib.attrValues (lib.mapAttrs f attrs));
|
||||||
|
|
||||||
|
cfg = config.services.nimbolus-tf;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.nimbolus-tf = {
|
||||||
|
enable = mkEnableOption "the nimbolus terraform http backend";
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
description = ''
|
||||||
|
The hello package to use.
|
||||||
|
'';
|
||||||
|
example = "kat-pkgs.nimbolus-tf-backend";
|
||||||
|
};
|
||||||
|
environment = mkOption {
|
||||||
|
type = attrsOf str;
|
||||||
|
default = { };
|
||||||
|
description = ''
|
||||||
|
Environment variables for nimbolus configuration.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
secretEnvironment = mkOption {
|
||||||
|
type = attrsOf path;
|
||||||
|
default = { };
|
||||||
|
description = ''
|
||||||
|
Files for secret environment variables for nimbolus configuration.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
systemd.services."nimbolus-tf" = {
|
||||||
|
description = "Nimbolus terraform http backend";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
EnvironmentFile = "-/run/nimbolus-tf/env-file";
|
||||||
|
ExecStart = "${getExe cfg.package}";
|
||||||
|
ExecStartPre = "+${pkgs.writeShellScript "nimbolus-prestart" ''
|
||||||
|
echo -n > /run/nimbolus-tf/env-file
|
||||||
|
${concatMapAttrsStringSep "\n" (
|
||||||
|
key: value: "echo ${escapeShellArg "${key}=${value}"} >> /run/nimbolus-tf/env-file"
|
||||||
|
) cfg.environment}
|
||||||
|
${concatMapAttrsStringSep "\n" (
|
||||||
|
key: value: ''echo "${key}=$(cat ${value})" >> /run/nimbolus-tf/env-file''
|
||||||
|
) cfg.secretEnvironment}
|
||||||
|
chmod a+r /run/nimbolus-tf/env-file
|
||||||
|
''}";
|
||||||
|
|
||||||
|
RuntimeDirectory = "nimbolus-tf";
|
||||||
|
RuntimeDirectoryMode = "0700";
|
||||||
|
StateDirectory = "nimbolus-tf";
|
||||||
|
StateDirectoryMode = "0700";
|
||||||
|
WorkingDirectory = "/var/lib/nimbolus-tf";
|
||||||
|
|
||||||
|
# Hardening
|
||||||
|
DynamicUser = true;
|
||||||
|
CapabilityBoundingSet = "";
|
||||||
|
PrivateDevices = true;
|
||||||
|
ProtectClock = true;
|
||||||
|
ProtectKernelLogs = true;
|
||||||
|
ProtectControlGroups = true;
|
||||||
|
ProtectKernelModules = true;
|
||||||
|
RestrictNamespaces = true;
|
||||||
|
ProtectHostname = true;
|
||||||
|
LockPersonality = true;
|
||||||
|
RestrictRealtime = true;
|
||||||
|
ProtectHome = true;
|
||||||
|
ProtectProc = "noaccess";
|
||||||
|
ProcSubset = "pid";
|
||||||
|
PrivateUsers = true;
|
||||||
|
UMask = "0077";
|
||||||
|
ProtectKernelTunables = true;
|
||||||
|
RestrictAddressFamilies = "AF_INET AF_INET6";
|
||||||
|
SystemCallFilter = "~@clock @cpu-emulation @debug @module @mount @obsolete @privileged @raw-io @reboot @resources @swap";
|
||||||
|
MemoryDenyWriteExecute = true;
|
||||||
|
SystemCallArchitectures = "native";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue