Skip to content
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/dokuwiki: Don't force http with Caddy #327743

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

lluchs
Copy link
Contributor

@lluchs lluchs commented Jul 16, 2024

Description of changes

Caddy usually expects just a hostname without scheme to do its automatic HTTPS. The dokuwiki plugin always adds http:// to the hostname, which is surprising and probably not what most users want. It is possible to get the old behavior (only HTTP) by setting services.caddy.virtualHosts.<host>.hostName.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Jul 16, 2024
@lluchs lluchs requested a review from onny July 16, 2024 21:47
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Jul 16, 2024
@onny
Copy link
Contributor

onny commented Sep 6, 2024

this really makes sense to me. would it be possible to somehow deprecate the old behaviour and add a warning while upgrading? so that we won't break the behaviour with the next release and add a deprecation warning

Copy link
Member

@FliegendeWurst FliegendeWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe mention it in the release notes for 25.05

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Dec 4, 2024
Caddy usually expects just a hostname without scheme to do its automatic
HTTPS.  It is possible to get the old behavior (only HTTP) by setting
`services.caddy.virtualHosts.<host>.hostName`.
@lluchs lluchs force-pushed the dokuwiki-caddy-http branch from fe8462a to 7e06be5 Compare December 9, 2024 11:05
@github-actions github-actions bot added 8.has: documentation This PR adds or changes documentation 8.has: changelog labels Dec 9, 2024
@lluchs
Copy link
Contributor Author

lluchs commented Dec 9, 2024

I rebased the commit now and added an entry to the release notes.

@wegank wegank removed the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Dec 9, 2024
@FliegendeWurst FliegendeWurst merged commit 27aef3e into NixOS:master Dec 12, 2024
40 checks passed
@onny
Copy link
Contributor

onny commented Jan 5, 2025

Somehow NixOS tests with Caddy fail on master, also nixosTests.dokuwiki.

Here's my fix #371205

Probably we'll have to do this for Dokuwiki module too?

@lluchs
Copy link
Contributor Author

lluchs commented Jan 7, 2025

The test is failing because of invalid default logging configuration from the caddy module:

vm-test-run-dokuwiki> dokuwiki_caddy # [   18.521644] caddy[936]: {"level":"info","ts":1736252076.087641,"msg":"using config from file","file":"/etc/caddy/caddy_config"}
vm-test-run-dokuwiki> dokuwiki_caddy # [   18.538640] caddy[936]: {"level":"info","ts":1736252076.1057036,"msg":"adapted config to JSON","adapter":"caddyfile"}
vm-test-run-dokuwiki> dokuwiki_caddy # [   18.546695] caddy[936]: Error: loading initial config: loading new config: setting up custom log 'log0': opening log writer using &logging.FileWriter{Filename:"/var/log/caddy/access-http://site1.local.log", Mode:0
x0, Roll:(*bool)(nil), RollSizeMB:0, RollCompress:(*bool)(nil), RollLocalTime:false, RollKeep:0, RollKeepDays:0}: open /var/log/caddy/access-http://site1.local.log: no such file or directory
vm-test-run-dokuwiki> dokuwiki_caddy # [   18.561471] systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE

I bisected the test failure and found 7c52e7a as the first bad commit. Looks like previous caddy versions ignored errors while opening the log file. I think this should be fixed in the caddy module so that it does not generate invalid configuration.

@stepbrobd
Copy link
Member

Seems like an upstream regression caddyserver/caddy#6766

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants