nix-config/hosts/heather/caddy.nix
mikl 8709321ca3 heather: install jitsi meet from scratch (web/prosody/jicofo/jvb)
Fresh install per https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-docker
- Images on GHCR: ghcr.io/jitsi/*:stable-11031
- Named volumes: jitsi-{web,prosody,jicofo,jvb,transcripts}
- Network meet-jitsi (bridge) with prosody alias xmpp.meet.jitsi
- Reverse proxy mode (DISABLE_HTTPS=1), Caddy terminates TLS
- Internal auth (ENABLE_AUTH=1, AUTH_TYPE=internal)
- JVB_ADVERTISE_IPS=51.250.45.111, :10000/udp public
- Secrets NEW in /var/lib/jitsi-secrets/jitsi.env (root:docker 0640):
  JICOFO_COMPONENT_SECRET, JICOFO_AUTH_PASSWORD, JVB_AUTH_PASSWORD
- Caddy vhost jitsi.iscg.dev with /xmpp-websocket + /colibri-ws upgrade routes
- Firewall: 10000/udp (jvb). Coturn not included (optional, add later for NAT)
- No jigasi/jibri/transcriber (minimal stack)
2026-07-12 22:42:36 +03:00

108 lines
4 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# heather — Caddy как единый edge (TLS termination, reverse proxy).
#
# Заменяет Traefik (k3s built-in, отключён) и старые Caddy на iscg-dev/jul11.
# Паттерн как на iscg-dev: system Caddy, конфиг декларативно в nix.
#
# Caddy терминирует TLS на :80/:443 и роутит по Host на:
# - host-сервисы (syncthing GUI на localhost:8384) — напрямую
# - docker-контейнеры (forgejo на localhost:3030 и т.д.) — проброшенные порты
#
# ACME: пока staging (чтобы не забанили Let's Encrypt пока DNS не переведён на
# heather). Когда A-записи iscg.dev → 51.250.45.111 — переключим на production
# (убрать acme_ca, Caddy использует production LE по умолчанию).
{ config, pkgs, lib, ... }:
let
# caddy/basic-auth под паролем. hash сгенерить:
# caddy hash-password --plaintext '<password>'
# (на heather: nix-shell -p caddy --run 'caddy hash-password ...')
# Защищает syncthing GUI снаружи (GUI слушает только 127.0.0.1:8384,
# Caddy проксирует sync.iscg.dev + basicauth).
syncBasicAuth = ''
basicauth {
mikl $2a$14$ozHN9/aa4VhPX43NN8MKdODKvOoJ5MBpOUFhzkxwvb58ZI5b6eqEK
}
'';
in {
services.caddy = {
enable = true;
# DNS переведён на heather (2026-07-12). Production ACME.
# Если нужен staging обратно: раскомментировать acmeCA ниже.
# acmeCA = "https://acme-staging-v02.api.letsencrypt.org/directory";
email = "mikl@iscg.dev";
virtualHosts = {
# --- Syncthing GUI (host-сервис) ---
# header_up Host 127.0.0.1:8384 — обходим syncthing host-check (DNS
# rebinding protection): syncthing сравнивает Host header с адресом
# прослушивания (127.0.0.1:8384) и отдаёт 403 "Host check error" для
# внешних доменов. Подменяем Host на бэкенде.
"sync.iscg.dev".extraConfig = syncBasicAuth + ''
reverse_proxy 127.0.0.1:8384 {
header_up Host 127.0.0.1:8384
}
'';
# --- Контейнеры (arion, см. arion-compose.nix) ---
# Forgejo
"git.iscg.dev".extraConfig = ''
reverse_proxy 127.0.0.1:3030
'';
# Matrix tuwunel (homeserver)
"iscg.dev".extraConfig = ''
reverse_proxy 127.0.0.1:8008
encode zstd gzip
'';
# Matrix federation
"iscg.dev:8448".extraConfig = ''
reverse_proxy 127.0.0.1:8008
'';
# tuwunel-admin
"admin.iscg.dev".extraConfig = ''
reverse_proxy 127.0.0.1:8009
'';
# Cinny (matrix web client)
"chat.iscg.dev".extraConfig = ''
reverse_proxy 127.0.0.1:8080
encode zstd gzip
'';
# Jitsi Meet (web + WebSocket routes)
# Доки: https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-docker#running-behind-a-reverse-proxy
# WebSocket routes (/xmpp-websocket, /colibri-ws) — hop-by-hop, требуют
# явного Upgrade/Connection. Остальное → web контейнер на 127.0.0.1:8000.
"jitsi.iscg.dev".extraConfig = ''
@xmpp path /xmpp-websocket*
reverse_proxy @xmpp 127.0.0.1:8000 {
header_up Host {host}
header_up Upgrade {http.upgrade}
header_up Connection {http.connection}
}
@colibri path /colibri-ws*
reverse_proxy @colibri 127.0.0.1:8000 {
header_up Host {host}
header_up Upgrade {http.upgrade}
header_up Connection {http.connection}
}
reverse_proxy 127.0.0.1:8000
encode zstd gzip
'';
# Teable
"teable.iscg.dev".extraConfig = ''
reverse_proxy 127.0.0.1:2345
'';
# Silverbullet
"note.iscg.dev".extraConfig = ''
reverse_proxy 127.0.0.1:3001
'';
};
};
}