aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/chloe
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2020-03-25 11:57:48 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2020-04-03 16:25:07 +0200
commit5400b9b6f65451d41a9106fae6fc00f97d83f4ef (patch)
tree6ed072da7b1f17ac3994ffea052aa0c0822f8446 /modules/private/websites/chloe
parent441da8aac378f401625e82caf281fa0e26128310 (diff)
downloadNix-5400b9b6f65451d41a9106fae6fc00f97d83f4ef.tar.gz
Nix-5400b9b6f65451d41a9106fae6fc00f97d83f4ef.tar.zst
Nix-5400b9b6f65451d41a9106fae6fc00f97d83f4ef.zip
Upgrade nixos
Diffstat (limited to 'modules/private/websites/chloe')
-rw-r--r--modules/private/websites/chloe/builder.nix45
-rw-r--r--modules/private/websites/chloe/integration.nix9
-rw-r--r--modules/private/websites/chloe/production.nix7
3 files changed, 31 insertions, 30 deletions
diff --git a/modules/private/websites/chloe/builder.nix b/modules/private/websites/chloe/builder.nix
index f21caeb..bce2b4d 100644
--- a/modules/private/websites/chloe/builder.nix
+++ b/modules/private/websites/chloe/builder.nix
@@ -3,28 +3,25 @@ rec {
3 app = chloe.override { inherit (config) environment; }; 3 app = chloe.override { inherit (config) environment; };
4 phpFpm = rec { 4 phpFpm = rec {
5 serviceDeps = [ "mysql.service" ]; 5 serviceDeps = [ "mysql.service" ];
6 socket = "/var/run/phpfpm/chloe-${app.environment}.sock"; 6 pool = {
7 pool = '' 7 "listen.owner" = apacheUser;
8 user = ${apacheUser} 8 "listen.group" = apacheGroup;
9 group = ${apacheGroup} 9 "php_admin_value[upload_max_filesize]" = "20M";
10 listen.owner = ${apacheUser} 10 "php_admin_value[post_max_size]" = "20M";
11 listen.group = ${apacheGroup} 11 # "php_admin_flag[log_errors]" = "on";
12 php_admin_value[upload_max_filesize] = 20M 12 "php_admin_value[open_basedir]" = "${app.spipConfig}:${configDir}:${app}:${app.varDir}:/tmp";
13 php_admin_value[post_max_size] = 20M 13 "php_admin_value[session.save_path]" = "${app.varDir}/phpSessions";
14 ;php_admin_flag[log_errors] = on 14 } // (if app.environment == "dev" then {
15 php_admin_value[open_basedir] = "${app.spipConfig}:${configDir}:${app}:${app.varDir}:/tmp" 15 "pm" = "ondemand";
16 php_admin_value[session.save_path] = "${app.varDir}/phpSessions" 16 "pm.max_children" = "5";
17 ${if app.environment == "dev" then '' 17 "pm.process_idle_timeout" = "60";
18 pm = ondemand 18 } else {
19 pm.max_children = 5 19 "pm" = "dynamic";
20 pm.process_idle_timeout = 60 20 "pm.max_children" = "20";
21 '' else '' 21 "pm.start_servers" = "2";
22 pm = dynamic 22 "pm.min_spare_servers" = "1";
23 pm.max_children = 20 23 "pm.max_spare_servers" = "3";
24 pm.start_servers = 2 24 });
25 pm.min_spare_servers = 1
26 pm.max_spare_servers = 3
27 ''}'';
28 }; 25 };
29 keys = [{ 26 keys = [{
30 dest = "webapps/${app.environment}-chloe"; 27 dest = "webapps/${app.environment}-chloe";
@@ -51,7 +48,7 @@ rec {
51 modules = [ "proxy_fcgi" ]; 48 modules = [ "proxy_fcgi" ];
52 webappName = "chloe_${app.environment}"; 49 webappName = "chloe_${app.environment}";
53 root = "/run/current-system/webapps/${webappName}"; 50 root = "/run/current-system/webapps/${webappName}";
54 vhostConf = '' 51 vhostConf = socket: ''
55 Include /var/secrets/webapps/${app.environment}-chloe 52 Include /var/secrets/webapps/${app.environment}-chloe
56 53
57 RewriteEngine On 54 RewriteEngine On
@@ -60,7 +57,7 @@ rec {
60 '' else ""} 57 '' else ""}
61 58
62 <FilesMatch "\.php$"> 59 <FilesMatch "\.php$">
63 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" 60 SetHandler "proxy:unix:${socket}|fcgi://localhost"
64 </FilesMatch> 61 </FilesMatch>
65 62
66 <Directory ${root}> 63 <Directory ${root}>
diff --git a/modules/private/websites/chloe/integration.nix b/modules/private/websites/chloe/integration.nix
index 6276eb7..caf6548 100644
--- a/modules/private/websites/chloe/integration.nix
+++ b/modules/private/websites/chloe/integration.nix
@@ -17,8 +17,9 @@ in {
17 systemd.services.phpfpm-chloe_dev.after = lib.mkAfter chloe.phpFpm.serviceDeps; 17 systemd.services.phpfpm-chloe_dev.after = lib.mkAfter chloe.phpFpm.serviceDeps;
18 systemd.services.phpfpm-chloe_dev.wants = chloe.phpFpm.serviceDeps; 18 systemd.services.phpfpm-chloe_dev.wants = chloe.phpFpm.serviceDeps;
19 services.phpfpm.pools.chloe_dev = { 19 services.phpfpm.pools.chloe_dev = {
20 listen = chloe.phpFpm.socket; 20 user = config.services.httpd.Inte.user;
21 extraConfig = chloe.phpFpm.pool; 21 group = config.services.httpd.Inte.group;
22 settings = chloe.phpFpm.pool;
22 phpOptions = config.services.phpfpm.phpOptions + '' 23 phpOptions = config.services.phpfpm.phpOptions + ''
23 extension=${pkgs.php}/lib/php/extensions/mysqli.so 24 extension=${pkgs.php}/lib/php/extensions/mysqli.so
24 ''; 25 '';
@@ -31,7 +32,9 @@ in {
31 addToCerts = true; 32 addToCerts = true;
32 hosts = ["chloe.immae.eu" ]; 33 hosts = ["chloe.immae.eu" ];
33 root = chloe.apache.root; 34 root = chloe.apache.root;
34 extraConfig = [ chloe.apache.vhostConf ]; 35 extraConfig = [
36 (chloe.apache.vhostConf config.services.phpfpm.pools.chloe_dev.socket)
37 ];
35 }; 38 };
36 services.websites.env.integration.watchPaths = [ 39 services.websites.env.integration.watchPaths = [
37 "/var/secrets/webapps/${chloe.app.environment}-chloe" 40 "/var/secrets/webapps/${chloe.app.environment}-chloe"
diff --git a/modules/private/websites/chloe/production.nix b/modules/private/websites/chloe/production.nix
index 578bf91..83f6c9b 100644
--- a/modules/private/websites/chloe/production.nix
+++ b/modules/private/websites/chloe/production.nix
@@ -19,8 +19,9 @@ in {
19 systemd.services.phpfpm-chloe_prod.after = lib.mkAfter chloe.phpFpm.serviceDeps; 19 systemd.services.phpfpm-chloe_prod.after = lib.mkAfter chloe.phpFpm.serviceDeps;
20 systemd.services.phpfpm-chloe_prod.wants = chloe.phpFpm.serviceDeps; 20 systemd.services.phpfpm-chloe_prod.wants = chloe.phpFpm.serviceDeps;
21 services.phpfpm.pools.chloe_prod = { 21 services.phpfpm.pools.chloe_prod = {
22 listen = chloe.phpFpm.socket; 22 user = config.services.httpd.Prod.user;
23 extraConfig = chloe.phpFpm.pool; 23 group = config.services.httpd.Prod.group;
24 settings = chloe.phpFpm.pool;
24 phpOptions = config.services.phpfpm.phpOptions + '' 25 phpOptions = config.services.phpfpm.phpOptions + ''
25 extension=${pkgs.php}/lib/php/extensions/mysqli.so 26 extension=${pkgs.php}/lib/php/extensions/mysqli.so
26 ''; 27 '';
@@ -39,7 +40,7 @@ in {
39 RewriteCond "%{HTTP_HOST}" "!^www\.osteopathe-cc\.fr$" [NC] 40 RewriteCond "%{HTTP_HOST}" "!^www\.osteopathe-cc\.fr$" [NC]
40 RewriteRule ^(.+)$ https://www.osteopathe-cc.fr$1 [R=302,L] 41 RewriteRule ^(.+)$ https://www.osteopathe-cc.fr$1 [R=302,L]
41 '' 42 ''
42 chloe.apache.vhostConf 43 (chloe.apache.vhostConf config.services.phpfpm.pools.chloe_prod.socket)
43 ]; 44 ];
44 }; 45 };
45 services.websites.env.production.watchPaths = [ 46 services.websites.env.production.watchPaths = [