feat: serve the static sites from cum-sites #22

Merged
marti merged 3 commits from feature/sites-nginx into main 2026-10-17 12:59:45 +02:00
Owner

Summary

The static sites move off cum-services onto cum-sites, which now runs its own nginx with one plain-HTTP port per site. cum-services keeps TLS and proxies to them like any other service.

flowchart LR
    CF[Cloudflare] --> S["cum-services nginx (TLS)"]
    S -->|":8001"| M["cum-sites nginx: /var/www/dev.m4rti"]
    S -->|":8002"| V["cum-sites nginx: /var/www/com.cumsek.silvia"]
 cum.nix  hosts.sites.services
+  m4rti.port = 8001;
+  silvia = { port = 8002; domain = "silvia"; };

 cum-services nginx virtualHosts
-  "m4rti.dev"         = { root = "/var/www/m4rti"; ... };
-  "silvia.cumsek.com" = { addSSL = true; root = "/var/www/silvia"; };
+  "m4rti.dev"         = proxyTo "sites" "m4rti";
+  # silvia.cumsek.com is now generated from its cum.nix `domain`
  • The m4rti.dev cache headers (css/js/woff2) moved with the site to cum-sites.
  • cum-sites trusts X-Forwarded-For from cum-services so its logs show the real client IP.
  • silvia.cumsek.com goes from addSSL to forceSSL, matching every other vhost.

Evidence

  • Before: cum-services vhosts serve root = /var/www/m4rti and /var/www/silvia; cum-sites has no nginx.
    After: nix eval of cum-services vhosts:
    {"m4rti.dev":{"forceSSL":true,"p":"http://192.168.1.204:8001","root":null},
     "silvia.cumsek.com":{"forceSSL":true,"p":"http://192.168.1.204:8002","root":null}}
    
    and of cum-sites vhosts: m4rti.dev on 8001 rooted at /var/www/dev.m4rti, silvia.cumsek.com on 8002 rooted at /var/www/com.cumsek.silvia.
  • nix build .#nixosConfigurations.{cum-services,cum-sites}.config.system.build.toplevel succeeds for both.

Merge Danger

Door: two-way

Revert and redeploy cum-services restores the old vhosts, as long as the old /var/www dirs on cum-services are not deleted until the new setup is confirmed.

Blast Radius: two-sites

The site files are not managed by Nix. Deploy order matters or both sites 502:

  1. Deploy cum-sites.
  2. Copy /var/www/m4rti -> cum-sites /var/www/dev.m4rti, and /var/www/silvia -> /var/www/com.cumsek.silvia.
  3. curl 192.168.1.204:8001 and :8002.
  4. Deploy cum-services.

🤖 Generated with Claude Code

## Summary The static sites move off cum-services onto cum-sites, which now runs its own nginx with one plain-HTTP port per site. cum-services keeps TLS and proxies to them like any other service. ```mermaid flowchart LR CF[Cloudflare] --> S["cum-services nginx (TLS)"] S -->|":8001"| M["cum-sites nginx: /var/www/dev.m4rti"] S -->|":8002"| V["cum-sites nginx: /var/www/com.cumsek.silvia"] ``` ```diff cum.nix hosts.sites.services + m4rti.port = 8001; + silvia = { port = 8002; domain = "silvia"; }; cum-services nginx virtualHosts - "m4rti.dev" = { root = "/var/www/m4rti"; ... }; - "silvia.cumsek.com" = { addSSL = true; root = "/var/www/silvia"; }; + "m4rti.dev" = proxyTo "sites" "m4rti"; + # silvia.cumsek.com is now generated from its cum.nix `domain` ``` - The m4rti.dev cache headers (css/js/woff2) moved with the site to cum-sites. - cum-sites trusts `X-Forwarded-For` from cum-services so its logs show the real client IP. - silvia.cumsek.com goes from `addSSL` to `forceSSL`, matching every other vhost. ## Evidence - **Before:** cum-services vhosts serve `root = /var/www/m4rti` and `/var/www/silvia`; cum-sites has no nginx. **After:** `nix eval` of cum-services vhosts: ```json {"m4rti.dev":{"forceSSL":true,"p":"http://192.168.1.204:8001","root":null}, "silvia.cumsek.com":{"forceSSL":true,"p":"http://192.168.1.204:8002","root":null}} ``` and of cum-sites vhosts: m4rti.dev on 8001 rooted at `/var/www/dev.m4rti`, silvia.cumsek.com on 8002 rooted at `/var/www/com.cumsek.silvia`. - `nix build .#nixosConfigurations.{cum-services,cum-sites}.config.system.build.toplevel` succeeds for both. ## Merge Danger **Door:** two-way Revert and redeploy cum-services restores the old vhosts, as long as the old `/var/www` dirs on cum-services are not deleted until the new setup is confirmed. **Blast Radius:** two-sites The site files are not managed by Nix. Deploy order matters or both sites 502: 1. Deploy cum-sites. 2. Copy `/var/www/m4rti` -> cum-sites `/var/www/dev.m4rti`, and `/var/www/silvia` -> `/var/www/com.cumsek.silvia`. 3. `curl 192.168.1.204:8001` and `:8002`. 4. Deploy cum-services. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Each static site gets a plain-HTTP port on cum-sites (m4rti.dev on 8001,
silvia.cumsek.com on 8002) so cum-services can proxy to them instead of
serving directories off its own disk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
m4rti.dev becomes a proxyTo like the other non-cumsek domains, and
silvia now declares its domain in cum.nix so its vhost is generated.
That also moves silvia from addSSL to forceSSL, matching every other
vhost. The cache headers moved with the files to cum-sites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
marti merged commit 16fe9e216c into main 2026-10-17 12:59:45 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cumsek/nix!22
No description provided.