]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/tools/tools/default.nix
Migrate phpbb and remove manual tools pages
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / tools / default.nix
index 97402f19176cdb0703681841793bb827f4bcf959..0cb7a1062ebc7520320d2b37b8a569b2dfd9f8bf 100644 (file)
@@ -38,6 +38,17 @@ let
   grocy = pkgs.callPackage ./grocy.nix {
     inherit (pkgs.webapps) grocy;
   };
+  phpbb = pkgs.callPackage ./phpbb.nix {
+    phpbb = (pkgs.webapps.phpbb.withLangs (l: [ l.fr ])).withExts (e: [
+      e.alfredoramos.markdown e.davidiq.mailinglist e.dmzx.mchat
+      e.empteintesduweb.monitoranswers e.lr94.autosubscribe
+      e.phpbbmodders.adduser ]);
+  };
+  webhooks = pkgs.callPackage ./webhooks.nix {
+    env = config.myEnv.tools.webhooks;
+  };
+
+  landing = pkgs.callPackage ./landing.nix {};
 
   cfg = config.myServices.websites.tools.tools;
   pcfg = config.services.phpfpm.pools;
@@ -53,7 +64,8 @@ in {
       ++ shaarli.keys
       ++ ttrss.keys
       ++ wallabag.keys
-      ++ yourls.keys;
+      ++ yourls.keys
+      ++ webhooks.keys;
 
     services.duplyBackup.profiles = {
       dokuwiki = dokuwiki.backups;
@@ -63,6 +75,7 @@ in {
       shaarli = shaarli.backups;
       ttrss = ttrss.backups;
       wallabag = wallabag.backups;
+      phpbb = phpbb.backups;
     };
 
     services.websites.env.tools.modules =
@@ -75,6 +88,7 @@ in {
       ++ rompr.apache.modules
       ++ shaarli.apache.modules
       ++ dokuwiki.apache.modules
+      ++ phpbb.apache.modules
       ++ ldap.apache.modules
       ++ kanboard.apache.modules;
 
@@ -104,17 +118,18 @@ in {
       certName    = "eldiron";
       addToCerts  = true;
       hosts       = ["tools.immae.eu" ];
-      root        = "/var/lib/ftp/tools.immae.eu";
+      root        = landing;
       extraConfig = [
         ''
           RedirectMatch 301 ^/vpn(.*)$         https://vpn.immae.eu$1
           RedirectMatch 301 ^/roundcube(.*)$   https://mail.immae.eu/roundcube$1
           RedirectMatch 301 ^/jappix(.*)$      https://im.immae.fr/converse
 
-          <Directory "/var/lib/ftp/tools.immae.eu">
-            DirectoryIndex index.php index.htm index.html
-            AllowOverride all
+          <Directory "${landing}">
+            DirectoryIndex index.html
+            AllowOverride None
             Require all granted
+
             <FilesMatch "\.php$">
               SetHandler "proxy:unix:${pcfg.tools.socket}|fcgi://localhost"
             </FilesMatch>
@@ -131,6 +146,7 @@ in {
         (ldap.apache.vhostConf pcfg.ldap.socket)
         (kanboard.apache.vhostConf pcfg.kanboard.socket)
         (grocy.apache.vhostConf pcfg.grocy.socket)
+        (phpbb.apache.vhostConf pcfg.phpbb.socket)
         ''
           Alias /paste /var/lib/fiche
           <Directory "/var/lib/fiche">
@@ -139,6 +155,23 @@ in {
             Require all granted
             Options -Indexes
           </Directory>
+
+          Alias /BIP39 /var/lib/buildbot/outputs/bip39
+          <Directory "/var/lib/buildbot/outputs/bip39">
+            DirectoryIndex index.html
+            AllowOverride None
+            Require all granted
+          </Directory>
+
+          Alias /webhooks ${config.secrets.location}/webapps/webhooks
+          <Directory "${config.secrets.location}/webapps/webhooks">
+            Options -Indexes
+            Require all granted
+            AllowOverride None
+            <FilesMatch "\.php$">
+              SetHandler "proxy:unix:${pcfg.tools.socket}|fcgi://localhost"
+            </FilesMatch>
+          </Directory>
         ''
       ];
     };
@@ -180,6 +213,10 @@ in {
         after = lib.mkAfter dokuwiki.phpFpm.serviceDeps;
         wants = dokuwiki.phpFpm.serviceDeps;
       };
+      phpfpm-phpbb = {
+        after = lib.mkAfter phpbb.phpFpm.serviceDeps;
+        wants = phpbb.phpFpm.serviceDeps;
+      };
       phpfpm-kanboard = {
         after = lib.mkAfter kanboard.phpFpm.serviceDeps;
         wants = kanboard.phpFpm.serviceDeps;
@@ -249,7 +286,13 @@ in {
 
           # Needed to avoid clashes in browser cookies (same domain)
           "php_value[session.name]" = "ToolsPHPSESSID";
-          "php_admin_value[open_basedir]" = "/run/wrappers/bin/sendmail:/var/lib/ftp/tools.immae.eu:/tmp";
+          "php_admin_value[open_basedir]" = builtins.concatStringsSep ":" [
+            "/run/wrappers/bin/sendmail" landing "/tmp"
+            "${config.secrets.location}/webapps/webhooks"
+          ];
+        };
+        phpEnv = {
+          CONTACT_EMAIL = config.myEnv.tools.contact;
         };
       };
       devtools = {
@@ -304,11 +347,16 @@ in {
         group = "wwwrun";
         settings = dokuwiki.phpFpm.pool;
       };
+      phpbb = {
+        user = "wwwrun";
+        group = "wwwrun";
+        settings = phpbb.phpFpm.pool;
+      };
       ldap = {
         user = "wwwrun";
         group = "wwwrun";
         settings = ldap.phpFpm.pool;
-        phpPackage = pkgs.php74;
+        phpPackage = pkgs.php72;
       };
       kanboard = {
         user = "wwwrun";
@@ -331,13 +379,15 @@ in {
       rompr = rompr.activationScript;
       shaarli = shaarli.activationScript;
       dokuwiki = dokuwiki.activationScript;
+      phpbb = phpbb.activationScript;
       kanboard = kanboard.activationScript;
       ldap = ldap.activationScript;
     };
 
-    myServices.websites.webappDirs = {
+    services.websites.webappDirs = {
       _adminer = adminer.webRoot;
       "${dokuwiki.apache.webappName}" = dokuwiki.webRoot;
+      "${phpbb.apache.webappName}" = phpbb.webRoot;
       "${ldap.apache.webappName}" = "${ldap.webRoot}/htdocs";
       "${rompr.apache.webappName}" = rompr.webRoot;
       "${shaarli.apache.webappName}" = shaarli.webRoot;