aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2021-10-23 11:14:42 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2021-10-23 11:16:31 +0200
commit305922df8aa5aae8d930ea3e23fbddb3b16b215a (patch)
tree748a02a99fb07ee07029b791553e8cc300feb328 /modules
parent4ec2d441373e1115923e5258659c5a39cafcce4e (diff)
downloadNix-305922df8aa5aae8d930ea3e23fbddb3b16b215a.tar.gz
Nix-305922df8aa5aae8d930ea3e23fbddb3b16b215a.tar.zst
Nix-305922df8aa5aae8d930ea3e23fbddb3b16b215a.zip
Add new Patrick website and reorganise files
Diffstat (limited to 'modules')
-rw-r--r--modules/private/default.nix3
-rw-r--r--modules/private/websites/default.nix5
-rw-r--r--modules/private/websites/patrick_fodella/altermondia.nix73
-rw-r--r--modules/private/websites/patrick_fodella/ecolyeu.nix (renamed from modules/private/websites/patrick_fodella/production.nix)24
4 files changed, 91 insertions, 14 deletions
diff --git a/modules/private/default.nix b/modules/private/default.nix
index 5bb6507..9108a92 100644
--- a/modules/private/default.nix
+++ b/modules/private/default.nix
@@ -68,7 +68,8 @@ set = {
68 papaMaisonBbc = ./websites/papa/maison_bbc.nix; 68 papaMaisonBbc = ./websites/papa/maison_bbc.nix;
69 papaSurveillance = ./websites/papa/surveillance.nix; 69 papaSurveillance = ./websites/papa/surveillance.nix;
70 70
71 patrickFodellaProd = ./websites/patrick_fodella/production.nix; 71 patrickFodellaEcolyeu = ./websites/patrick_fodella/ecolyeu.nix;
72 patrickFodellaAltermondia = ./websites/patrick_fodella/altermondia.nix;
72 73
73 piedsjalouxInte = ./websites/piedsjaloux/integration.nix; 74 piedsjalouxInte = ./websites/piedsjaloux/integration.nix;
74 piedsjalouxProd = ./websites/piedsjaloux/production.nix; 75 piedsjalouxProd = ./websites/piedsjaloux/production.nix;
diff --git a/modules/private/websites/default.nix b/modules/private/websites/default.nix
index 7aac7b8..4864034 100644
--- a/modules/private/websites/default.nix
+++ b/modules/private/websites/default.nix
@@ -280,7 +280,10 @@ in
280 maison_bbc.enable = true; 280 maison_bbc.enable = true;
281 }; 281 };
282 282
283 patrick_fodella.production.enable = true; 283 patrick_fodella = {
284 ecolyeu.enable = true;
285 altermondia.enable = true;
286 };
284 287
285 piedsjaloux = { 288 piedsjaloux = {
286 integration.enable = true; 289 integration.enable = true;
diff --git a/modules/private/websites/patrick_fodella/altermondia.nix b/modules/private/websites/patrick_fodella/altermondia.nix
new file mode 100644
index 0000000..2a41aa3
--- /dev/null
+++ b/modules/private/websites/patrick_fodella/altermondia.nix
@@ -0,0 +1,73 @@
1{ lib, pkgs, config, ... }:
2let
3 cfg = config.myServices.websites.patrick_fodella.altermondia;
4 varDir = "/var/lib/ftp/patrick_fodella/altermondia";
5 apacheUser = config.services.httpd.Prod.user;
6 apacheGroup = config.services.httpd.Prod.group;
7in {
8 options.myServices.websites.patrick_fodella.altermondia.enable = lib.mkEnableOption "enable Patrick Fodella Altermondia's website";
9
10 config = lib.mkIf cfg.enable {
11 services.webstats.sites = [ { name = "altermondia.org"; } ];
12
13 system.activationScripts.patrick_fodella_altermondia = {
14 deps = [ "httpd" ];
15 text = ''
16 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/patrick_fodella_altermondia
17 '';
18 };
19 systemd.services.phpfpm-patrick_fodella_altermondia.after = lib.mkAfter [ "mysql.service" ];
20 systemd.services.phpfpm-patrick_fodella_altermondia.wants = [ "mysql.service" ];
21 services.phpfpm.pools.patrick_fodella_altermondia = {
22 user = apacheUser;
23 group = apacheGroup;
24 settings = {
25 "listen.owner" = apacheUser;
26 "listen.group" = apacheGroup;
27
28 "pm" = "ondemand";
29 "pm.max_children" = "5";
30 "pm.process_idle_timeout" = "60";
31
32 "php_admin_value[open_basedir]" = "/var/lib/php/sessions/patrick_fodella_altermondia:${varDir}:/tmp";
33 "php_admin_value[session.save_path]" = "/var/lib/php/sessions/patrick_fodella_altermondia";
34 };
35 phpOptions = config.services.phpfpm.phpOptions + ''
36 disable_functions = "mail"
37 '';
38 phpPackage = pkgs.php72;
39 };
40 services.websites.env.production.modules = [ "proxy_fcgi" ];
41 services.websites.env.production.vhostConfs.patrick_fodella_altermondia = {
42 certName = "patrick_fodella";
43 addToCerts = true;
44 hosts = ["altermondia.org" "www.altermondia.org" ];
45 root = varDir;
46 extraConfig = [
47 ''
48 Use Stats altermondia.org
49
50 RewriteEngine on
51 RewriteCond "%{HTTP_HOST}" "!^altermondia\.org$" [NC]
52 RewriteRule ^(.+)$ https://altermondia.org$1 [R=302,L]
53
54 <FilesMatch "\.php$">
55 SetHandler "proxy:unix:${config.services.phpfpm.pools.patrick_fodella_altermondia.socket}|fcgi://localhost"
56 </FilesMatch>
57
58 <Location /xmlrpc.php>
59 AllowOverride None
60 Require all denied
61 </Location>
62 <Directory ${varDir}>
63 DirectoryIndex index.php index.htm index.html
64 Options Indexes FollowSymLinks MultiViews Includes
65 AllowOverride all
66 Require all granted
67 </Directory>
68 ''
69 ];
70 };
71 };
72}
73
diff --git a/modules/private/websites/patrick_fodella/production.nix b/modules/private/websites/patrick_fodella/ecolyeu.nix
index 2812cf7..00dab76 100644
--- a/modules/private/websites/patrick_fodella/production.nix
+++ b/modules/private/websites/patrick_fodella/ecolyeu.nix
@@ -1,24 +1,24 @@
1{ lib, pkgs, config, ... }: 1{ lib, pkgs, config, ... }:
2let 2let
3 cfg = config.myServices.websites.patrick_fodella.production; 3 cfg = config.myServices.websites.patrick_fodella.ecolyeu;
4 varDir = "/var/lib/ftp/patrick_fodella"; 4 varDir = "/var/lib/ftp/patrick_fodella/ecolyeu_pessicart";
5 apacheUser = config.services.httpd.Prod.user; 5 apacheUser = config.services.httpd.Prod.user;
6 apacheGroup = config.services.httpd.Prod.group; 6 apacheGroup = config.services.httpd.Prod.group;
7in { 7in {
8 options.myServices.websites.patrick_fodella.production.enable = lib.mkEnableOption "enable Patrick Fodella's website"; 8 options.myServices.websites.patrick_fodella.ecolyeu.enable = lib.mkEnableOption "enable Patrick Fodella Ecolyeu's website";
9 9
10 config = lib.mkIf cfg.enable { 10 config = lib.mkIf cfg.enable {
11 services.webstats.sites = [ { name = "ecolyeu-pessicart-nice.fr"; } ]; 11 services.webstats.sites = [ { name = "ecolyeu-pessicart-nice.fr"; } ];
12 12
13 system.activationScripts.patrick_fodella = { 13 system.activationScripts.patrick_fodella_ecolyeu = {
14 deps = [ "httpd" ]; 14 deps = [ "httpd" ];
15 text = '' 15 text = ''
16 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/patrick_fodella 16 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/patrick_fodella_ecolyeu
17 ''; 17 '';
18 }; 18 };
19 systemd.services.phpfpm-patrick_fodella.after = lib.mkAfter [ "mysql.service" ]; 19 systemd.services.phpfpm-patrick_fodella_ecolyeu.after = lib.mkAfter [ "mysql.service" ];
20 systemd.services.phpfpm-patrick_fodella.wants = [ "mysql.service" ]; 20 systemd.services.phpfpm-patrick_fodella_ecolyeu.wants = [ "mysql.service" ];
21 services.phpfpm.pools.patrick_fodella = { 21 services.phpfpm.pools.patrick_fodella_ecolyeu = {
22 user = apacheUser; 22 user = apacheUser;
23 group = apacheGroup; 23 group = apacheGroup;
24 settings = { 24 settings = {
@@ -29,8 +29,8 @@ in {
29 "pm.max_children" = "5"; 29 "pm.max_children" = "5";
30 "pm.process_idle_timeout" = "60"; 30 "pm.process_idle_timeout" = "60";
31 31
32 "php_admin_value[open_basedir]" = "/var/lib/php/sessions/patrick_fodella:${varDir}:/tmp"; 32 "php_admin_value[open_basedir]" = "/var/lib/php/sessions/patrick_fodella_ecolyeu:${varDir}:/tmp";
33 "php_admin_value[session.save_path]" = "/var/lib/php/sessions/patrick_fodella"; 33 "php_admin_value[session.save_path]" = "/var/lib/php/sessions/patrick_fodella_ecolyeu";
34 }; 34 };
35 phpOptions = config.services.phpfpm.phpOptions + '' 35 phpOptions = config.services.phpfpm.phpOptions + ''
36 disable_functions = "mail" 36 disable_functions = "mail"
@@ -38,7 +38,7 @@ in {
38 phpPackage = pkgs.php72; 38 phpPackage = pkgs.php72;
39 }; 39 };
40 services.websites.env.production.modules = [ "proxy_fcgi" ]; 40 services.websites.env.production.modules = [ "proxy_fcgi" ];
41 services.websites.env.production.vhostConfs.patrick_fodella = { 41 services.websites.env.production.vhostConfs.patrick_fodella_ecolyeu = {
42 certName = "patrick_fodella"; 42 certName = "patrick_fodella";
43 certMainHost = "ecolyeu-pessicart-nice.fr"; 43 certMainHost = "ecolyeu-pessicart-nice.fr";
44 hosts = ["ecolyeu-pessicart-nice.fr" "www.ecolyeu-pessicart-nice.fr" ]; 44 hosts = ["ecolyeu-pessicart-nice.fr" "www.ecolyeu-pessicart-nice.fr" ];
@@ -52,7 +52,7 @@ in {
52 RewriteRule ^(.+)$ https://www.ecolyeu-pessicart-nice.fr$1 [R=302,L] 52 RewriteRule ^(.+)$ https://www.ecolyeu-pessicart-nice.fr$1 [R=302,L]
53 53
54 <FilesMatch "\.php$"> 54 <FilesMatch "\.php$">
55 SetHandler "proxy:unix:${config.services.phpfpm.pools.patrick_fodella.socket}|fcgi://localhost" 55 SetHandler "proxy:unix:${config.services.phpfpm.pools.patrick_fodella_ecolyeu.socket}|fcgi://localhost"
56 </FilesMatch> 56 </FilesMatch>
57 57
58 <Location /xmlrpc.php> 58 <Location /xmlrpc.php>