]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/chloe/production.nix
Add config for CI
[perso/Immae/Config/Nix.git] / modules / private / websites / chloe / production.nix
index 5cfc40cfef2cb38a0b30adbe0a5510faf9b62d70..211232cf2dd4d08a2dbe5f80459fa3af49166819 100644 (file)
@@ -9,35 +9,30 @@ let
     varDir = "/var/lib/chloe_production";
   };
   cfg = config.myServices.websites.chloe.production;
-  webappdir = config.services.websites.webappDirsPaths.chloe_production;
 in {
   options.myServices.websites.chloe.production.enable = lib.mkEnableOption "enable Chloe's website in production";
 
   config = lib.mkIf cfg.enable {
-    services.duplyBackup.profiles.chloe_production.rootDir = app.varDir;
-    secrets.keys = [
-      {
-        dest = "websites/chloe/production";
-        user = apacheUser;
-        group = apacheGroup;
-        permissions = "0400";
-        text = ''
-          SetEnv SPIP_CONFIG_DIR     "${./config}"
-          SetEnv SPIP_VAR_DIR        "${app.varDir}"
-          SetEnv SPIP_SITE           "chloe-${app.environment}"
-          SetEnv SPIP_LDAP_BASE      "dc=immae,dc=eu"
-          SetEnv SPIP_LDAP_HOST      "ldaps://ldap.immae.eu"
-          SetEnv SPIP_LDAP_SEARCH_DN "${ccfg.ldap.dn}"
-          SetEnv SPIP_LDAP_SEARCH_PW "${ccfg.ldap.password}"
-          SetEnv SPIP_LDAP_SEARCH    "${ccfg.ldap.filter}"
-          SetEnv SPIP_MYSQL_HOST     "${ccfg.mysql.host}"
-          SetEnv SPIP_MYSQL_PORT     "${ccfg.mysql.port}"
-          SetEnv SPIP_MYSQL_DB       "${ccfg.mysql.database}"
-          SetEnv SPIP_MYSQL_USER     "${ccfg.mysql.user}"
-          SetEnv SPIP_MYSQL_PASSWORD "${ccfg.mysql.password}"
-        '';
-      }
-    ];
+    secrets.keys."websites/chloe/production" = {
+      user = apacheUser;
+      group = apacheGroup;
+      permissions = "0400";
+      text = ''
+        SetEnv SPIP_CONFIG_DIR     "${./config}"
+        SetEnv SPIP_VAR_DIR        "${app.varDir}"
+        SetEnv SPIP_SITE           "chloe-${app.environment}"
+        SetEnv SPIP_LDAP_BASE      "dc=immae,dc=eu"
+        SetEnv SPIP_LDAP_HOST      "ldaps://ldap.immae.eu"
+        SetEnv SPIP_LDAP_SEARCH_DN "${ccfg.ldap.dn}"
+        SetEnv SPIP_LDAP_SEARCH_PW "${ccfg.ldap.password}"
+        SetEnv SPIP_LDAP_SEARCH    "${ccfg.ldap.filter}"
+        SetEnv SPIP_MYSQL_HOST     "${ccfg.mysql.host}"
+        SetEnv SPIP_MYSQL_PORT     "${ccfg.mysql.port}"
+        SetEnv SPIP_MYSQL_DB       "${ccfg.mysql.database}"
+        SetEnv SPIP_MYSQL_USER     "${ccfg.mysql.user}"
+        SetEnv SPIP_MYSQL_PASSWORD "${ccfg.mysql.password}"
+      '';
+    };
     services.webstats.sites = [ { name = "osteopathe-cc.fr"; } ];
 
     systemd.services.phpfpm-chloe_production.after = lib.mkAfter [ "mysql.service" ];
@@ -59,9 +54,6 @@ in {
         "pm.min_spare_servers" = "1";
         "pm.max_spare_servers" = "3";
       };
-      phpOptions = config.services.phpfpm.phpOptions + ''
-        extension=${pkgs.php72}/lib/php/extensions/mysqli.so
-      '';
       phpPackage = pkgs.php72;
     };
     system.activationScripts.chloe_production = {
@@ -71,13 +63,12 @@ in {
         install -m 0750 -o ${apacheUser} -g ${apacheGroup} -d ${app.varDir}/phpSessions
       '';
     };
-    services.websites.webappDirs.chloe_production = app.webRoot;
     services.websites.env.production.modules = [ "proxy_fcgi" ];
     services.websites.env.production.vhostConfs.chloe = {
       certName     = "chloe";
       certMainHost = "osteopathe-cc.fr";
       hosts        = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ];
-      root         = webappdir;
+      root         = app.webRoot;
       extraConfig  = [
         ''
           Use Stats osteopathe-cc.fr
@@ -95,16 +86,16 @@ in {
             SetHandler "proxy:unix:${config.services.phpfpm.pools.chloe_production.socket}|fcgi://localhost"
           </FilesMatch>
 
-          <Directory ${webappdir}>
+          <Directory ${app.webRoot}>
             DirectoryIndex index.php index.htm index.html
             Options -Indexes +FollowSymLinks +MultiViews +Includes
-            Include ${webappdir}/htaccess.txt
+            Include ${app.webRoot}/htaccess.txt
 
             AllowOverride AuthConfig FileInfo Limit
             Require all granted
           </Directory>
 
-          <DirectoryMatch "${webappdir}/squelettes">
+          <DirectoryMatch "${app.webRoot}/squelettes">
             Require all denied
           </DirectoryMatch>