buz support

This commit is contained in:
ari committed 2026-09-20 20:13:39 -04:00
1 parent 5d727c26cd
commit beb83f21b3
13 files changed
+397 -42

No files matched your search

+14 -14
View File
@@ -20,20 +20,20 @@ hosts/
## Managed Hosts
| File | Host | Role |
|---|---|---|
| `fwbook.nix` | fwbook | Framework 13 AMD — personal laptop / daily driver |
| `hl-fwdesk.nix` | hl-fwdesk | Framework Desktop AI Max 300 — AI workstation |
| `hl-fws1.nix` | hl-fws1 | Framework 11th Intel — K3s server node |
| `hl-bigbox1.nix` | hl-bigbox1 | AI/compute server (NVIDIA + AMD) |
| `hl-bigbox2.nix` | hl-bigbox2 | NFS storage server |
| `hl-minipc1.nix` | hl-minipc1 | Core infra: Gitea, nix-serve, Docker registry |
| `hl-minipc2.nix` | hl-minipc2 | Container/media server |
| `hl-minipc3.nix` | hl-minipc3 | K3s worker node |
| `hl-pi1.nix` | hl-pi1 | Raspberry Pi CM4 (aarch64) — headless server, SSH only. Also buildable as a bootable SD image via the `hl-pi1-sd-image` nixosConfiguration (`skyg build-pi-sd-image`) |
| `hl-pi2.nix` | hl-pi2 | Raspberry Pi 4 (aarch64) — headless server, SSH only. Also buildable as a bootable SD image via the `hl-pi2-sd-image` nixosConfiguration |
| `hl-terra1.nix` | hl-terra1 | NFS storage + Jellyfin backup |
| `iso.nix` | iso | Bootable NixOS installer image |
| File | Host | Role |
| ---------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `fwbook.nix` | fwbook | Framework 13 AMD — personal laptop / daily driver |
| `hl-fwdesk.nix` | hl-fwdesk | Framework Desktop AI Max 300 — AI workstation |
| `hl-fws1.nix` | hl-fws1 | Framework 11th Intel — K3s server node |
| `hl-bigbox1.nix` | hl-bigbox1 | AI/compute server (NVIDIA + AMD) |
| `hl-bigbox2.nix` | hl-bigbox2 | NFS storage server |
| `hl-minipc1.nix` | hl-minipc1 | Core infra: Gitea, nix-serve, registry, Buzz (podman) |
| `hl-minipc2.nix` | hl-minipc2 | Container/media server |
| `hl-minipc3.nix` | hl-minipc3 | K3s worker node |
| `hl-pi1.nix` | hl-pi1 | Raspberry Pi CM4 (aarch64) — headless server, SSH only. Also buildable as a bootable SD image via the `hl-pi1-sd-image` nixosConfiguration (`skyg build-pi-sd-image`) |
| `hl-pi2.nix` | hl-pi2 | Raspberry Pi 4 (aarch64) — headless server, SSH only. Also buildable as a bootable SD image via the `hl-pi2-sd-image` nixosConfiguration |
| `hl-terra1.nix` | hl-terra1 | NFS storage + Jellyfin backup |
| `iso.nix` | iso | Bootable NixOS installer image |
## Rules
@@ -14,22 +14,14 @@
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/142c88f4-b1bc-4ed9-92ee-2c52cdfa4274";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/01FE-EDCC";
fsType = "vfat";
};
# Data
# fileSystems."/mnt/Data" = {
# device = "/dev/disk/by-uuid/ee4a60a8-b0d1-4f5c-a554-1d1d84c89e34";
# fsType = "ext4";
# options = [ "defaults" ];
# };
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/ee4a60a8-b0d1-4f5c-a554-1d1d84c89e34";
fsType = "ext4";
+149
View File
@@ -25,6 +25,21 @@ let
ports.ssh
ports.iu
];
# Buzz stack
buzz = {
domain = "buzz.lab.internal";
port = 3000;
ip = "10.0.101.3";
bucket = "buzz-media";
};
# NFS-backed volume on tnas1 (repo pattern: compose volume with nfs driver_opts).
nfsVolume = subpath: {
driver_opts = {
type = "nfs";
o = "addr=tnas1.lab.internal,rw,nfsvers=4.0,nolock,hard,noatime";
device = ":/mnt/SmallG/buzz/${subpath}";
};
};
in
{
skyg.user.enable = true;
@@ -34,7 +49,17 @@ in
openFirewall = true;
addressesSecretName = "dns-addresses.conf";
};
skyg.nixos.common.containers.runtime = "podman";
skyg.nixos.common.containers.openMetricsPort = true;
# One shared macvlan network, created once at boot.
skyg.nixos.common.containers.networks.lab = {
driver = "macvlan";
driverOpts.parent = "eno1";
subnet = "10.0.0.0/16";
gateway = "10.0.0.1";
ipRange = "10.0.101.16/28";
};
skyg.server.admin.enable = true;
skyg.server.exporters.enable = true;
skyg.nixos.server.k3s.enable = false;
@@ -199,6 +224,130 @@ in
};
};
# Buzz — relay + postgres + redis + garage (S3). Reachable at
# http://buzz.lab.internal:3000 on its own macvlan IP (10.0.101.3).
# Data lives on tnas1 via NFS-backed compose volumes (/mnt/SmallG/buzz).
age.secrets.buzz-env.file = ../secrets/buzz-env.age;
skyg.nixos.common.container-services.buzz = {
enable = true;
autoUpdate.enable = true;
networks = {
internal = { driver = "bridge"; };
# Shared macvlan network created by skyg.nixos.common.containers.networks.lab.
lan = config.skyg.nixos.common.containers.networks.lab.compose;
};
volumes = {
buzz-postgres = nfsVolume "postgres";
buzz-redis = nfsVolume "redis";
buzz-garage = nfsVolume "garage";
buzz-git = nfsVolume "git";
};
services = {
relay = {
image = "ghcr.io/block/buzz:main";
dependsOn = [ "postgres" "redis" "garage" ];
networks = {
internal = { };
lan = { ipv4_address = buzz.ip; };
};
environmentFiles = [ config.age.secrets.buzz-env.path ];
environment = {
BUZZ_BIND_ADDR = "0.0.0.0:${toString buzz.port}";
BUZZ_HEALTH_PORT = "8080";
BUZZ_METRICS_PORT = "9102";
RELAY_URL = "ws://${buzz.domain}:${toString buzz.port}";
BUZZ_MEDIA_BASE_URL = "http://${buzz.domain}:${toString buzz.port}/media";
BUZZ_MEDIA_SERVER_DOMAIN = "${buzz.domain}:${toString buzz.port}";
BUZZ_CORS_ORIGINS = "http://${buzz.domain}:${toString buzz.port}";
BUZZ_S3_ENDPOINT = "http://garage:3900";
BUZZ_S3_REGION = "garage";
BUZZ_S3_ADDRESSING_STYLE = "path";
BUZZ_S3_BUCKET = buzz.bucket;
BUZZ_GIT_REPO_PATH = "/data/git";
BUZZ_AUTO_MIGRATE = "true";
BUZZ_GIT_CONFORMANCE_PROBE = "true";
RUST_LOG = "buzz_relay=info,buzz_db=info,buzz_auth=info,buzz_pubsub=info,tower_http=info";
};
volumes = [ "buzz-git:/data/git" ];
healthcheck = {
test = [
"CMD-SHELL"
"bash -ec 'exec 3<>/dev/tcp/127.0.0.1/8080; printf \"GET /_readiness HTTP/1.1\\r\\nHost: 127.0.0.1\\r\\nConnection: close\\r\\n\\r\\n\" >&3; grep -q \"200 OK\" <&3'"
];
interval = "10s";
timeout = "3s";
retries = 12;
start_period = "30s";
};
};
postgres = {
image = "postgres:17-alpine";
networks = [ "internal" ];
environmentFiles = [ config.age.secrets.buzz-env.path ];
environment = {
POSTGRES_DB = "buzz";
POSTGRES_USER = "buzz";
};
volumes = [ "buzz-postgres:/var/lib/postgresql/data" ];
healthcheck = {
test = [ "CMD-SHELL" "pg_isready -U buzz -d buzz" ];
interval = "5s";
timeout = "5s";
retries = 12;
start_period = "10s";
};
};
redis = {
image = "redis:7-alpine";
networks = [ "internal" ];
environmentFiles = [ config.age.secrets.buzz-env.path ];
volumes = [ "buzz-redis:/data" ];
files."/usr/local/bin/redis-entrypoint.sh" = ''
#!/bin/sh
set -eu
exec redis-server --appendonly yes --requirepass "$REDIS_PASSWORD"
'';
command = [ "sh" "/usr/local/bin/redis-entrypoint.sh" ];
};
garage = {
image = "dxflrs/garage:v2.4.1";
networks = [ "internal" ];
environmentFiles = [ config.age.secrets.buzz-env.path ];
environment.GARAGE_DEFAULT_BUCKET = buzz.bucket;
volumes = [ "buzz-garage:/var/lib/garage" ];
command = [ "/garage" "server" "--single-node" "--default-bucket" ];
files."/etc/garage.toml" = ''
metadata_dir = "/var/lib/garage/meta"
data_dir = "/var/lib/garage/data"
db_engine = "sqlite"
replication_factor = 1
rpc_bind_addr = "[::]:3901"
rpc_public_addr = "127.0.0.1:3901"
[s3_api]
s3_region = "garage"
api_bind_addr = "[::]:3900"
root_domain = ".s3.garage.localhost"
'';
healthcheck = {
test = [ "CMD" "/garage" "status" ];
interval = "30s";
timeout = "10s";
retries = 5;
start_period = "20s";
};
};
};
};
# Certbot TLS service
skyg.server.dns.certbot = {
enable = false;