-
Notifications
You must be signed in to change notification settings - Fork 0
moving off cloudflare #294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| let | ||
| domains = [ | ||
| "audiobookshelf" | ||
| "cache" | ||
| "gitea" | ||
| "jellyfin" | ||
| "share" | ||
| ]; | ||
|
|
||
| makeCert = name: { | ||
| name = "${name}.tmmworkshop.com"; | ||
| value = { | ||
| webroot = "/var/lib/acme/.challenges"; | ||
| group = "acme"; | ||
| reloadServices = [ "haproxy.service" ]; | ||
| }; | ||
| }; | ||
|
|
||
| acmeServices = map (domain: "acme-${domain}.tmmworkshop.com.service") domains; | ||
| in | ||
| { | ||
| users.users.haproxy.extraGroups = [ "acme" ]; | ||
|
|
||
| security.acme = { | ||
| acceptTerms = true; | ||
| defaults.email = "Richie@tmmworkshop.com"; | ||
| certs = builtins.listToAttrs (map makeCert domains); | ||
| }; | ||
|
|
||
| # Minimal nginx to serve ACME HTTP-01 challenge files for HAProxy | ||
| services.nginx = { | ||
| enable = true; | ||
| virtualHosts."acme-challenge" = { | ||
| listen = [ | ||
| { | ||
| addr = "127.0.0.1"; | ||
| port = 8402; | ||
| } | ||
| ]; | ||
| locations."/.well-known/acme-challenge/" = { | ||
| root = "/var/lib/acme/.challenges"; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| # Ensure the challenge directory exists with correct permissions | ||
| systemd.tmpfiles.rules = [ | ||
| "d /var/lib/acme/.challenges 0750 acme acme - -" | ||
| "d /var/lib/acme/.challenges/.well-known 0750 acme acme - -" | ||
| "d /var/lib/acme/.challenges/.well-known/acme-challenge 0750 acme acme - -" | ||
| ]; | ||
|
|
||
| users.users.nginx.extraGroups = [ "acme" ]; | ||
|
|
||
| # HAProxy needs certs to exist before it can bind :443. | ||
| # NixOS's acme module generates self-signed placeholders on first boot | ||
| # via acme-<domain>.service — just make HAProxy wait for them. | ||
| systemd.services.haproxy = { | ||
| after = acmeServices; | ||
| wants = acmeServices; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { lib, ... }: | ||
| { | ||
| imports = | ||
| let | ||
| files = builtins.attrNames (builtins.readDir ./.); | ||
| nixFiles = builtins.filter (name: lib.hasSuffix ".nix" name && name != "default.nix") files; | ||
| in | ||
| map (file: ./. + "/${file}") nixFiles; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: RichieCahill/dotfiles
Length of output: 977
🏁 Script executed:
cat -n systems/jeeves/services/acme.nix | head -60Repository: RichieCahill/dotfiles
Length of output: 2100
🏁 Script executed:
Repository: RichieCahill/dotfiles
Length of output: 214
🏁 Script executed:
Repository: RichieCahill/dotfiles
Length of output: 589
This breaks first-time ACME bootstrap.
Line 26 makes HAProxy require
/var/lib/acme/*/full.pemto start on:443, but those files do not exist on a fresh host until ACME succeeds. In this setup, ACME's HTTP-01 validation depends on HAProxy already serving:80and forwarding/.well-known/acme-challenge/to nginx at127.0.0.1:8402(lines 29-31, configured insystems/jeeves/services/acme.nix). This creates a circular dependency: HAProxy cannot start without the certs, and ACME cannot provision the certs without HAProxy running.A bootstrap path is needed: e.g. seed a temporary self-signed PEM, use an optional certificate binding, or provision the HTTP-01 responder on a separate listener that starts before TLS binding.
🤖 Prompt for AI Agents