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/wordpress: caddy support #132663

Merged
merged 1 commit into from
Sep 17, 2021
Merged

nixos/wordpress: caddy support #132663

merged 1 commit into from
Sep 17, 2021

Conversation

onny
Copy link
Contributor

@onny onny commented Aug 4, 2021

Motivation for this change

Adds caddy web server support to wordpress module which already supports httpd and nginx. Since most of the restructuring was already done by adding nginx support here, this PR is quite reasonable.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Relase 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.

@github-actions github-actions bot added 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/` labels Aug 4, 2021
@onny onny force-pushed the wordpress-caddy branch from 9849e6a to c5e7f5b Compare August 4, 2021 14:11
@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 Aug 4, 2021
@onny
Copy link
Contributor Author

onny commented Aug 4, 2021

Don't know how to fix the NixOS manual checks :(

@mohe2015
Copy link
Contributor

mohe2015 commented Aug 4, 2021

Don't know how to fix the NixOS manual checks :(

Just run nixos/doc/manual/md-to-db.sh

@onny onny force-pushed the wordpress-caddy branch from 284af5b to 3bb3513 Compare August 5, 2021 20:29
@onny onny requested a review from nlewo August 5, 2021 20:51
@happysalada
Copy link
Contributor

One small thing, I'm trying to add the ability for caddy to merge multiple configs.
The idea being that if you enable caddy, it wouldn't override your config and you could just merge everything.
You might be interested by the PR #134384
It might affect slightly your PR.

@happysalada
Copy link
Contributor

That PR has just been merged. There is now a virtualHosts option in caddy that works in the following way

caddy.virtualHosts."http://hostname" = {
   serverAliases = [ "www.hostname" ]; (optional)
   extraConfig = ''
          root    * /${pkg hostName cfg}/share/wordpress
          file_server
          php_fastcgi unix/${config.services.phpfpm.pools."wordpress-${hostName}".socket}
          @uploads {
            path_regexp path /uploads\/(.*)\.php
          }
          rewrite @uploads /
          @wp-admin {
            path  not ^\/wp-admin/*
          }
          rewrite @wp-admin {path}/index.php?{query}
   ''
};

basically at the moment everything is dumped into extraConfig. I'm open to feedback on what to options to extract from caddy users.
If you don't mind rebasing, I can help you get this merged.
(the one advantage of having the virtualhosts is that now caddy config is merged and not overridden, so caddy users can use caddy to expose other things).

@onny
Copy link
Contributor Author

onny commented Sep 17, 2021

If you don't mind rebasing, I can help you get this merged.
(the one advantage of having the virtualhosts is that now caddy config is merged and not overridden, so caddy users can use caddy to expose other things).

Thank you for the info and for your work! I rebased this PR and it should work now 👍

@onny onny requested review from flokli and mmilata September 17, 2021 09:21
@happysalada
Copy link
Contributor

Thank you!

@happysalada happysalada merged commit 38431cf into NixOS:master Sep 17, 2021
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.

3 participants