aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-21 02:47:52 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-21 02:47:52 +0200
commitf40f5b235b890f46770a22f005f8a0f664cf0562 (patch)
tree60bbcac4b528324fe7e83f280d65190b57bb810a
parent1480d60775dcd38b33abd367a91cd1b865aacc54 (diff)
downloadNix-f40f5b235b890f46770a22f005f8a0f664cf0562.tar.gz
Nix-f40f5b235b890f46770a22f005f8a0f664cf0562.tar.zst
Nix-f40f5b235b890f46770a22f005f8a0f664cf0562.zip
Replace myPhpfpm with correct overrides
-rw-r--r--modules/private/websites/aten/integration.nix7
-rw-r--r--modules/private/websites/aten/production.nix7
-rw-r--r--modules/private/websites/chloe/builder.nix1
-rw-r--r--modules/private/websites/chloe/integration.nix12
-rw-r--r--modules/private/websites/chloe/production.nix12
-rw-r--r--modules/private/websites/connexionswing/builder.nix1
-rw-r--r--modules/private/websites/connexionswing/integration.nix12
-rw-r--r--modules/private/websites/connexionswing/production.nix12
-rw-r--r--modules/private/websites/florian/app.nix7
-rw-r--r--modules/private/websites/immae/production.nix2
-rw-r--r--modules/private/websites/leila/production.nix2
-rw-r--r--modules/private/websites/ludivinecassal/integration.nix7
-rw-r--r--modules/private/websites/ludivinecassal/production.nix7
-rw-r--r--modules/private/websites/naturaloutil/production.nix35
-rw-r--r--modules/private/websites/piedsjaloux/integration.nix7
-rw-r--r--modules/private/websites/piedsjaloux/production.nix7
-rw-r--r--nixops/modules/task/default.nix2
-rw-r--r--nixops/modules/websites/default.nix4
-rw-r--r--nixops/modules/websites/phpfpm/default.nix217
-rw-r--r--nixops/modules/websites/phpfpm/pool-options.nix35
-rw-r--r--nixops/modules/websites/tools/cloud.nix8
-rw-r--r--nixops/modules/websites/tools/dav/default.nix2
-rw-r--r--nixops/modules/websites/tools/git/default.nix2
-rw-r--r--nixops/modules/websites/tools/tools/default.nix140
-rw-r--r--nixops/modules/websites/tools/tools/roundcubemail.nix1
25 files changed, 173 insertions, 376 deletions
diff --git a/modules/private/websites/aten/integration.nix b/modules/private/websites/aten/integration.nix
index 790c5a9..5ccc0c1 100644
--- a/modules/private/websites/aten/integration.nix
+++ b/modules/private/websites/aten/integration.nix
@@ -13,9 +13,10 @@ in {
13 13
14 config = lib.mkIf cfg.enable { 14 config = lib.mkIf cfg.enable {
15 secrets.keys = aten.keys; 15 secrets.keys = aten.keys;
16 services.myPhpfpm.preStart.aten_dev = aten.phpFpm.preStart; 16 systemd.services.phpfpm-aten_dev.preStart = lib.mkAfter aten.phpFpm.preStart;
17 services.myPhpfpm.serviceDependencies.aten_dev = aten.phpFpm.serviceDeps; 17 systemd.services.phpfpm-aten_dev.after = lib.mkAfter aten.phpFpm.serviceDeps;
18 services.myPhpfpm.poolConfigs.aten_dev = aten.phpFpm.pool; 18 systemd.services.phpfpm-aten_dev.wants = aten.phpFpm.serviceDeps;
19 services.phpfpm.poolConfigs.aten_dev = aten.phpFpm.pool;
19 system.activationScripts.aten_dev = aten.activationScript; 20 system.activationScripts.aten_dev = aten.activationScript;
20 system.extraSystemBuilderCmds = '' 21 system.extraSystemBuilderCmds = ''
21 mkdir -p $out/webapps 22 mkdir -p $out/webapps
diff --git a/modules/private/websites/aten/production.nix b/modules/private/websites/aten/production.nix
index 697f1b8..7938241 100644
--- a/modules/private/websites/aten/production.nix
+++ b/modules/private/websites/aten/production.nix
@@ -15,9 +15,10 @@ in {
15 secrets.keys = aten.keys; 15 secrets.keys = aten.keys;
16 services.webstats.sites = [ { name = "aten.pro"; } ]; 16 services.webstats.sites = [ { name = "aten.pro"; } ];
17 17
18 services.myPhpfpm.preStart.aten_prod = aten.phpFpm.preStart; 18 systemd.services.phpfpm-aten_prod.preStart = lib.mkAfter aten.phpFpm.preStart;
19 services.myPhpfpm.serviceDependencies.aten_prod = aten.phpFpm.serviceDeps; 19 systemd.services.phpfpm-aten_prod.after = lib.mkAfter aten.phpFpm.serviceDeps;
20 services.myPhpfpm.poolConfigs.aten_prod = aten.phpFpm.pool; 20 systemd.services.phpfpm-aten_prod.wants = aten.phpFpm.serviceDeps;
21 services.phpfpm.poolConfigs.aten_prod = aten.phpFpm.pool;
21 system.activationScripts.aten_prod = aten.activationScript; 22 system.activationScripts.aten_prod = aten.activationScript;
22 system.extraSystemBuilderCmds = '' 23 system.extraSystemBuilderCmds = ''
23 mkdir -p $out/webapps 24 mkdir -p $out/webapps
diff --git a/modules/private/websites/chloe/builder.nix b/modules/private/websites/chloe/builder.nix
index 7b72b97..f65e9a9 100644
--- a/modules/private/websites/chloe/builder.nix
+++ b/modules/private/websites/chloe/builder.nix
@@ -5,7 +5,6 @@ rec {
5 serviceDeps = [ "mysql.service" ]; 5 serviceDeps = [ "mysql.service" ];
6 socket = "/var/run/phpfpm/chloe-${app.environment}.sock"; 6 socket = "/var/run/phpfpm/chloe-${app.environment}.sock";
7 pool = '' 7 pool = ''
8 listen = ${socket}
9 user = ${apacheUser} 8 user = ${apacheUser}
10 group = ${apacheGroup} 9 group = ${apacheGroup}
11 listen.owner = ${apacheUser} 10 listen.owner = ${apacheUser}
diff --git a/modules/private/websites/chloe/integration.nix b/modules/private/websites/chloe/integration.nix
index 458e414..d49a85c 100644
--- a/modules/private/websites/chloe/integration.nix
+++ b/modules/private/websites/chloe/integration.nix
@@ -13,11 +13,15 @@ in {
13 13
14 config = lib.mkIf cfg.enable { 14 config = lib.mkIf cfg.enable {
15 secrets.keys = chloe.keys; 15 secrets.keys = chloe.keys;
16 services.myPhpfpm.serviceDependencies.chloe_dev = chloe.phpFpm.serviceDeps; 16 systemd.services.phpfpm-chloe_dev.after = lib.mkAfter chloe.phpFpm.serviceDeps;
17 services.myPhpfpm.poolConfigs.chloe_dev = chloe.phpFpm.pool; 17 systemd.services.phpfpm-chloe_dev.wants = chloe.phpFpm.serviceDeps;
18 services.myPhpfpm.poolPhpConfigs.chloe_dev = '' 18 services.phpfpm.pools.chloe_dev = {
19 extension=${pkgs.php}/lib/php/extensions/mysqli.so 19 listen = chloe.phpFpm.socket;
20 extraConfig = chloe.phpFpm.pool;
21 phpOptions = config.services.phpfpm.phpOptions + ''
22 extension=${pkgs.php}/lib/php/extensions/mysqli.so
20 ''; 23 '';
24 };
21 system.activationScripts.chloe_dev = chloe.activationScript; 25 system.activationScripts.chloe_dev = chloe.activationScript;
22 system.extraSystemBuilderCmds = '' 26 system.extraSystemBuilderCmds = ''
23 mkdir -p $out/webapps 27 mkdir -p $out/webapps
diff --git a/modules/private/websites/chloe/production.nix b/modules/private/websites/chloe/production.nix
index 0eafebd..d4b2299 100644
--- a/modules/private/websites/chloe/production.nix
+++ b/modules/private/websites/chloe/production.nix
@@ -15,11 +15,15 @@ in {
15 secrets.keys = chloe.keys; 15 secrets.keys = chloe.keys;
16 services.webstats.sites = [ { name = "osteopathe-cc.fr"; } ]; 16 services.webstats.sites = [ { name = "osteopathe-cc.fr"; } ];
17 17
18 services.myPhpfpm.serviceDependencies.chloe_prod = chloe.phpFpm.serviceDeps; 18 systemd.services.phpfpm-chloe_prod.after = lib.mkAfter chloe.phpFpm.serviceDeps;
19 services.myPhpfpm.poolConfigs.chloe_prod = chloe.phpFpm.pool; 19 systemd.services.phpfpm-chloe_prod.wants = chloe.phpFpm.serviceDeps;
20 services.myPhpfpm.poolPhpConfigs.chloe_prod = '' 20 services.phpfpm.pools.chloe_prod = {
21 extension=${pkgs.php}/lib/php/extensions/mysqli.so 21 listen = chloe.phpFpm.socket;
22 extraConfig = chloe.phpFpm.pool;
23 phpOptions = config.services.phpfpm.phpOptions + ''
24 extension=${pkgs.php}/lib/php/extensions/mysqli.so
22 ''; 25 '';
26 };
23 system.activationScripts.chloe_prod = chloe.activationScript; 27 system.activationScripts.chloe_prod = chloe.activationScript;
24 system.extraSystemBuilderCmds = '' 28 system.extraSystemBuilderCmds = ''
25 mkdir -p $out/webapps 29 mkdir -p $out/webapps
diff --git a/modules/private/websites/connexionswing/builder.nix b/modules/private/websites/connexionswing/builder.nix
index 1224420..b4b04cb 100644
--- a/modules/private/websites/connexionswing/builder.nix
+++ b/modules/private/websites/connexionswing/builder.nix
@@ -49,7 +49,6 @@ rec {
49 extension=${phpPackages.imagick}/lib/php/extensions/imagick.so 49 extension=${phpPackages.imagick}/lib/php/extensions/imagick.so
50 ''; 50 '';
51 pool = '' 51 pool = ''
52 listen = ${socket}
53 user = ${apacheUser} 52 user = ${apacheUser}
54 group = ${apacheGroup} 53 group = ${apacheGroup}
55 listen.owner = ${apacheUser} 54 listen.owner = ${apacheUser}
diff --git a/modules/private/websites/connexionswing/integration.nix b/modules/private/websites/connexionswing/integration.nix
index c3425bd..6570977 100644
--- a/modules/private/websites/connexionswing/integration.nix
+++ b/modules/private/websites/connexionswing/integration.nix
@@ -13,10 +13,14 @@ in {
13 13
14 config = lib.mkIf cfg.enable { 14 config = lib.mkIf cfg.enable {
15 secrets.keys = connexionswing.keys; 15 secrets.keys = connexionswing.keys;
16 services.myPhpfpm.preStart.connexionswing_dev = connexionswing.phpFpm.preStart; 16 systemd.services.phpfpm-connexionswing_dev.after = lib.mkAfter connexionswing.phpFpm.serviceDeps;
17 services.myPhpfpm.serviceDependencies.connexionswing_dev = connexionswing.phpFpm.serviceDeps; 17 systemd.services.phpfpm-connexionswing_dev.wants = connexionswing.phpFpm.serviceDeps;
18 services.myPhpfpm.poolConfigs.connexionswing_dev = connexionswing.phpFpm.pool; 18 systemd.services.phpfpm-connexionswing_dev.preStart = lib.mkAfter connexionswing.phpFpm.preStart;
19 services.myPhpfpm.poolPhpConfigs.connexionswing_dev = connexionswing.phpFpm.phpConfig; 19 services.phpfpm.pools.connexionswing_dev = {
20 listen = connexionswing.phpFpm.socket;
21 extraConfig = connexionswing.phpFpm.pool;
22 phpOptions = config.services.phpfpm.phpOptions + connexionswing.phpFpm.phpConfig;
23 };
20 system.activationScripts.connexionswing_dev = connexionswing.activationScript; 24 system.activationScripts.connexionswing_dev = connexionswing.activationScript;
21 system.extraSystemBuilderCmds = '' 25 system.extraSystemBuilderCmds = ''
22 mkdir -p $out/webapps 26 mkdir -p $out/webapps
diff --git a/modules/private/websites/connexionswing/production.nix b/modules/private/websites/connexionswing/production.nix
index 8f28f46..b51c549 100644
--- a/modules/private/websites/connexionswing/production.nix
+++ b/modules/private/websites/connexionswing/production.nix
@@ -15,10 +15,14 @@ in {
15 secrets.keys = connexionswing.keys; 15 secrets.keys = connexionswing.keys;
16 services.webstats.sites = [ { name = "connexionswing.com"; } ]; 16 services.webstats.sites = [ { name = "connexionswing.com"; } ];
17 17
18 services.myPhpfpm.preStart.connexionswing_prod = connexionswing.phpFpm.preStart; 18 systemd.services.phpfpm-connexionswing_prod.after = lib.mkAfter connexionswing.phpFpm.serviceDeps;
19 services.myPhpfpm.serviceDependencies.connexionswing_prod = connexionswing.phpFpm.serviceDeps; 19 systemd.services.phpfpm-connexionswing_prod.wants = connexionswing.phpFpm.serviceDeps;
20 services.myPhpfpm.poolConfigs.connexionswing_prod = connexionswing.phpFpm.pool; 20 systemd.services.phpfpm-connexionswing_prod.preStart = lib.mkAfter connexionswing.phpFpm.preStart;
21 services.myPhpfpm.poolPhpConfigs.connexionswing_prod = connexionswing.phpFpm.phpConfig; 21 services.phpfpm.pools.connexionswing_prod = {
22 listen = connexionswing.phpFpm.socket;
23 extraConfig = connexionswing.phpFpm.pool;
24 phpOptions = config.services.phpfpm.phpOptions + connexionswing.phpFpm.phpConfig;
25 };
22 system.activationScripts.connexionswing_prod = connexionswing.activationScript; 26 system.activationScripts.connexionswing_prod = connexionswing.activationScript;
23 system.extraSystemBuilderCmds = '' 27 system.extraSystemBuilderCmds = ''
24 mkdir -p $out/webapps 28 mkdir -p $out/webapps
diff --git a/modules/private/websites/florian/app.nix b/modules/private/websites/florian/app.nix
index 08506e1..905c66a 100644
--- a/modules/private/websites/florian/app.nix
+++ b/modules/private/websites/florian/app.nix
@@ -15,9 +15,10 @@ in {
15 15
16 config = lib.mkIf cfg.enable { 16 config = lib.mkIf cfg.enable {
17 secrets.keys = tellesflorian.keys; 17 secrets.keys = tellesflorian.keys;
18 services.myPhpfpm.preStart.tellesflorian_dev = tellesflorian.phpFpm.preStart; 18 systemd.services.phpfpm-tellesflorian_dev.after = lib.mkAfter tellesflorian.phpFpm.serviceDeps;
19 services.myPhpfpm.serviceDependencies.tellesflorian_dev = tellesflorian.phpFpm.serviceDeps; 19 systemd.services.phpfpm-tellesflorian_dev.wants = tellesflorian.phpFpm.serviceDeps;
20 services.myPhpfpm.poolConfigs.tellesflorian_dev = tellesflorian.phpFpm.pool; 20 systemd.services.phpfpm-tellesflorian_dev.preStart = lib.mkAfter tellesflorian.phpFpm.preStart;
21 services.phpfpm.poolConfigs.tellesflorian_dev = tellesflorian.phpFpm.pool;
21 system.activationScripts.tellesflorian_dev = tellesflorian.activationScript; 22 system.activationScripts.tellesflorian_dev = tellesflorian.activationScript;
22 system.extraSystemBuilderCmds = '' 23 system.extraSystemBuilderCmds = ''
23 mkdir -p $out/webapps 24 mkdir -p $out/webapps
diff --git a/modules/private/websites/immae/production.nix b/modules/private/websites/immae/production.nix
index 58cf048..c3cabb6 100644
--- a/modules/private/websites/immae/production.nix
+++ b/modules/private/websites/immae/production.nix
@@ -9,7 +9,7 @@ in {
9 config = lib.mkIf cfg.enable { 9 config = lib.mkIf cfg.enable {
10 services.webstats.sites = [ { name = "www.immae.eu"; } ]; 10 services.webstats.sites = [ { name = "www.immae.eu"; } ];
11 11
12 services.myPhpfpm.poolConfigs.immae = '' 12 services.phpfpm.poolConfigs.immae = ''
13 listen = /run/phpfpm/immae.sock 13 listen = /run/phpfpm/immae.sock
14 user = wwwrun 14 user = wwwrun
15 group = wwwrun 15 group = wwwrun
diff --git a/modules/private/websites/leila/production.nix b/modules/private/websites/leila/production.nix
index 1ce8eea..69c8c49 100644
--- a/modules/private/websites/leila/production.nix
+++ b/modules/private/websites/leila/production.nix
@@ -6,7 +6,7 @@ in {
6 options.myServices.websites.leila.production.enable = lib.mkEnableOption "enable Leila's website in production"; 6 options.myServices.websites.leila.production.enable = lib.mkEnableOption "enable Leila's website in production";
7 7
8 config = lib.mkIf cfg.enable { 8 config = lib.mkIf cfg.enable {
9 services.myPhpfpm.poolConfigs.leila = '' 9 services.phpfpm.poolConfigs.leila = ''
10 listen = /run/phpfpm/leila.sock 10 listen = /run/phpfpm/leila.sock
11 user = wwwrun 11 user = wwwrun
12 group = wwwrun 12 group = wwwrun
diff --git a/modules/private/websites/ludivinecassal/integration.nix b/modules/private/websites/ludivinecassal/integration.nix
index 0be067b..a53f1fe 100644
--- a/modules/private/websites/ludivinecassal/integration.nix
+++ b/modules/private/websites/ludivinecassal/integration.nix
@@ -14,9 +14,10 @@ in {
14 config = lib.mkIf cfg.enable { 14 config = lib.mkIf cfg.enable {
15 secrets.keys = ludivinecassal.keys; 15 secrets.keys = ludivinecassal.keys;
16 16
17 services.myPhpfpm.preStart.ludivinecassal_dev = ludivinecassal.phpFpm.preStart; 17 systemd.services.phpfpm-ludivinecassal_dev.after = lib.mkAfter ludivinecassal.phpFpm.serviceDeps;
18 services.myPhpfpm.serviceDependencies.ludivinecassal_dev = ludivinecassal.phpFpm.serviceDeps; 18 systemd.services.phpfpm-ludivinecassal_dev.wants = ludivinecassal.phpFpm.serviceDeps;
19 services.myPhpfpm.poolConfigs.ludivinecassal_dev = ludivinecassal.phpFpm.pool; 19 systemd.services.phpfpm-ludivinecassal_dev.preStart = lib.mkAfter ludivinecassal.phpFpm.preStart;
20 services.phpfpm.poolConfigs.ludivinecassal_dev = ludivinecassal.phpFpm.pool;
20 system.activationScripts.ludivinecassal_dev = ludivinecassal.activationScript; 21 system.activationScripts.ludivinecassal_dev = ludivinecassal.activationScript;
21 system.extraSystemBuilderCmds = '' 22 system.extraSystemBuilderCmds = ''
22 mkdir -p $out/webapps 23 mkdir -p $out/webapps
diff --git a/modules/private/websites/ludivinecassal/production.nix b/modules/private/websites/ludivinecassal/production.nix
index c5de698..8fe6812 100644
--- a/modules/private/websites/ludivinecassal/production.nix
+++ b/modules/private/websites/ludivinecassal/production.nix
@@ -15,9 +15,10 @@ in {
15 secrets.keys = ludivinecassal.keys; 15 secrets.keys = ludivinecassal.keys;
16 services.webstats.sites = [ { name = "ludivinecassal.com"; } ]; 16 services.webstats.sites = [ { name = "ludivinecassal.com"; } ];
17 17
18 services.myPhpfpm.preStart.ludivinecassal_prod = ludivinecassal.phpFpm.preStart; 18 systemd.services.phpfpm-ludivinecassal_prod.after = lib.mkAfter ludivinecassal.phpFpm.serviceDeps;
19 services.myPhpfpm.serviceDependencies.ludivinecassal_prod = ludivinecassal.phpFpm.serviceDeps; 19 systemd.services.phpfpm-ludivinecassal_prod.wants = ludivinecassal.phpFpm.serviceDeps;
20 services.myPhpfpm.poolConfigs.ludivinecassal_prod = ludivinecassal.phpFpm.pool; 20 systemd.services.phpfpm-ludivinecassal_prod.preStart = lib.mkAfter ludivinecassal.phpFpm.preStart;
21 services.phpfpm.poolConfigs.ludivinecassal_prod = ludivinecassal.phpFpm.pool;
21 system.activationScripts.ludivinecassal_prod = ludivinecassal.activationScript; 22 system.activationScripts.ludivinecassal_prod = ludivinecassal.activationScript;
22 system.extraSystemBuilderCmds = '' 23 system.extraSystemBuilderCmds = ''
23 mkdir -p $out/webapps 24 mkdir -p $out/webapps
diff --git a/modules/private/websites/naturaloutil/production.nix b/modules/private/websites/naturaloutil/production.nix
index b6cf069..2315b30 100644
--- a/modules/private/websites/naturaloutil/production.nix
+++ b/modules/private/websites/naturaloutil/production.nix
@@ -33,24 +33,27 @@ in {
33 ?> 33 ?>
34 ''; 34 '';
35 }]; 35 }];
36 services.myPhpfpm.serviceDependencies.jerome = [ "mysql.service" ]; 36 systemd.services.phpfpm-jerome.after = lib.mkAfter [ "mysql.service" ];
37 services.myPhpfpm.poolConfigs.jerome = '' 37 systemd.services.phpfpm-jerome.wants = [ "mysql.service" ];
38 listen = /run/phpfpm/naturaloutil.sock 38 services.phpfpm.pools.jerome = {
39 user = wwwrun 39 listen = "/run/phpfpm/naturaloutil.sock";
40 group = wwwrun 40 extraConfig = ''
41 listen.owner = wwwrun 41 user = wwwrun
42 listen.group = wwwrun 42 group = wwwrun
43 listen.owner = wwwrun
44 listen.group = wwwrun
43 45
44 pm = ondemand 46 pm = ondemand
45 pm.max_children = 5 47 pm.max_children = 5
46 pm.process_idle_timeout = 60 48 pm.process_idle_timeout = 60
47 49
48 env[BDD_CONNECT] = "/var/secrets/webapps/prod-naturaloutil" 50 env[BDD_CONNECT] = "/var/secrets/webapps/prod-naturaloutil"
49 php_admin_value[open_basedir] = "/var/secrets/webapps/prod-naturaloutil:${varDir}:/tmp" 51 php_admin_value[open_basedir] = "/var/secrets/webapps/prod-naturaloutil:${varDir}:/tmp"
50 ''; 52 '';
51 services.myPhpfpm.poolPhpConfigs.jerome = '' 53 phpOptions = config.services.phpfpm.phpOptions + ''
52 extension=${pkgs.php}/lib/php/extensions/mysqli.so 54 extension=${pkgs.php}/lib/php/extensions/mysqli.so
53 ''; 55 '';
56 };
54 services.websites.production.modules = adminer.apache.modules ++ [ "proxy_fcgi" ]; 57 services.websites.production.modules = adminer.apache.modules ++ [ "proxy_fcgi" ];
55 services.websites.production.vhostConfs.naturaloutil = { 58 services.websites.production.vhostConfs.naturaloutil = {
56 certName = "naturaloutil"; 59 certName = "naturaloutil";
diff --git a/modules/private/websites/piedsjaloux/integration.nix b/modules/private/websites/piedsjaloux/integration.nix
index 6249e85..83b428a 100644
--- a/modules/private/websites/piedsjaloux/integration.nix
+++ b/modules/private/websites/piedsjaloux/integration.nix
@@ -13,9 +13,10 @@ in {
13 13
14 config = lib.mkIf cfg.enable { 14 config = lib.mkIf cfg.enable {
15 secrets.keys = piedsjaloux.keys; 15 secrets.keys = piedsjaloux.keys;
16 services.myPhpfpm.preStart.piedsjaloux_dev = piedsjaloux.phpFpm.preStart; 16 systemd.services.phpfpm-piedsjaloux_dev.after = lib.mkAfter piedsjaloux.phpFpm.serviceDeps;
17 services.myPhpfpm.serviceDependencies.piedsjaloux_dev = piedsjaloux.phpFpm.serviceDeps; 17 systemd.services.phpfpm-piedsjaloux_dev.wants = piedsjaloux.phpFpm.serviceDeps;
18 services.myPhpfpm.poolConfigs.piedsjaloux_dev = piedsjaloux.phpFpm.pool; 18 systemd.services.phpfpm-piedsjaloux_dev.preStart = lib.mkAfter piedsjaloux.phpFpm.preStart;
19 services.phpfpm.poolConfigs.piedsjaloux_dev = piedsjaloux.phpFpm.pool;
19 system.activationScripts.piedsjaloux_dev = piedsjaloux.activationScript; 20 system.activationScripts.piedsjaloux_dev = piedsjaloux.activationScript;
20 system.extraSystemBuilderCmds = '' 21 system.extraSystemBuilderCmds = ''
21 mkdir -p $out/webapps 22 mkdir -p $out/webapps
diff --git a/modules/private/websites/piedsjaloux/production.nix b/modules/private/websites/piedsjaloux/production.nix
index afa1667..0efd56b 100644
--- a/modules/private/websites/piedsjaloux/production.nix
+++ b/modules/private/websites/piedsjaloux/production.nix
@@ -15,9 +15,10 @@ in {
15 secrets.keys = piedsjaloux.keys; 15 secrets.keys = piedsjaloux.keys;
16 services.webstats.sites = [ { name = "piedsjaloux.fr"; } ]; 16 services.webstats.sites = [ { name = "piedsjaloux.fr"; } ];
17 17
18 services.myPhpfpm.preStart.piedsjaloux_prod = piedsjaloux.phpFpm.preStart; 18 systemd.services.phpfpm-piedsjaloux_prod.after = lib.mkAfter piedsjaloux.phpFpm.serviceDeps;
19 services.myPhpfpm.serviceDependencies.piedsjaloux_prod = piedsjaloux.phpFpm.serviceDeps; 19 systemd.services.phpfpm-piedsjaloux_prod.wants = piedsjaloux.phpFpm.serviceDeps;
20 services.myPhpfpm.poolConfigs.piedsjaloux_prod = piedsjaloux.phpFpm.pool; 20 systemd.services.phpfpm-piedsjaloux_prod.preStart = lib.mkAfter piedsjaloux.phpFpm.preStart;
21 services.phpfpm.poolConfigs.piedsjaloux_prod = piedsjaloux.phpFpm.pool;
21 system.activationScripts.piedsjaloux_prod = piedsjaloux.activationScript; 22 system.activationScripts.piedsjaloux_prod = piedsjaloux.activationScript;
22 system.extraSystemBuilderCmds = '' 23 system.extraSystemBuilderCmds = ''
23 mkdir -p $out/webapps 24 mkdir -p $out/webapps
diff --git a/nixops/modules/task/default.nix b/nixops/modules/task/default.nix
index e1c933f..e620318 100644
--- a/nixops/modules/task/default.nix
+++ b/nixops/modules/task/default.nix
@@ -160,7 +160,7 @@ in {
160 </Location> 160 </Location>
161 '') env.taskwarrior-web); 161 '') env.taskwarrior-web);
162 }; 162 };
163 services.myPhpfpm.poolConfigs = { 163 services.phpfpm.poolConfigs = {
164 tasks = '' 164 tasks = ''
165 listen = /var/run/phpfpm/task.sock 165 listen = /var/run/phpfpm/task.sock
166 user = ${user} 166 user = ${user}
diff --git a/nixops/modules/websites/default.nix b/nixops/modules/websites/default.nix
index 584892a..1948fe9 100644
--- a/nixops/modules/websites/default.nix
+++ b/nixops/modules/websites/default.nix
@@ -76,8 +76,6 @@ in
76 ./tools/diaspora.nix 76 ./tools/diaspora.nix
77 ./tools/ether.nix 77 ./tools/ether.nix
78 ./tools/peertube.nix 78 ./tools/peertube.nix
79 # Adapted from base phpfpm
80 ./phpfpm
81 ]; 79 ];
82 80
83 config = { 81 config = {
@@ -156,7 +154,7 @@ in
156 ln -s ${adminer.webRoot} $out/webapps/${adminer.apache.webappName} 154 ln -s ${adminer.webRoot} $out/webapps/${adminer.apache.webappName}
157 ''; 155 '';
158 156
159 services.myPhpfpm = { 157 services.phpfpm = {
160 phpPackage = pkgs.php; 158 phpPackage = pkgs.php;
161 phpOptions = '' 159 phpOptions = ''
162 session.save_path = "/var/lib/php/sessions" 160 session.save_path = "/var/lib/php/sessions"
diff --git a/nixops/modules/websites/phpfpm/default.nix b/nixops/modules/websites/phpfpm/default.nix
deleted file mode 100644
index 60959e0..0000000
--- a/nixops/modules/websites/phpfpm/default.nix
+++ /dev/null
@@ -1,217 +0,0 @@
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 cfg = config.services.myPhpfpm;
7 enabled = cfg.poolConfigs != {} || cfg.pools != {};
8
9 stateDir = "/run/phpfpm";
10
11 poolConfigs = cfg.poolConfigs // mapAttrs mkPool cfg.pools;
12
13 mkPool = n: p: ''
14 listen = ${p.listen}
15 ${p.extraConfig}
16 '';
17
18 fpmCfgFile = pool: poolConfig: pkgs.writeText "phpfpm-${pool}.conf" ''
19 [global]
20 error_log = syslog
21 daemonize = no
22 ${cfg.extraConfig}
23
24 [${pool}]
25 ${poolConfig}
26 '';
27
28 phpIni = poolPhpOptions: (pkgs.runCommand "php.ini" {
29 inherit (cfg) phpPackage phpOptions;
30 inherit poolPhpOptions;
31 nixDefaults = ''
32 sendmail_path = "/run/wrappers/bin/sendmail -t -i"
33 '';
34 passAsFile = [ "nixDefaults" "phpOptions" "poolPhpOptions" ];
35 } ''
36 cat $phpPackage/etc/php.ini $nixDefaultsPath $phpOptionsPath $poolPhpOptionsPath > $out
37 '');
38
39in {
40
41 options = {
42 services.myPhpfpm = {
43 extraConfig = mkOption {
44 type = types.lines;
45 default = "";
46 description = ''
47 Extra configuration that should be put in the global section of
48 the PHP-FPM configuration file. Do not specify the options
49 <literal>error_log</literal> or
50 <literal>daemonize</literal> here, since they are generated by
51 NixOS.
52 '';
53 };
54
55 phpPackage = mkOption {
56 type = types.package;
57 default = pkgs.php;
58 defaultText = "pkgs.php";
59 description = ''
60 The PHP package to use for running the PHP-FPM service.
61 '';
62 };
63
64 phpOptions = mkOption {
65 type = types.lines;
66 default = "";
67 example =
68 ''
69 date.timezone = "CET"
70 '';
71 description =
72 "Options appended to the PHP configuration file <filename>php.ini</filename>.";
73 };
74
75 serviceDependencies = mkOption {
76 default = {};
77 type = types.attrsOf (types.listOf types.string);
78 example = literalExample ''
79 { mypool = ["postgresql.service"]; }
80 '';
81 description = ''
82 Extra service dependencies specific to pool.
83 '';
84 };
85
86 envFile = mkOption {
87 default = {};
88 type = types.attrsOf types.string;
89 example = literalExample ''
90 { mypool = "path/to/file";
91 }
92 '';
93 description = ''
94 Extra environment file go into the service script.
95 '';
96 };
97
98 preStart = mkOption {
99 default = {};
100 type = types.attrsOf types.lines;
101 example = literalExample ''
102 { mypool = '''
103 touch foo
104 ''';
105 }
106 '';
107 description = ''
108 Extra lines that will go into the preStart systemd service
109 '';
110 };
111
112 poolPhpConfigs = mkOption {
113 default = {};
114 type = types.attrsOf types.lines;
115 example = literalExample ''
116 { mypool = '''
117 extension = some_extension.so
118 ''';
119 }
120 '';
121 description = ''
122 Extra lines that go into the php configuration specific to pool.
123 '';
124 };
125
126 poolConfigs = mkOption {
127 default = {};
128 type = types.attrsOf types.lines;
129 example = literalExample ''
130 { mypool = '''
131 listen = /run/phpfpm/mypool
132 user = nobody
133 pm = dynamic
134 pm.max_children = 75
135 pm.start_servers = 10
136 pm.min_spare_servers = 5
137 pm.max_spare_servers = 20
138 pm.max_requests = 500
139 ''';
140 }
141 '';
142 description = ''
143 A mapping between PHP-FPM pool names and their configurations.
144 See the documentation on <literal>php-fpm.conf</literal> for
145 details on configuration directives. If no pools are defined,
146 the phpfpm service is disabled.
147 '';
148 };
149
150 pools = mkOption {
151 type = types.attrsOf (types.submodule (import ./pool-options.nix {
152 inherit lib;
153 }));
154 default = {};
155 example = literalExample ''
156 {
157 mypool = {
158 listen = "/path/to/unix/socket";
159 extraConfig = '''
160 user = nobody
161 pm = dynamic
162 pm.max_children = 75
163 pm.start_servers = 10
164 pm.min_spare_servers = 5
165 pm.max_spare_servers = 20
166 pm.max_requests = 500
167 ''';
168 }
169 }'';
170 description = ''
171 PHP-FPM pools. If no pools or poolConfigs are defined, the PHP-FPM
172 service is disabled.
173 '';
174 };
175 };
176 };
177
178 config = mkIf enabled {
179
180 systemd.slices.phpfpm = {
181 description = "PHP FastCGI Process manager pools slice";
182 };
183
184 systemd.targets.phpfpm = {
185 description = "PHP FastCGI Process manager pools target";
186 wantedBy = [ "multi-user.target" ];
187 };
188
189 systemd.services = flip mapAttrs' poolConfigs (pool: poolConfig:
190 nameValuePair "phpfpm-${pool}" {
191 description = "PHP FastCGI Process Manager service for pool ${pool}";
192 after = [ "network.target" ] ++ (cfg.serviceDependencies.${pool} or []);
193 wants = cfg.serviceDependencies.${pool} or [];
194 wantedBy = [ "phpfpm.target" ];
195 partOf = [ "phpfpm.target" ];
196 preStart = ''
197 mkdir -p ${stateDir}
198 '' + (cfg.preStart.${pool} or "");
199 serviceConfig = let
200 cfgFile = fpmCfgFile pool poolConfig;
201 poolPhpIni = cfg.poolPhpConfigs.${pool} or "";
202 in {
203 EnvironmentFile = if builtins.hasAttr pool cfg.envFile then [cfg.envFile.${pool}] else [];
204 Slice = "phpfpm.slice";
205 PrivateDevices = true;
206 ProtectSystem = "full";
207 ProtectHome = true;
208 # XXX: We need AF_NETLINK to make the sendmail SUID binary from postfix work
209 RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6 AF_NETLINK";
210 Type = "notify";
211 ExecStart = "${cfg.phpPackage}/bin/php-fpm -y ${cfgFile} -c ${phpIni poolPhpIni}";
212 ExecReload = "${pkgs.coreutils}/bin/kill -USR2 $MAINPID";
213 };
214 }
215 );
216 };
217}
diff --git a/nixops/modules/websites/phpfpm/pool-options.nix b/nixops/modules/websites/phpfpm/pool-options.nix
deleted file mode 100644
index cc688c2..0000000
--- a/nixops/modules/websites/phpfpm/pool-options.nix
+++ /dev/null
@@ -1,35 +0,0 @@
1{ lib }:
2
3with lib; {
4
5 options = {
6
7 listen = mkOption {
8 type = types.str;
9 example = "/path/to/unix/socket";
10 description = ''
11 The address on which to accept FastCGI requests.
12 '';
13 };
14
15 extraConfig = mkOption {
16 type = types.lines;
17 example = ''
18 user = nobody
19 pm = dynamic
20 pm.max_children = 75
21 pm.start_servers = 10
22 pm.min_spare_servers = 5
23 pm.max_spare_servers = 20
24 pm.max_requests = 500
25 '';
26
27 description = ''
28 Extra lines that go into the pool configuration.
29 See the documentation on <literal>php-fpm.conf</literal> for
30 details on configuration directives.
31 '';
32 };
33 };
34}
35
diff --git a/nixops/modules/websites/tools/cloud.nix b/nixops/modules/websites/tools/cloud.nix
index 5e010f4..5d2ca40 100644
--- a/nixops/modules/websites/tools/cloud.nix
+++ b/nixops/modules/websites/tools/cloud.nix
@@ -17,7 +17,6 @@ let
17 zend_extension=${pkgs.php}/lib/php/extensions/opcache.so 17 zend_extension=${pkgs.php}/lib/php/extensions/opcache.so
18 ''; 18 '';
19 pool = '' 19 pool = ''
20 listen = ${socket}
21 user = wwwrun 20 user = wwwrun
22 group = wwwrun 21 group = wwwrun
23 listen.owner = wwwrun 22 listen.owner = wwwrun
@@ -170,9 +169,10 @@ in {
170 ln -s ${nextcloud} $out/webapps/${webappName} 169 ln -s ${nextcloud} $out/webapps/${webappName}
171 ''; 170 '';
172 171
173 services.myPhpfpm = { 172 services.phpfpm.pools.nextcloud = {
174 poolPhpConfigs.nextcloud = phpFpm.phpConfig; 173 listen = phpFpm.socket;
175 poolConfigs.nextcloud = phpFpm.pool; 174 extraConfig = phpFpm.pool;
175 phpOptions = config.services.phpfpm.phpOptions + phpFpm.phpConfig;
176 }; 176 };
177 177
178 services.cron = { 178 services.cron = {
diff --git a/nixops/modules/websites/tools/dav/default.nix b/nixops/modules/websites/tools/dav/default.nix
index 075cf48..78e0ba3 100644
--- a/nixops/modules/websites/tools/dav/default.nix
+++ b/nixops/modules/websites/tools/dav/default.nix
@@ -41,7 +41,7 @@ in {
41 ]; 41 ];
42 }; 42 };
43 43
44 services.myPhpfpm.poolConfigs = { 44 services.phpfpm.poolConfigs = {
45 davical = davical.phpFpm.pool; 45 davical = davical.phpFpm.pool;
46 }; 46 };
47 47
diff --git a/nixops/modules/websites/tools/git/default.nix b/nixops/modules/websites/tools/git/default.nix
index 064d3dd..495c5ea 100644
--- a/nixops/modules/websites/tools/git/default.nix
+++ b/nixops/modules/websites/tools/git/default.nix
@@ -38,7 +38,7 @@ in {
38 '' 38 ''
39 ]; 39 ];
40 }; 40 };
41 services.myPhpfpm.poolConfigs = { 41 services.phpfpm.poolConfigs = {
42 mantisbt = mantisbt.phpFpm.pool; 42 mantisbt = mantisbt.phpFpm.pool;
43 }; 43 };
44 }; 44 };
diff --git a/nixops/modules/websites/tools/tools/default.nix b/nixops/modules/websites/tools/tools/default.nix
index 061c004..642755f 100644
--- a/nixops/modules/websites/tools/tools/default.nix
+++ b/nixops/modules/websites/tools/tools/default.nix
@@ -72,15 +72,6 @@ in {
72 ++ ldap.apache.modules 72 ++ ldap.apache.modules
73 ++ kanboard.apache.modules; 73 ++ kanboard.apache.modules;
74 74
75 systemd.services.ympd = {
76 description = "Standalone MPD Web GUI written in C";
77 wantedBy = [ "multi-user.target" ];
78 script = ''
79 export MPD_PASSWORD=$(cat /var/secrets/mpd)
80 ${pkgs.ympd}/bin/ympd --host ${ympd.config.host} --port ${toString ympd.config.port} --webport ${ympd.config.webPort} --user nobody
81 '';
82 };
83
84 services.websites.integration.vhostConfs.devtools = { 75 services.websites.integration.vhostConfs.devtools = {
85 certName = "eldiron"; 76 certName = "eldiron";
86 addToCerts = true; 77 addToCerts = true;
@@ -157,33 +148,99 @@ in {
157 ]; 148 ];
158 }; 149 };
159 150
160 services.myPhpfpm.serviceDependencies = { 151 systemd.services = {
161 dokuwiki = dokuwiki.phpFpm.serviceDeps; 152 phpfpm-dokuwiki = {
162 kanboard = kanboard.phpFpm.serviceDeps; 153 after = lib.mkAfter dokuwiki.phpFpm.serviceDeps;
163 ldap = ldap.phpFpm.serviceDeps; 154 wants = dokuwiki.phpFpm.serviceDeps;
164 rainloop = rainloop.phpFpm.serviceDeps; 155 };
165 roundcubemail = roundcubemail.phpFpm.serviceDeps; 156 phpfpm-kanboard = {
166 shaarli = shaarli.phpFpm.serviceDeps; 157 after = lib.mkAfter kanboard.phpFpm.serviceDeps;
167 ttrss = ttrss.phpFpm.serviceDeps; 158 wants = kanboard.phpFpm.serviceDeps;
168 wallabag = wallabag.phpFpm.serviceDeps; 159 };
169 yourls = yourls.phpFpm.serviceDeps; 160 phpfpm-ldap = {
161 after = lib.mkAfter ldap.phpFpm.serviceDeps;
162 wants = ldap.phpFpm.serviceDeps;
163 };
164 phpfpm-rainloop = {
165 after = lib.mkAfter rainloop.phpFpm.serviceDeps;
166 wants = rainloop.phpFpm.serviceDeps;
167 };
168 phpfpm-roundcubemail = {
169 after = lib.mkAfter roundcubemail.phpFpm.serviceDeps;
170 wants = roundcubemail.phpFpm.serviceDeps;
171 };
172 phpfpm-shaarli = {
173 after = lib.mkAfter shaarli.phpFpm.serviceDeps;
174 wants = shaarli.phpFpm.serviceDeps;
175 };
176 phpfpm-ttrss = {
177 after = lib.mkAfter ttrss.phpFpm.serviceDeps;
178 wants = ttrss.phpFpm.serviceDeps;
179 };
180 phpfpm-wallabag = {
181 after = lib.mkAfter wallabag.phpFpm.serviceDeps;
182 wants = wallabag.phpFpm.serviceDeps;
183 preStart = lib.mkAfter wallabag.phpFpm.preStart;
184 };
185 phpfpm-yourls = {
186 after = lib.mkAfter yourls.phpFpm.serviceDeps;
187 wants = yourls.phpFpm.serviceDeps;
188 };
189 ympd = {
190 description = "Standalone MPD Web GUI written in C";
191 wantedBy = [ "multi-user.target" ];
192 script = ''
193 export MPD_PASSWORD=$(cat /var/secrets/mpd)
194 ${pkgs.ympd}/bin/ympd --host ${ympd.config.host} --port ${toString ympd.config.port} --webport ${ympd.config.webPort} --user nobody
195 '';
196 };
197 tt-rss = {
198 description = "Tiny Tiny RSS feeds update daemon";
199 serviceConfig = {
200 User = "wwwrun";
201 ExecStart = "${pkgs.php}/bin/php ${ttrss.webRoot}/update.php --daemon";
202 StandardOutput = "syslog";
203 StandardError = "syslog";
204 PermissionsStartOnly = true;
205 };
206
207 wantedBy = [ "multi-user.target" ];
208 requires = ["postgresql.service"];
209 after = ["network.target" "postgresql.service"];
210 };
211 };
212
213 services.phpfpm.pools.roundcubemail = {
214 listen = roundcubemail.phpFpm.socket;
215 extraConfig = roundcubemail.phpFpm.pool;
216 phpOptions = config.services.phpfpm.phpOptions + roundcubemail.phpFpm.phpConfig;
170 }; 217 };
171 218
172 services.myPhpfpm.poolPhpConfigs = { 219 services.phpfpm.pools.devtools = {
173 devtools = '' 220 listen = "/var/run/phpfpm/devtools.sock";
221 extraConfig = ''
222 user = wwwrun
223 group = wwwrun
224 listen.owner = wwwrun
225 listen.group = wwwrun
226 pm = dynamic
227 pm.max_children = 60
228 pm.start_servers = 2
229 pm.min_spare_servers = 1
230 pm.max_spare_servers = 10
231
232 php_admin_value[open_basedir] = "/run/wrappers/bin/sendmail:/var/lib/ftp/devtools.immae.eu:/tmp"
233 '';
234 phpOptions = config.services.phpfpm.phpOptions + ''
174 extension=${pkgs.phpPackages.redis}/lib/php/extensions/redis.so 235 extension=${pkgs.phpPackages.redis}/lib/php/extensions/redis.so
175 extension=${pkgs.phpPackages.apcu}/lib/php/extensions/apcu.so 236 extension=${pkgs.phpPackages.apcu}/lib/php/extensions/apcu.so
176 zend_extension=${pkgs.php}/lib/php/extensions/opcache.so 237 zend_extension=${pkgs.php}/lib/php/extensions/opcache.so
177 ''; 238 '';
178 roundcubemail = roundcubemail.phpFpm.phpConfig;
179 };
180 services.myPhpfpm.preStart = {
181 wallabag = wallabag.phpFpm.preStart;
182 }; 239 };
183 services.myPhpfpm.poolConfigs = { 240
241 services.phpfpm.poolConfigs = {
184 adminer = adminer.phpFpm.pool; 242 adminer = adminer.phpFpm.pool;
185 ttrss = ttrss.phpFpm.pool; 243 ttrss = ttrss.phpFpm.pool;
186 roundcubemail = roundcubemail.phpFpm.pool;
187 wallabag = wallabag.phpFpm.pool; 244 wallabag = wallabag.phpFpm.pool;
188 yourls = yourls.phpFpm.pool; 245 yourls = yourls.phpFpm.pool;
189 rompr = rompr.phpFpm.pool; 246 rompr = rompr.phpFpm.pool;
@@ -192,20 +249,6 @@ in {
192 ldap = ldap.phpFpm.pool; 249 ldap = ldap.phpFpm.pool;
193 rainloop = rainloop.phpFpm.pool; 250 rainloop = rainloop.phpFpm.pool;
194 kanboard = kanboard.phpFpm.pool; 251 kanboard = kanboard.phpFpm.pool;
195 devtools = ''
196 listen = /var/run/phpfpm/devtools.sock
197 user = wwwrun
198 group = wwwrun
199 listen.owner = wwwrun
200 listen.group = wwwrun
201 pm = dynamic
202 pm.max_children = 60
203 pm.start_servers = 2
204 pm.min_spare_servers = 1
205 pm.max_spare_servers = 10
206
207 php_admin_value[open_basedir] = "/run/wrappers/bin/sendmail:/var/lib/ftp/devtools.immae.eu:/tmp"
208 '';
209 tools = '' 252 tools = ''
210 listen = /var/run/phpfpm/tools.sock 253 listen = /var/run/phpfpm/tools.sock
211 user = wwwrun 254 user = wwwrun
@@ -250,21 +293,6 @@ in {
250 ln -s ${kanboard.webRoot} $out/webapps/${kanboard.apache.webappName} 293 ln -s ${kanboard.webRoot} $out/webapps/${kanboard.apache.webappName}
251 ''; 294 '';
252 295
253 systemd.services.tt-rss = {
254 description = "Tiny Tiny RSS feeds update daemon";
255 serviceConfig = {
256 User = "wwwrun";
257 ExecStart = "${pkgs.php}/bin/php ${ttrss.webRoot}/update.php --daemon";
258 StandardOutput = "syslog";
259 StandardError = "syslog";
260 PermissionsStartOnly = true;
261 };
262
263 wantedBy = [ "multi-user.target" ];
264 requires = ["postgresql.service"];
265 after = ["network.target" "postgresql.service"];
266 };
267
268 }; 296 };
269} 297}
270 298
diff --git a/nixops/modules/websites/tools/tools/roundcubemail.nix b/nixops/modules/websites/tools/tools/roundcubemail.nix
index 6177ff3..8974d1b 100644
--- a/nixops/modules/websites/tools/tools/roundcubemail.nix
+++ b/nixops/modules/websites/tools/tools/roundcubemail.nix
@@ -102,7 +102,6 @@ rec {
102 ''; 102 '';
103 socket = "/var/run/phpfpm/roundcubemail.sock"; 103 socket = "/var/run/phpfpm/roundcubemail.sock";
104 pool = '' 104 pool = ''
105 listen = ${socket}
106 user = ${apache.user} 105 user = ${apache.user}
107 group = ${apache.group} 106 group = ${apache.group}
108 listen.owner = ${apache.user} 107 listen.owner = ${apache.user}