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: nginx support #84446

Merged
merged 1 commit into from Jul 16, 2021
Merged

nixos/wordpress: nginx support #84446

merged 1 commit into from Jul 16, 2021

Conversation

eonpatapon
Copy link
Contributor

Motivation for this change

To be able to combine worpress with other modules that are using nginx.

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/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@c0deaddict
Copy link
Member

c0deaddict commented Feb 2, 2021

Nice work! I'm currently running my own patched version of wordpress on Nginx (https://github.com/c0deaddict/nur-packages/blob/master/modules/wordpress/default.nix) Your changes look much better 👍 I especially like the switch for httpd or nginx. Would be nice to have this included in nixos-unstable.

@aanderse
Copy link
Member

aanderse commented Feb 2, 2021

Does anyone use the httpd version of this module?

@mohe2015
Copy link
Contributor

mohe2015 commented Feb 2, 2021

No, but if this should become a breaking change I would love to get some of #96910 in there (I can work on that if this pull request will become nginx support only but I should probably do this before it gets merged)

@eonpatapon
Copy link
Contributor Author

Hi thanks for the interest, it's been a long time.

The one thing that bothered me is how to handle the migration to theses new options. It doesn't seem possible to do it without breakage :/

@expipiplus1
Copy link
Contributor

expipiplus1 commented Apr 12, 2021

Is it possible for them to coexist in nixpkgs, once that's done then the httpshttpd version can be deprecated if necessary.

@aanderse
Copy link
Member

@FPtje was using this module with httpd at one point. Any input @FPtje?

@expipiplus1
Copy link
Contributor

expipiplus1 commented Apr 13, 2021 via email

@eonpatapon
Copy link
Contributor Author

When I say it will break existing configuration it's because originally the module options are:

services.wordpress = {
   my-site = { ... };
   ...
};

With theses changes the interface is now:

services.wordpress = {
   webserver = "httpd";
   sites = {
      my-site = { ... };
      ...
   };
};

@mohe2015
Copy link
Contributor

mohe2015 commented Apr 13, 2021

@eonpatapon This would be really stupid but you could try to put the webserver option inside each site (so it would be per site). But I don't know if that's worth it and also people would probably forget to update it. But then we could default it to nginx on a specific stateVersion if we want to.

@aanderse
Copy link
Member

I'm sorry, I forgot this actually left httpd support around... I thought it replaced, not added.

@expipiplus1
Copy link
Contributor

expipiplus1 commented Apr 13, 2021 via email

@eonpatapon
Copy link
Contributor Author

eonpatapon commented Apr 13, 2021

@expipiplus1 do you have something in mind where this has already been done ?

@mohe2015
Copy link
Contributor

I just thought a bit about my wordpress improvements PR (#96910) and I think the following change may be benefical to do in a separate commit:
229d6a5?w=1
(it would also need to be adapted for nginx and the documentation would need to be updated).

This would be a breaking change if somebody relies on accessing the attributes directly. But as there is a virtualHost attribute currently I think this is unlikely. Still this would need to be discussed before.

Another idea would be to just fix the virtualHost attribute to work with nginx also (or add an attribute ${webserver}.virtualHost) so we could change this in the future transparently. This may be easier to get merged rather soonish than the other idea.

@mohe2015
Copy link
Contributor

mohe2015 commented May 29, 2021

The idea would be something like mohe2015@84dd0e1

What do you think?

@mohe2015
Copy link
Contributor

@eonpatapon friendly ping

@eonpatapon
Copy link
Contributor Author

@mohe2015 do you mean importing the commit you mention in this PR ?

@mohe2015
Copy link
Contributor

mohe2015 commented Jun 18, 2021

@mohe2015 do you mean importing the commit you mention in this PR ?

Yeah but first what you think about the change (also adding the virtualHost attribute for nginx). I would like to have it to be able to change the nginx service name later (in my other PR) which may be needed but I'm not sure. I think this just hides the implementation details which also may be beneficial and makes usage a little bit better IMO

@eonpatapon
Copy link
Contributor Author

@mohe2015 About the virtualHost attribute for nginx, I'm not sure this is a common pattern. Usually high level modules make use of low level modules and if you want to do some more configuration on the low level module you can do it directly using it's interface.

For the PR I will have a look and comment there

@mohe2015
Copy link
Contributor

mohe2015 commented Jun 18, 2021

@mohe2015 About the virtualHost attribute for nginx, I'm not sure this is a common pattern. Usually high level modules make use of low level modules and if you want to do some more configuration on the low level module you can do it directly using it's interface.

I would claim that changing things like enabling acme or ssl are pretty common.
Another option I would be fine with would be to prepend "wordpress-" or "wordpress-nginx-" or so to the service name.

For the PR I will have a look and comment there

I'm not sure if it would really break but I assume if:
you have a wordpress service:
a.example.org
And you want to move a.example.org to b.example.org and move another webservice to a.example.org (with nginx service name "a.example.org")
Then the service names would clash and this would probably break stuff.
The assumption is that you can't change the wordpress service name as then the directory would change. So either I think the nginx service name should be based on the actual current hostname or it would probably need a prefix.

@nlewo
Copy link
Member

nlewo commented Jul 8, 2021

It would be nice to move forward on this PR which is in a pretty good shape:

  • Several people like the idea and its implementation,
  • Nobody is complaining,
  • Backward compatibility is supported,
  • A warning is emitted explaining how to migrate to the new interface,
  • Tests are passing.

@eonpatapon could you add a release note mentionning the wordpress implementation change and explaining the backward compatibility will be removed for 22.05.
You should also rebase it on master to check tests are still green.

@mohe2015 I think the current implementation of this PR is an improvement and there is a consensus on it. So, we could move forward on it and continue to discuss on other improvements in some followups PRs.

@AndersonTorres @aanderse @mmilata as previous wordpress module contributors, do you see any issue with these changes? Ideally, do you approve it? :)

I would then propose to wait for 1 week more (once my requested changes are applied) and if nobody complains, merge it.
What do you think?

@eonpatapon
Copy link
Contributor Author

@nlewo thanks for the review! I've rebased and added some release notes

Copy link
Member

@nlewo nlewo left a comment

Choose a reason for hiding this comment

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

@eonpatapon thx!

So, if nobody complains, i will merge it on Friday 16/07.

@AndersonTorres
Copy link
Member

Wordpress? Me? Strange, I do not remember that.

The latest thing I have relinquished was XFCE small tools.
Anyway, good.

@nlewo
Copy link
Member

nlewo commented Jul 10, 2021

@AndersonTorres arf, excuse me! I actually wanted to ping @aanderse.

@aanderse
Copy link
Member

@nlewo i only ever touched wordpress code in an effort to cleanup apache-httpd, so I'm not much of an interested party.

@nlewo
Copy link
Member

nlewo commented Jul 16, 2021

@GrahamcOfBorg test wordpress

@nlewo
Copy link
Member

nlewo commented Jul 16, 2021

Thanks @eonpatapon !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants