Navigation Menu

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

phpfpm service: one service per pool for isolation #22154

Merged
merged 2 commits into from Feb 27, 2017

Conversation

fpletz
Copy link
Member

@fpletz fpletz commented Jan 25, 2017

Motivation for this change

Previously, we used one php-fpm process to manage all pools. While this is the default configuration we can do better and leverage systemd services hardening to improve isolation between pools running on the same system.

We are still using php-fpm to change uid and gid in order to maintain compatibility with existing configs for now.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@peterhoeg
Copy link
Member

Nice!

Couple of comments:

  1. I imagine that the reason for not using instantiated services (phpfpm@foo.service) is due to NixOS's rather poor support for that, correct?
  2. It might make sense to stick them all into the same slice: Slice=phpfpm.slice to allow resource allocations for all workers
  3. Having a phpfpm.target that pulls in all the units and then have multi-user.target pull in phpfpm.target makes it a lot easier to stop/start all at one go

@fpletz
Copy link
Member Author

fpletz commented Jan 27, 2017

I imagine that the reason for not using instantiated services (phpfpm@foo.service) is due to NixOS's rather poor support for that, correct?

Yup.

It might make sense to stick them all into the same slice: Slice=phpfpm.slice to allow resource allocations for all workers

Great idea! 👍

Having a phpfpm.target that pulls in all the units and then have multi-user.target pull in phpfpm.target makes it a lot easier to stop/start all at one go

Yeah, also great idea. 👍

I will implement both suggestions before merging this. Thanks!

@fpletz fpletz added this to the 17.03 milestone Feb 21, 2017
@fpletz fpletz force-pushed the refactor/phpfpm-service-per-pool branch from ce62c22 to ec4ead0 Compare February 27, 2017 23:02
@fpletz fpletz merged commit 3c9fbfb into NixOS:master Feb 27, 2017
@fpletz fpletz deleted the refactor/phpfpm-service-per-pool branch February 27, 2017 23:05
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

2 participants