]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Move tools websites to stable web directories
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sat, 16 Feb 2019 14:31:07 +0000 (15:31 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Sat, 16 Feb 2019 15:11:15 +0000 (16:11 +0100)
19 files changed:
nixops/modules/websites/tools/cloud/default.nix
nixops/modules/websites/tools/cloud/nextcloud.nix
nixops/modules/websites/tools/dav/davical.nix
nixops/modules/websites/tools/dav/default.nix
nixops/modules/websites/tools/dav/infcloud.nix
nixops/modules/websites/tools/diaspora/default.nix
nixops/modules/websites/tools/git/default.nix
nixops/modules/websites/tools/git/gitweb/gitweb.nix
nixops/modules/websites/tools/git/mantisbt/mantisbt.nix
nixops/modules/websites/tools/mastodon/default.nix
nixops/modules/websites/tools/tools/default.nix
nixops/modules/websites/tools/tools/dokuwiki.nix
nixops/modules/websites/tools/tools/ldap.nix
nixops/modules/websites/tools/tools/rompr.nix
nixops/modules/websites/tools/tools/roundcubemail.nix
nixops/modules/websites/tools/tools/shaarli.nix
nixops/modules/websites/tools/tools/ttrss.nix
nixops/modules/websites/tools/tools/wallabag.nix
nixops/modules/websites/tools/tools/yourls.nix

index f014776c88efaa32d083ed6b7a0b3610e5a33074..360d52c5ae97396d68fe95c8975ed35ce6e44e07 100644 (file)
@@ -18,7 +18,7 @@ in {
     services.myWebsites.tools.vhostConfs.cloud = {
       certName    = "eldiron";
       hosts       = ["cloud.immae.eu" ];
-      root        = nextcloud.webRoot;
+      root        = nextcloud.apache.root;
       extraConfig = [
         nextcloud.apache.vhostConf
       ];
@@ -37,6 +37,10 @@ in {
     in [ occ ];
 
     system.activationScripts.nextcloud = nextcloud.activationScript;
+    system.extraSystemBuilderCmds = ''
+      mkdir -p $out/webapps
+      ln -s ${nextcloud.webRoot} $out/webapps/${nextcloud.apache.webappName}
+      '';
 
     services.myPhpfpm = {
       poolPhpConfigs.nextcloud = nextcloud.phpFpm.phpConfig;
index ac77920a7afcde1880fa0d2c2125be2ba62a4ef0..d9e0be07731973da148418c2c575d90f62cee4f7 100644 (file)
@@ -214,13 +214,15 @@ let
         fi
       '';
     };
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "tools_nextcloud";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
         SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
-        <Directory ${webRoot}>
+        <Directory ${root}>
           AcceptPathInfo On
           DirectoryIndex index.php
           Options FollowSymlinks
index 3f43607312b740008ccde40da0540a5991e75360..6668fa18021add11aee0c0eb53fcca4ce5d806a5 100644 (file)
@@ -89,14 +89,16 @@ let
       buildInputs = [ gettext ];
     };
     webRoot = "${webapp}/htdocs";
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "tools_davical";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
-        Alias /davical "${webRoot}"
-        Alias /caldav.php  "${webRoot}/caldav.php"
-        <Directory "${webRoot}">
+        Alias /davical "${root}"
+        Alias /caldav.php  "${root}/caldav.php"
+        <Directory "${root}">
           DirectoryIndex index.php index.html
           AcceptPathInfo On
           AllowOverride None
index ef9735e4f40b87d1ff1f113bbe6b6c7458186cf2..5b5d21edba97b96e85127f436a4e20998362f1e9 100644 (file)
@@ -30,6 +30,11 @@ in {
       davical = davical.phpFpm.pool;
     };
 
+    system.extraSystemBuilderCmds = ''
+      mkdir -p $out/webapps
+      ln -s ${davical.webRoot} $out/webapps/${davical.apache.webappName}
+      ln -s ${infcloud.webRoot} $out/webapps/${infcloud.apache.webappName}
+      '';
   };
 }
 
index 876578b3f405403ef8422b01ab38484507eeb144..f1204abd1957ee63a36c5955d4ec1a839be897ab 100644 (file)
@@ -18,14 +18,16 @@ let
       '';
       buildInputs = [ ed ];
     };
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
+      webappName = "tools_infcloud";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
-        Alias /carddavmate ${webRoot}
-        Alias /caldavzap ${webRoot}
-        Alias /infcloud ${webRoot}
-        <Directory ${webRoot}>
+        Alias /carddavmate ${root}
+        Alias /caldavzap ${root}
+        Alias /infcloud ${root}
+        <Directory ${root}>
           AllowOverride All
           Options FollowSymlinks
           Require all granted
index 87faee848e4d6a2dc7e7dbb01ff13c34c06a97eb..cd35385dcd18465ea285730f2403a9c111bfe448 100644 (file)
@@ -5,6 +5,7 @@ let
     env = myconfig.env.tools.diaspora;
   };
 
+  root = "/run/current-system/webapps/tools_diaspora";
   cfg = config.services.myWebsites.tools.diaspora;
 in {
   options.services.myWebsites.tools.diaspora = {
@@ -80,10 +81,14 @@ in {
       "headers" "proxy" "proxy_http"
     ];
     security.acme.certs."eldiron".extraDomains."diaspora.immae.eu" = null;
+    system.extraSystemBuilderCmds = ''
+      mkdir -p $out/webapps
+      ln -s ${diaspora.railsRoot}/public/ $out/webapps/tools_diaspora
+      '';
     services.myWebsites.tools.vhostConfs.diaspora = {
       certName    = "eldiron";
       hosts       = [ "diaspora.immae.eu" ];
-      root        = "${diaspora.railsRoot}/public/";
+      root        = root;
       extraConfig = [ ''
         RewriteEngine On
         RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
@@ -98,7 +103,7 @@ in {
             Require all granted
         </Proxy>
 
-        <Directory ${diaspora.railsRoot}/public>
+        <Directory ${root}>
             Require all granted
             Options -MultiViews
         </Directory>
index 91aa1d042c7f19b41d52466b77017af8fe48ca10..2aa86cda6f9a72557f122e02a8245f99eb7db123 100644 (file)
@@ -26,11 +26,16 @@ in {
     services.myWebsites.tools.modules =
       gitweb.apache.modules ++
       mantisbt.apache.modules;
+    system.extraSystemBuilderCmds = ''
+      mkdir -p $out/webapps
+      ln -s ${gitweb.webRoot} $out/webapps/${gitweb.apache.webappName}
+      ln -s ${mantisbt.webRoot} $out/webapps/${mantisbt.apache.webappName}
+      '';
 
     services.myWebsites.tools.vhostConfs.git = {
       certName    = "eldiron";
       hosts       = ["git.immae.eu" ];
-      root        = gitweb.webRoot;
+      root        = gitweb.apache.root;
       extraConfig = [
         gitweb.apache.vhostConf
         mantisbt.apache.vhostConf
index 22c70f25acaabcb72567fd03a79894bacb9e4d47..2ee7a63a5b804b34684102271a7a3a7f2819a98e 100644 (file)
@@ -29,10 +29,12 @@ rec {
     $project_list_default_category = "__Others__";
     $highlight_bin = "${highlight}/bin/highlight";
     '';
-  apache = {
+  apache = rec {
     user = "wwwrun";
     group = "wwwrun";
     modules = [ "cgid" ];
+    webappName = "tools_gitweb";
+    root = "/run/current-system/webapps/${webappName}";
     vhostConf = ''
       SetEnv GIT_PROJECT_ROOT ${varDir}/repositories/
       ScriptAliasMatch \
@@ -44,13 +46,10 @@ rec {
                                   git-(upload|receive)-pack))$" \
                   ${git}/libexec/git-core/git-http-backend/$1
 
-      <Directory "${gitolite}">
-        Require all granted
-      </Directory>
       <Directory "${git}/libexec/git-core">
         Require all granted
       </Directory>
-      <Directory "${webRoot}">
+      <Directory "${root}">
         DirectoryIndex gitweb.cgi
         Require all granted
         AllowOverride None
index b1837eb49e2f09a4c587b1fe55a3a24acd538076..9bb8476c5a15d260e16b3a1361b18be2e20110b0 100644 (file)
@@ -72,13 +72,15 @@ let
         ln -s ${plugins.source-integration}/Source* $out/plugins/
       '';
     };
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "tools_mantisbt";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
-        Alias /mantisbt "${webRoot}"
-        <Directory "${webRoot}">
+        Alias /mantisbt "${root}"
+        <Directory "${root}">
           DirectoryIndex index.php
           <FilesMatch "\.php$">
             SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
@@ -88,7 +90,7 @@ let
           Options FollowSymlinks
           Require all granted
         </Directory>
-        <Directory "${webRoot}/admin">
+        <Directory "${root}/admin">
           #Reenable during upgrade
           Require all denied
         </Directory>
index 0aaff70ed6fe2719e11af07211d8fee87f2a2425..6e34280f30f6086951347ce6d5933db4b5abdc03 100644 (file)
@@ -5,6 +5,7 @@ let
     env = myconfig.env.tools.mastodon;
   };
 
+  root = "/run/current-system/webapps/tools_mastodon";
   cfg = config.services.myWebsites.tools.mastodon;
 in {
   options.services.myWebsites.tools.mastodon = {
@@ -138,10 +139,14 @@ in {
       "headers" "proxy" "proxy_wstunnel" "proxy_http"
     ];
     security.acme.certs."eldiron".extraDomains."mastodon.immae.eu" = null;
+    system.extraSystemBuilderCmds = ''
+      mkdir -p $out/webapps
+      ln -s ${mastodon.railsRoot}/public/ $out/webapps/tools_mastodon
+      '';
     services.myWebsites.tools.vhostConfs.mastodon = {
       certName    = "eldiron";
       hosts       = ["mastodon.immae.eu" ];
-      root        = "${mastodon.railsRoot}/public/";
+      root        = root;
       extraConfig = [ ''
         Header always set Referrer-Policy "strict-origin-when-cross-origin"
         Header always set Strict-Transport-Security "max-age=31536000"
@@ -178,7 +183,7 @@ in {
           Options -MultiViews
         </Directory>
 
-        <Directory ${mastodon.railsRoot}/public/>
+        <Directory ${root}>
           Require all granted
           Options -MultiViews +FollowSymlinks
         </Directory>
index 2060c79156490f7e6ecbc490dbf68bd0e41d94b1..7781928cfa86cf094779e77ca4c8d3df44e92079 100644 (file)
@@ -118,6 +118,18 @@ in {
       dokuwiki = dokuwiki.activationScript;
     };
 
+    system.extraSystemBuilderCmds = ''
+      mkdir -p $out/webapps
+      ln -s ${dokuwiki.webRoot} $out/webapps/${dokuwiki.apache.webappName}
+      ln -s ${ldap.webRoot}/htdocs $out/webapps/${ldap.apache.webappName}
+      ln -s ${rompr.webRoot} $out/webapps/${rompr.apache.webappName}
+      ln -s ${roundcubemail.webRoot} $out/webapps/${roundcubemail.apache.webappName}
+      ln -s ${shaarli.webRoot} $out/webapps/${shaarli.apache.webappName}
+      ln -s ${ttrss.webRoot} $out/webapps/${ttrss.apache.webappName}
+      ln -s ${wallabag.webRoot} $out/webapps/${wallabag.apache.webappName}
+      ln -s ${yourls.webRoot} $out/webapps/${yourls.apache.webappName}
+      '';
+
     nixpkgs.config.packageOverrides = oldpkgs: rec {
       ympd = oldpkgs.ympd.overrideAttrs(old: mylibs.fetchedGithub ./ympd.json);
     };
index 5affddb06b1cda709692aefc845527b15b9b62ae..ad1497f16179291a44145b80d9afdfb388c7adc8 100644 (file)
@@ -55,13 +55,15 @@ let
         )}
       '';
     });
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "tools_dokuwiki";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
-        Alias /dokuwiki "${webRoot}"
-        <Directory "${webRoot}">
+        Alias /dokuwiki "${root}"
+        <Directory "${root}">
           DirectoryIndex index.php
           <FilesMatch "\.php$">
             SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
index 82615a7f8b126a11235505f5cff36fe306551dfc..6cde881ccecb1f4133ffa656e9868de4c10cc472 100644 (file)
@@ -42,13 +42,15 @@ rec {
       ln -sf ${config} $out/config/config.php
     '';
   };
-  apache = {
+  apache = rec {
     user = "wwwrun";
     group = "wwwrun";
     modules = [ "proxy_fcgi" ];
+    webappName = "tools_ldap";
+    root = "/run/current-system/webapps/${webappName}";
     vhostConf = ''
-      Alias /ldap "${webRoot}/htdocs"
-      <Directory "${webRoot}/htdocs">
+      Alias /ldap "${root}"
+      <Directory "${root}">
         DirectoryIndex index.php
         <FilesMatch "\.php$">
           SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
index 98c48a7fe487159aea122feca149cbe3f43a78e4..baee2eb683068e021f7ca83fc3230a4c6c2c28c7 100644 (file)
@@ -14,14 +14,16 @@ let
         ln -sf ../../../../../../${varDir}/albumart $out/albumart
       '';
     });
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "headers" "mime" "proxy_fcgi" ];
+      webappName = "tools_rompr";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
-        Alias /rompr ${webRoot}
+        Alias /rompr ${root}
 
-        <Directory ${webRoot}>
+        <Directory ${root}>
           Options Indexes FollowSymLinks
           DirectoryIndex index.php
           AllowOverride all
@@ -36,12 +38,12 @@ let
           </FilesMatch>
         </Directory>
 
-        <Directory ${webRoot}/albumart/small>
+        <Directory ${root}/albumart/small>
             Header Set Cache-Control "max-age=0, no-store"
             Header Set Cache-Control "no-cache, must-revalidate"
         </Directory>
 
-        <Directory ${webRoot}/albumart/asdownloaded>
+        <Directory ${root}/albumart/asdownloaded>
             Header Set Cache-Control "max-age=0, no-store"
             Header Set Cache-Control "no-cache, must-revalidate"
         </Directory>
index 877ea8b9cbf501f79bde2cc470601b104961f569..c0a1125835cfc72c6e5141862fa4b7a59cc95615 100644 (file)
@@ -61,13 +61,15 @@ let
         )}
       '';
     };
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "tools_roundcubemail";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
-      Alias /roundcube "${webRoot}"
-      <Directory "${webRoot}">
+      Alias /roundcube "${root}"
+      <Directory "${root}">
           DirectoryIndex index.php
           AllowOverride All
           Options FollowSymlinks
index 9f3779f56e68c2aaa5e76601adf138f37146e401..a43d677c9c4ab39bbff274164777761b977c8e52 100644 (file)
@@ -40,14 +40,16 @@ in rec {
       ${varDir}/phpSessions
     '';
   webRoot = shaarli;
-  apache = {
+  apache = rec {
     user = "wwwrun";
     group = "wwwrun";
     modules =  [ "proxy_fcgi" "rewrite" "env" ];
+    webappName = "tools_shaarli";
+    root = "/run/current-system/webapps/${webappName}";
     vhostConf = ''
-      Alias /Shaarli "${webRoot}"
+      Alias /Shaarli "${root}"
 
-      <Directory "${webRoot}">
+      <Directory "${root}">
         SetEnv SHAARLI_LDAP_PASSWORD "${env.ldap.password}"
         SetEnv SHAARLI_LDAP_DN       "${env.ldap.dn}"
         SetEnv SHAARLI_LDAP_HOST     "ldaps://${env.ldap.host}"
index 9e6f98d4be435f3243dada8138660c710e72893c..c66b99d2780619b3b1c3fdddb7f08157f49ffaaf 100644 (file)
@@ -128,13 +128,15 @@ let
         )}
       '';
     });
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "tools_ttrss";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
-        Alias /ttrss "${webRoot}"
-        <Directory "${webRoot}">
+        Alias /ttrss "${root}"
+        <Directory "${root}">
           DirectoryIndex index.php
           <FilesMatch "\.php$">
             SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
index 1c08bbf63baabfafc74a0ef7279e896b0bbffffd..cd38e19a474f5006ef781daeadd4429d9624a8ee 100644 (file)
@@ -125,13 +125,15 @@ let
     webRoot = "${webappDir}/web";
     # Domain migration: Table wallabag_entry contains whole
     # https://tools.immae.eu/wallabag domain name in preview_picture
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "tools_wallabag";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
-        Alias /wallabag "${webRoot}"
-        <Directory "${webRoot}">
+        Alias /wallabag "${root}"
+        <Directory "${root}">
           AllowOverride None
           Require all granted
           # For OAuth (apps)
@@ -148,7 +150,7 @@ let
             RewriteRule ^(.*)$ app.php [QSA,L]
           </IfModule>
         </Directory>
-        <Directory "${webRoot}/bundles">
+        <Directory "${root}/bundles">
           <IfModule mod_rewrite.c>
             RewriteEngine Off
           </IfModule>
index 66dd2fd22c976a1626226976692f5acb8135bba5..b12edfa3d5c44ea5fb913551e6006f14e304ecc2 100644 (file)
@@ -52,13 +52,15 @@ let
         )}
       '';
     });
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "tools_yourls";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
-        Alias /url "${webRoot}"
-        <Directory "${webRoot}">
+        Alias /url "${root}"
+        <Directory "${root}">
           <FilesMatch "\.php$">
             SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
           </FilesMatch>