-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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
nixos/caddy: introduce several new options #147973
Conversation
@@ -200,13 +268,19 @@ in | |||
group = cfg.group; |
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.
Just to question, do we lose anything here by using DynamicUser ? You don't have to do that in this PR of course, but I was wondering if we would lose anything by not defining the user entirely.
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.
I was running caddy
as DynamicUser
for a while with success. We might need to consider a few special cases, but it should probably work.
I personally don't have an issue with config being only caddyfile rather than json. I'm curious to know if there are people that use the json config. |
d264fdd
to
ebb69c2
Compare
Comments addressed, |
I've just tested this on a server. |
This looks really cool! I could take a look that modules like Dokuwiki, Wordpress and Invoiceplane gets updated to support the new options of the Caddy module.
|
Yeah, very compatible change, just adds a few new options that won't impact most people. |
@aanderse happy to merge this, but you marked this as draft. Did you have anything else in mind ? |
Was hoping to get another review before marking as ready for review... but we're really in the release cycle so I think we're good. Final review required by @m1cr0man my |
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.
Spotted a typo + have a note suggestion, but otherwise happy enough with this. I may add a test for caddy to the acme suite too (in #147784 where I refactored the tests) since this will be an "officially" supported ACME integration per se.
systemd.packages = [ cfg.package ]; | ||
systemd.services.caddy = { | ||
wants = map (hostOpts: "acme-finished-${hostOpts.useACMEHost}-.target") acmeVHosts; | ||
after = map (hostOpts: "acme-selfsigned-${hostOpts.useACMEHost}.service") acmeVHosts; | ||
before = map (hostOpts: "acme-${hostOpts.useACMEHost}.service") acmeVHosts; |
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.
👍 this is the right way to depend on acme for a web server
I've tested this PR on my config and it works well. |
ebb69c2
to
9589983
Compare
9589983
to
81a67a3
Compare
Thanks again everyone for your reviews. If anyone wants to take a final look over or kick the tires a bit I would appreciate that. Everyone fine with merging in a few days? |
Motivation for this change
I have started using
caddy
, so I added some features which I thought users coming fromhttpd
ornginx
might appreciate. Additionally,caddy
doesn't have a plugin to support my DNS provider* 😞 so I added some integration with ouracme
module so sysadmins can delegate certificate provisioning tosecurity.acme.certs
if desired/required.NOTE: If this the code in this PR is accepted there is one breaking change that will need to be carefully documented in the release notes:
services.caddy.config
(which was renamed toservices.caddy.extraConfig
) no longer accepts any syntax other thanCaddyfile
. It would be relatively trivial for users to modify theirconfiguration.nix
to account for this by using the newconfigFile
option, for which an example is already provided.* Though even if a plugin existed I wouldn't be able to compile a version of
caddy
with that plugin, or any other... more on that in a future PR/issue.This PR probably resolves #113534 and #142787.
Things done
logFormat
,logDir
, andconfigFile
optionshostName
,listenAddresses
,useACMEHost
,logFormat
options undervirtualHosts
config
->extraConfig
,ca
->acmeCA
json
in favour of a pureCaddyfile
solutionconfigFile
allows the user to continue utilizingjson
if they wishcaddy fmt
andcaddy validate
when possiblenginx
andhttpd
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes