]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/librezo/dolibarr_integration.nix
Migrate php sessions to redis
[perso/Immae/Config/Nix.git] / modules / private / websites / librezo / dolibarr_integration.nix
index f8e3bf47eeb086e89058d4173f66dcf48134c9b1..f292f12593bbc029c4e03b8c69bb058f8ee2b13c 100644 (file)
@@ -8,12 +8,6 @@ in {
   options.myServices.websites.librezo.dolibarrDev.enable = lib.mkEnableOption "enable Dolibarr website";
 
   config = lib.mkIf cfg.enable {
-    system.activationScripts.dolibarr = {
-      deps = [ "httpd" "users" ];
-      text = ''
-        install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/librezo
-      '';
-    };
     services.phpfpm.pools.librezo_dolibarr_dev = {
       user = apacheUser;
       group = apacheGroup;
@@ -27,13 +21,14 @@ in {
 
         "php_admin_value[upload_max_filesize]" = "100M";
         "php_admin_value[post_max_size]" = "100M";
-        "php_admin_value[open_basedir]" = "/var/lib/php/sessions/librezo:${varDir}:/tmp";
-        "php_admin_value[session.save_path]" = "/var/lib/php/sessions/librezo";
+        "php_admin_value[open_basedir]" = "${varDir}:/tmp";
+        "php_admin_value[session.save_handler]" = "redis";
+        "php_admin_value[session.save_path]" = "'unix:///run/redis-php-sessions/redis.sock?persistent=1&prefix=Librezo:DolibarrIntegration:'";
       };
       phpOptions = config.services.phpfpm.phpOptions + ''
         disable_functions = "mail"
       '';
-      phpPackage = pkgs.php74;
+      phpPackage = pkgs.php74.withExtensions({ enabled, all }: enabled ++ [all.redis]);
     };
     services.websites.env.production.modules = [ "proxy_fcgi" ];
     services.websites.env.integration.vhostConfs.librezo_dolibarr_dev = {