Skip to content

Commit 243a2d2

Browse files
committed
feat: add Caddy TLS reverse proxy to host configs
- Enable services.caddy on both ovh-usw-1 and hzcloud-hel-1 hosts - Virtual host api.stackpanel.com with reverse_proxy to 10.0.100.11:3000 - Caddy auto-HTTPS via Let's Encrypt (ACME HTTP-01) - Open firewall ports 80 (ACME challenge) and 443 (HTTPS) on both hosts - Caddy runs on the host, not inside VMs
1 parent 269fa5f commit 243a2d2

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

nix/hosts/hzcloud-hel-1/default.nix

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ in
142142

143143
firewall = {
144144
trustedInterfaces = [ "tailscale0" "br-vms" ];
145+
# Open 80 (ACME HTTP challenge) and 443 (HTTPS) for Caddy on the host
146+
allowedTCPPorts = [ 80 443 ];
145147
};
146148

147149
# NAT: VMs reach the internet through the host's public interface
@@ -178,6 +180,21 @@ in
178180
};
179181
};
180182

183+
# ---------------------------------------------------------------------------
184+
# Caddy: TLS termination on the host, reverse-proxying to the API VM
185+
#
186+
# Caddy uses ACME (Let's Encrypt) auto-HTTPS by default.
187+
# Port 80 must be open externally for the HTTP-01 challenge.
188+
# ---------------------------------------------------------------------------
189+
services.caddy = {
190+
enable = true;
191+
virtualHosts."api.stackpanel.com" = {
192+
extraConfig = ''
193+
reverse_proxy 10.0.100.11:3000
194+
'';
195+
};
196+
};
197+
181198
# ---------------------------------------------------------------------------
182199
# microVM definitions
183200
# ---------------------------------------------------------------------------

nix/hosts/ovh-usw-1/default.nix

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ in
149149
firewall = {
150150
# Trust the VM bridge and Tailscale (inter-VM traffic unrestricted)
151151
trustedInterfaces = [ "tailscale0" "br-vms" ];
152+
# Open 80 (ACME HTTP challenge) and 443 (HTTPS) for Caddy on the host
153+
allowedTCPPorts = [ 80 443 ];
152154
};
153155

154156
# NAT: VMs reach the internet through the host's public interface
@@ -187,6 +189,21 @@ in
187189
};
188190
};
189191

192+
# ---------------------------------------------------------------------------
193+
# Caddy: TLS termination on the host, reverse-proxying to the API VM
194+
#
195+
# Caddy uses ACME (Let's Encrypt) auto-HTTPS by default.
196+
# Port 80 must be open externally for the HTTP-01 challenge.
197+
# ---------------------------------------------------------------------------
198+
services.caddy = {
199+
enable = true;
200+
virtualHosts."api.stackpanel.com" = {
201+
extraConfig = ''
202+
reverse_proxy 10.0.100.11:3000
203+
'';
204+
};
205+
};
206+
190207
# ---------------------------------------------------------------------------
191208
# microVM definitions
192209
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)