]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/ressourcerie_banon/production.nix
Migrate php sessions to redis
[perso/Immae/Config/Nix.git] / modules / private / websites / ressourcerie_banon / production.nix
index e68f7db22f156788b7af1d8c1c56481653d6b2fd..fb856853ead6c89c5f6d0ea867628ddb3253ef6f 100644 (file)
@@ -10,12 +10,6 @@ in {
   config = lib.mkIf cfg.enable {
     services.webstats.sites = [ { name = "ressourcerie-banon.org"; } ];
 
-    system.activationScripts.ressourcerie_banon = {
-      deps = [ "httpd" ];
-      text = ''
-        install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/ressourcerie_banon
-        '';
-    };
     systemd.services.phpfpm-ressourcerie_banon.after = lib.mkAfter [ "mysql.service" ];
     systemd.services.phpfpm-ressourcerie_banon.wants = [ "mysql.service" ];
     services.phpfpm.pools.ressourcerie_banon = {
@@ -31,13 +25,14 @@ in {
         "pm.min_spare_servers" = "1";
         "pm.max_spare_servers" = "3";
 
-        "php_admin_value[open_basedir]" = "/var/lib/php/sessions/ressourcerie_banon:${varDir}:/tmp";
-        "php_admin_value[session.save_path]" = "/var/lib/php/sessions/ressourcerie_banon";
+        "php_admin_value[session.save_handler]" = "redis";
+        "php_admin_value[session.save_path]" = "'unix:///run/redis-php-sessions/redis.sock?persistent=1&prefix=RessourcerieBanon:Production:'";
+        "php_admin_value[open_basedir]" = "${varDir}:/tmp";
       };
       phpOptions = config.services.phpfpm.phpOptions + ''
         disable_functions = "mail"
       '';
-      phpPackage = pkgs.php72;
+      phpPackage = pkgs.php72.withExtensions({ enabled, all }: enabled ++ [all.redis]);
     };
     services.websites.env.production.modules = [ "proxy_fcgi" ];
     services.websites.env.production.vhostConfs.ressourcerie_banon = {