]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Move integration websites to use stable web directory
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sat, 16 Feb 2019 13:09:27 +0000 (14:09 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Sat, 16 Feb 2019 13:09:27 +0000 (14:09 +0100)
This permits to avoir having to restart httpd at each application
deployment

12 files changed:
nixops/modules/websites/aten/aten.nix
nixops/modules/websites/aten/default.nix
nixops/modules/websites/chloe/chloe.nix
nixops/modules/websites/chloe/default.nix
nixops/modules/websites/connexionswing/connexionswing.nix
nixops/modules/websites/connexionswing/default.nix
nixops/modules/websites/ludivine/default.nix
nixops/modules/websites/ludivine/ludivinecassal.nix
nixops/modules/websites/piedsjaloux/default.nix
nixops/modules/websites/piedsjaloux/piedsjaloux.nix
nixops/modules/websites/tellesflorian/default.nix
nixops/modules/websites/tellesflorian/tellesflorian.nix

index 1910a67a7afbe7739b67c6f4338e67fe3d8e09b7..f986ec12e4a0a14a2b09a53339f7fa0c453a0d43 100644 (file)
@@ -29,10 +29,12 @@ let
         pm.max_spare_servers = 3
         ''}'';
     };
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "aten_${environment}";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
       <FilesMatch "\.php$">
         SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
@@ -64,7 +66,7 @@ let
       </Location>
       ''}
 
-      <Directory ${webRoot}>
+      <Directory ${if environment == "dev" then root else webRoot}>
         Options Indexes FollowSymLinks MultiViews Includes
         AllowOverride All
         Require all granted
index db2ab491fa14c76492f92f01c7c1f0156b8ba3f1..f586ed5a48bb7d66844679706cea46d0470dbabb 100644 (file)
@@ -42,6 +42,10 @@ in {
 
       services.myPhpfpm.poolConfigs.aten_prod = aten_prod.phpFpm.pool;
       system.activationScripts.aten_prod = aten_prod.activationScript;
+      system.extraSystemBuilderCmds = ''
+        mkdir -p $out/webapps
+        ln -s ${aten_prod.webRoot} $out/webapps/${aten_prod.apache.webappName}
+        '';
       services.myWebsites.apacheConfig.aten_prod.modules = aten_prod.apache.modules;
       services.myWebsites.production.modules = aten_prod.apache.modules;
       services.myWebsites.production.vhostConfs.aten = {
@@ -55,11 +59,15 @@ in {
       security.acme.certs."eldiron".extraDomains."dev.aten.pro" = null;
       services.myPhpfpm.poolConfigs.aten_dev = aten_dev.phpFpm.pool;
       system.activationScripts.aten_dev = aten_dev.activationScript;
+      system.extraSystemBuilderCmds = ''
+        mkdir -p $out/webapps
+        ln -s ${aten_dev.webRoot} $out/webapps/${aten_dev.apache.webappName}
+        '';
       services.myWebsites.integration.modules = aten_dev.apache.modules;
       services.myWebsites.integration.vhostConfs.aten = {
         certName    = "eldiron";
         hosts       = [ "dev.aten.pro" ];
-        root        = aten_dev.webRoot;
+        root        = aten_dev.apache.root;
         extraConfig = [ aten_dev.apache.vhostConf ];
       };
     })
index 9752db63b7f81c059100e2875a4ae3a2c97ca25a..3b92af33242f4bc8e8190b11bf5587145262b95f 100644 (file)
@@ -40,10 +40,12 @@ let
         pm.max_spare_servers = 3
         ''}'';
     };
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "chloe_${environment}";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
         RewriteEngine On
         ${if environment == "prod" then ''
@@ -54,16 +56,16 @@ let
           SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
         </FilesMatch>
 
-        <Directory ${webRoot}>
+        <Directory ${if environment == "dev" then root else webRoot}>
           DirectoryIndex index.php index.htm index.html
           Options -Indexes +FollowSymLinks +MultiViews +Includes
-          Include ${webRoot}/htaccess.txt
+          Include ${if environment == "dev" then root else webRoot}/htaccess.txt
 
           AllowOverride AuthConfig FileInfo Limit
           Require all granted
         </Directory>
 
-        <DirectoryMatch "${webRoot}/squelettes">
+        <DirectoryMatch "${if environment == "dev" then root else webRoot}/squelettes">
           Require all denied
         </DirectoryMatch>
 
index 94cd4be5e7e0b99fadf03b93bbb0ccce5ac48cee..d647eb915c7e789a26f754e7cf385e5644d15b2f 100644 (file)
@@ -45,6 +45,10 @@ in {
         extension=${pkgs.php}/lib/php/extensions/mysqli.so
         '';
       system.activationScripts.chloe_prod = chloe_prod.activationScript;
+      system.extraSystemBuilderCmds = ''
+        mkdir -p $out/webapps
+        ln -s ${chloe_prod.webRoot} $out/webapps/${chloe_prod.apache.webappName}
+        '';
       services.myWebsites.production.modules = chloe_prod.apache.modules;
       services.myWebsites.production.vhostConfs.chloe = {
         certName    = "chloe";
@@ -60,11 +64,15 @@ in {
         extension=${pkgs.php}/lib/php/extensions/mysqli.so
         '';
       system.activationScripts.chloe_dev = chloe_dev.activationScript;
+      system.extraSystemBuilderCmds = ''
+        mkdir -p $out/webapps
+        ln -s ${chloe_dev.webRoot} $out/webapps/${chloe_dev.apache.webappName}
+        '';
       services.myWebsites.integration.modules = chloe_dev.apache.modules;
       services.myWebsites.integration.vhostConfs.chloe = {
         certName    = "eldiron";
         hosts       = ["chloe.immae.eu" ];
-        root        = chloe_dev.webRoot;
+        root        = chloe_dev.apache.root;
         extraConfig = [ chloe_dev.apache.vhostConf ];
       };
     })
index 307def0ad5b619d057aef27aaa21e9d27b96d5b6..dff563f511a847b7f1683478aa954d12645ca45d 100644 (file)
@@ -56,10 +56,12 @@ let
         pm.max_spare_servers = 3
         ''}'';
     };
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "connexionswing_${environment}";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
       <FilesMatch "\.php$">
         SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
@@ -84,7 +86,7 @@ let
         ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://connexionswing.com\"></html>"
       </Location>
 
-      <Directory ${webRoot}>
+      <Directory ${root}>
         Options Indexes FollowSymLinks MultiViews Includes
         AllowOverride None
         Require all granted
index 5ce3525f2e53eff22fca6acb580e3b115d33971b..f176762d3e308b751124d563fa376eb676c50f93 100644 (file)
@@ -45,6 +45,10 @@ in {
       services.myPhpfpm.poolConfigs.connexionswing_prod = connexionswing_prod.phpFpm.pool;
       services.myPhpfpm.poolPhpConfigs.connexionswing_prod = connexionswing_prod.phpFpm.phpConfig;
       system.activationScripts.connexionswing_prod = connexionswing_prod.activationScript;
+      system.extraSystemBuilderCmds = ''
+        mkdir -p $out/webapps
+        ln -s ${connexionswing_prod.webRoot} $out/webapps/${connexionswing_prod.apache.webappName}
+        '';
       services.myWebsites.production.modules = connexionswing_prod.apache.modules;
       services.myWebsites.production.vhostConfs.connexionswing = {
         certName    = "connexionswing";
@@ -59,11 +63,15 @@ in {
       services.myPhpfpm.poolConfigs.connexionswing_dev = connexionswing_dev.phpFpm.pool;
       services.myPhpfpm.poolPhpConfigs.connexionswing_dev = connexionswing_dev.phpFpm.phpConfig;
       system.activationScripts.connexionswing_dev = connexionswing_dev.activationScript;
+      system.extraSystemBuilderCmds = ''
+        mkdir -p $out/webapps
+        ln -s ${connexionswing_dev.webRoot} $out/webapps/${connexionswing_dev.apache.webappName}
+        '';
       services.myWebsites.integration.modules = connexionswing_dev.apache.modules;
       services.myWebsites.integration.vhostConfs.connexionswing = {
         certName    = "eldiron";
         hosts       = ["connexionswing.immae.eu" "sandetludo.immae.eu" ];
-        root        = connexionswing_dev.webRoot;
+        root        = connexionswing_dev.apache.root;
         extraConfig = [ connexionswing_dev.apache.vhostConf ];
       };
     })
index d13d7004ceef7dceb4f1f8232e428ffc3e550d29..bcbef51a818a99d795674f8d3e99c5351714416b 100644 (file)
@@ -38,6 +38,10 @@ in {
 
       services.myPhpfpm.poolConfigs.ludivinecassal_prod = ludivinecassal_prod.phpFpm.pool;
       system.activationScripts.ludivinecassal_prod = ludivinecassal_prod.activationScript;
+      system.extraSystemBuilderCmds = ''
+        mkdir -p $out/webapps
+        ln -s ${ludivinecassal_prod.webRoot} $out/webapps/${ludivinecassal_prod.apache.webappName}
+        '';
       services.myWebsites.production.modules = ludivinecassal_prod.apache.modules;
       services.myWebsites.production.vhostConfs.ludivine = {
         certName    = "ludivinecassal";
@@ -51,12 +55,16 @@ in {
 
       services.myPhpfpm.poolConfigs.ludivinecassal_dev = ludivinecassal_dev.phpFpm.pool;
       system.activationScripts.ludivinecassal_dev = ludivinecassal_dev.activationScript;
+      system.extraSystemBuilderCmds = ''
+        mkdir -p $out/webapps
+        ln -s ${ludivinecassal_dev.webRoot} $out/webapps/${ludivinecassal_dev.apache.webappName}
+        '';
       services.myWebsites.apacheConfig.ludivinecassal_dev.modules = ludivinecassal_dev.apache.modules;
       services.myWebsites.integration.modules = ludivinecassal_dev.apache.modules;
       services.myWebsites.integration.vhostConfs.ludivine = {
         certName    = "eldiron";
         hosts       = [ "ludivine.immae.eu" ];
-        root        = ludivinecassal_dev.webRoot;
+        root        = ludivinecassal_dev.apache.root;
         extraConfig = [ ludivinecassal_dev.apache.vhostConf ];
       };
     })
index 4ce06b2ec2a7c09a435d19e92c0595b9c7759cf0..02614a53016bf53fdea57c8297090255ec869b97 100644 (file)
@@ -60,10 +60,12 @@ let
         pm.max_spare_servers = 3
         ''}'';
     };
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "ludivine_${environment}";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
       <FilesMatch "\.php$">
         SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
@@ -76,7 +78,7 @@ let
         ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://ludivinecassal.com\"></html>"
       </Location>
 
-      <Directory ${webRoot}>
+      <Directory ${root}>
         Options Indexes FollowSymLinks MultiViews Includes
         AllowOverride None
         Require all granted
index f1bb76039b3c74791ba2f4f88097a72a31614c91..584e936fc9de43298f3c9eb37909f67cf5d7001b 100644 (file)
@@ -42,6 +42,10 @@ in {
 
       services.myPhpfpm.poolConfigs.piedsjaloux_prod = piedsjaloux_prod.phpFpm.pool;
       system.activationScripts.piedsjaloux_prod = piedsjaloux_prod.activationScript;
+      system.extraSystemBuilderCmds = ''
+        mkdir -p $out/webapps
+        ln -s ${piedsjaloux_prod.webRoot} $out/webapps/${piedsjaloux_prod.apache.webappName}
+        '';
       services.myWebsites.production.modules = piedsjaloux_prod.apache.modules;
       services.myWebsites.production.vhostConfs.piedsjaloux = {
         certName    = "piedsjaloux";
@@ -54,11 +58,15 @@ in {
       security.acme.certs."eldiron".extraDomains."piedsjaloux.immae.eu" = null;
       services.myPhpfpm.poolConfigs.piedsjaloux_dev = piedsjaloux_dev.phpFpm.pool;
       system.activationScripts.piedsjaloux_dev = piedsjaloux_dev.activationScript;
+      system.extraSystemBuilderCmds = ''
+        mkdir -p $out/webapps
+        ln -s ${piedsjaloux_dev.webRoot} $out/webapps/${piedsjaloux_dev.apache.webappName}
+        '';
       services.myWebsites.integration.modules = piedsjaloux_dev.apache.modules;
       services.myWebsites.integration.vhostConfs.piedsjaloux = {
         certName    = "eldiron";
         hosts       = [ "piedsjaloux.immae.eu" ];
-        root        = piedsjaloux_dev.webRoot;
+        root        = piedsjaloux_dev.apache.root;
         extraConfig = [ piedsjaloux_dev.apache.vhostConf ];
       };
     })
index 2871b0fa968d8af2c60ee34a0d2e0e239321d7cc..a2d9a12d62e93214b1fffa7b7c4acd7d4678e3a8 100644 (file)
@@ -49,10 +49,12 @@ let
         pm.max_spare_servers = 3
         ''}'';
     };
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "piedsjaloux_${environment}";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
       <FilesMatch "\.php$">
         SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
@@ -65,7 +67,7 @@ let
         ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://piedsjaloux.fr\"></html>"
       </Location>
 
-      <Directory ${webRoot}>
+      <Directory ${root}>
         Options Indexes FollowSymLinks MultiViews Includes
         AllowOverride None
         Require all granted
index f347169bf423cebadb255358162a13504b492185..389c4916c5e857271cfee5d753fad71c7ae93d40 100644 (file)
@@ -19,11 +19,15 @@ in {
     security.acme.certs."eldiron".extraDomains."app.tellesflorian.com" = null;
     services.myPhpfpm.poolConfigs.tellesflorian_dev = tellesflorian_dev.phpFpm.pool;
     system.activationScripts.tellesflorian_dev = tellesflorian_dev.activationScript;
+    system.extraSystemBuilderCmds = ''
+      mkdir -p $out/webapps
+      ln -s ${tellesflorian_dev.webRoot} $out/webapps/${tellesflorian_dev.apache.webappName}
+      '';
     services.myWebsites.integration.modules = adminer.apache.modules ++ tellesflorian_dev.apache.modules;
     services.myWebsites.integration.vhostConfs.tellesflorian = {
       certName    = "eldiron";
       hosts       = ["app.tellesflorian.com" ];
-      root        = tellesflorian_dev.webRoot;
+      root        = tellesflorian_dev.apache.root;
       extraConfig = [
         tellesflorian_dev.apache.vhostConf
         adminer.apache.vhostConf
index 028a235adef9115392b801bcdfcbf979e481d3e8..47142c8d46e33757252d975e639daef94368326e 100644 (file)
@@ -47,10 +47,12 @@ let
     passwords = writeText "tellesflorian_passwords" ''
       invite:${config.invite_passwords}
       '';
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "florian_${environment}";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
       <FilesMatch "\.php$">
         SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
@@ -68,7 +70,7 @@ let
         ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://tellesflorian.com\"></html>"
       </Location>
 
-      <Directory ${webRoot}>
+      <Directory ${root}>
         Options Indexes FollowSymLinks MultiViews Includes
         AllowOverride None
         Require all granted
@@ -109,7 +111,7 @@ let
 
       </Directory>
       '' else ''
-      <Directory ${webRoot}>
+      <Directory ${root}>
         Options Indexes FollowSymLinks MultiViews Includes
         AllowOverride All
         Require all granted