Files
Gebos/nix/hosts/mqtt-ingest.nix
T
2026-06-29 17:23:02 +02:00

37 lines
1.2 KiB
Nix

{ config, lib, pkgs, ... }:
{
networking.hostName = "mqtt-ingest";
services.gebos.secrets.ingester = true;
# Broker authn/authz credentials (file-RBAC: ingester + admin MQTT users).
services.gebos.secrets.hivemq = true;
services.gebos.hivemq = {
enable = true;
# Persistent sessions on disk — single-node, devices reconnect on restart.
persistentSessions = true;
tlsPort = 8883;
};
services.gebos.ingester = {
enable = true;
# mqttBroker defaults to tcp://127.0.0.1:1883 (the local HiveMQ).
postgresUrl = "postgres://gebos_ingest@10.0.0.2:5432/postgres?sslmode=require";
# GEBOS_POSTGRES_PASSWORD sourced from /run/secrets/gebos-env (sops-nix).
};
# Caddy (layer4) terminates TLS on :8883 and forwards cleartext MQTT to
# HiveMQ's loopback listener on :1883. tcpProxy is the upstream backend.
services.gebos.caddy = {
enable = true;
sites = {
"ingest.gebos.online" = { tcpProxy = "127.0.0.1:1883"; };
};
};
# 8883: MQTTS for senders. 80/443: ACME challenge so Caddy can obtain/renew
# the ingest.gebos.online cert that the layer4 TLS handler serves.
networking.firewall.allowedTCPPorts = [ 80 443 8883 ];
}