]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Add new Patrick website and reorganise files
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sat, 23 Oct 2021 09:14:42 +0000 (11:14 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Sat, 23 Oct 2021 09:16:31 +0000 (11:16 +0200)
modules/private/default.nix
modules/private/websites/default.nix
modules/private/websites/patrick_fodella/altermondia.nix [new file with mode: 0644]
modules/private/websites/patrick_fodella/ecolyeu.nix [moved from modules/private/websites/patrick_fodella/production.nix with 71% similarity]

index 5bb650743155cd7a58d45acb192f335775856e1d..9108a92f4b2a538bc44719210e1687eb5ea028ca 100644 (file)
@@ -68,7 +68,8 @@ set = {
   papaMaisonBbc = ./websites/papa/maison_bbc.nix;
   papaSurveillance = ./websites/papa/surveillance.nix;
 
-  patrickFodellaProd = ./websites/patrick_fodella/production.nix;
+  patrickFodellaEcolyeu = ./websites/patrick_fodella/ecolyeu.nix;
+  patrickFodellaAltermondia = ./websites/patrick_fodella/altermondia.nix;
 
   piedsjalouxInte = ./websites/piedsjaloux/integration.nix;
   piedsjalouxProd = ./websites/piedsjaloux/production.nix;
index 7aac7b879d72b08e8969ba97e25a8a8f45c2b194..4864034990d81cefb848fc5042a039fb401dc145 100644 (file)
@@ -280,7 +280,10 @@ in
         maison_bbc.enable = true;
       };
 
-      patrick_fodella.production.enable = true;
+      patrick_fodella = {
+        ecolyeu.enable = true;
+        altermondia.enable = true;
+      };
 
       piedsjaloux = {
         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 (file)
index 0000000..2a41aa3
--- /dev/null
@@ -0,0 +1,73 @@
+{ lib, pkgs, config,  ... }:
+let
+  cfg = config.myServices.websites.patrick_fodella.altermondia;
+  varDir = "/var/lib/ftp/patrick_fodella/altermondia";
+  apacheUser = config.services.httpd.Prod.user;
+  apacheGroup = config.services.httpd.Prod.group;
+in {
+  options.myServices.websites.patrick_fodella.altermondia.enable = lib.mkEnableOption "enable Patrick Fodella Altermondia's website";
+
+  config = lib.mkIf cfg.enable {
+    services.webstats.sites = [ { name = "altermondia.org"; } ];
+
+    system.activationScripts.patrick_fodella_altermondia = {
+      deps = [ "httpd" ];
+      text = ''
+        install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/patrick_fodella_altermondia
+        '';
+    };
+    systemd.services.phpfpm-patrick_fodella_altermondia.after = lib.mkAfter [ "mysql.service" ];
+    systemd.services.phpfpm-patrick_fodella_altermondia.wants = [ "mysql.service" ];
+    services.phpfpm.pools.patrick_fodella_altermondia = {
+      user = apacheUser;
+      group = apacheGroup;
+      settings = {
+        "listen.owner" = apacheUser;
+        "listen.group" = apacheGroup;
+
+        "pm" = "ondemand";
+        "pm.max_children" = "5";
+        "pm.process_idle_timeout" = "60";
+
+        "php_admin_value[open_basedir]" = "/var/lib/php/sessions/patrick_fodella_altermondia:${varDir}:/tmp";
+        "php_admin_value[session.save_path]" = "/var/lib/php/sessions/patrick_fodella_altermondia";
+      };
+      phpOptions = config.services.phpfpm.phpOptions + ''
+        disable_functions = "mail"
+      '';
+      phpPackage = pkgs.php72;
+    };
+    services.websites.env.production.modules = [ "proxy_fcgi" ];
+    services.websites.env.production.vhostConfs.patrick_fodella_altermondia = {
+      certName     = "patrick_fodella";
+      addToCerts   = true;
+      hosts        = ["altermondia.org" "www.altermondia.org" ];
+      root         = varDir;
+      extraConfig  = [
+        ''
+        Use Stats altermondia.org
+
+        RewriteEngine on
+        RewriteCond "%{HTTP_HOST}" "!^altermondia\.org$" [NC]
+        RewriteRule ^(.+)$ https://altermondia.org$1 [R=302,L]
+
+        <FilesMatch "\.php$">
+          SetHandler "proxy:unix:${config.services.phpfpm.pools.patrick_fodella_altermondia.socket}|fcgi://localhost"
+        </FilesMatch>
+
+        <Location /xmlrpc.php>
+          AllowOverride None
+          Require all denied
+        </Location>
+        <Directory ${varDir}>
+          DirectoryIndex index.php index.htm index.html
+          Options Indexes FollowSymLinks MultiViews Includes
+          AllowOverride all
+          Require all granted
+        </Directory>
+          ''
+      ];
+    };
+  };
+}
+
similarity index 71%
rename from modules/private/websites/patrick_fodella/production.nix
rename to modules/private/websites/patrick_fodella/ecolyeu.nix
index 2812cf7b402a9a6e54660aaad043b96fb22b0589..00dab76c12d4f06fd79ca1662e53f36b5efd6525 100644 (file)
@@ -1,24 +1,24 @@
 { lib, pkgs, config,  ... }:
 let
-  cfg = config.myServices.websites.patrick_fodella.production;
-  varDir = "/var/lib/ftp/patrick_fodella";
+  cfg = config.myServices.websites.patrick_fodella.ecolyeu;
+  varDir = "/var/lib/ftp/patrick_fodella/ecolyeu_pessicart";
   apacheUser = config.services.httpd.Prod.user;
   apacheGroup = config.services.httpd.Prod.group;
 in {
-  options.myServices.websites.patrick_fodella.production.enable = lib.mkEnableOption "enable Patrick Fodella's website";
+  options.myServices.websites.patrick_fodella.ecolyeu.enable = lib.mkEnableOption "enable Patrick Fodella Ecolyeu's website";
 
   config = lib.mkIf cfg.enable {
     services.webstats.sites = [ { name = "ecolyeu-pessicart-nice.fr"; } ];
 
-    system.activationScripts.patrick_fodella = {
+    system.activationScripts.patrick_fodella_ecolyeu = {
       deps = [ "httpd" ];
       text = ''
-        install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/patrick_fodella
+        install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/patrick_fodella_ecolyeu
         '';
     };
-    systemd.services.phpfpm-patrick_fodella.after = lib.mkAfter [ "mysql.service" ];
-    systemd.services.phpfpm-patrick_fodella.wants = [ "mysql.service" ];
-    services.phpfpm.pools.patrick_fodella = {
+    systemd.services.phpfpm-patrick_fodella_ecolyeu.after = lib.mkAfter [ "mysql.service" ];
+    systemd.services.phpfpm-patrick_fodella_ecolyeu.wants = [ "mysql.service" ];
+    services.phpfpm.pools.patrick_fodella_ecolyeu = {
       user = apacheUser;
       group = apacheGroup;
       settings = {
@@ -29,8 +29,8 @@ in {
         "pm.max_children" = "5";
         "pm.process_idle_timeout" = "60";
 
-        "php_admin_value[open_basedir]" = "/var/lib/php/sessions/patrick_fodella:${varDir}:/tmp";
-        "php_admin_value[session.save_path]" = "/var/lib/php/sessions/patrick_fodella";
+        "php_admin_value[open_basedir]" = "/var/lib/php/sessions/patrick_fodella_ecolyeu:${varDir}:/tmp";
+        "php_admin_value[session.save_path]" = "/var/lib/php/sessions/patrick_fodella_ecolyeu";
       };
       phpOptions = config.services.phpfpm.phpOptions + ''
         disable_functions = "mail"
@@ -38,7 +38,7 @@ in {
       phpPackage = pkgs.php72;
     };
     services.websites.env.production.modules = [ "proxy_fcgi" ];
-    services.websites.env.production.vhostConfs.patrick_fodella = {
+    services.websites.env.production.vhostConfs.patrick_fodella_ecolyeu = {
       certName     = "patrick_fodella";
       certMainHost = "ecolyeu-pessicart-nice.fr";
       hosts        = ["ecolyeu-pessicart-nice.fr" "www.ecolyeu-pessicart-nice.fr" ];
@@ -52,7 +52,7 @@ in {
         RewriteRule ^(.+)$ https://www.ecolyeu-pessicart-nice.fr$1 [R=302,L]
 
         <FilesMatch "\.php$">
-          SetHandler "proxy:unix:${config.services.phpfpm.pools.patrick_fodella.socket}|fcgi://localhost"
+          SetHandler "proxy:unix:${config.services.phpfpm.pools.patrick_fodella_ecolyeu.socket}|fcgi://localhost"
         </FilesMatch>
 
         <Location /xmlrpc.php>