- secrets.keys = piedsjaloux.keys;
- systemd.services.phpfpm-piedsjaloux_dev.after = lib.mkAfter piedsjaloux.phpFpm.serviceDeps;
- systemd.services.phpfpm-piedsjaloux_dev.wants = piedsjaloux.phpFpm.serviceDeps;
- systemd.services.phpfpm-piedsjaloux_dev.preStart = lib.mkAfter piedsjaloux.phpFpm.preStart;
- services.phpfpm.poolConfigs.piedsjaloux_dev = piedsjaloux.phpFpm.pool;
- system.activationScripts.piedsjaloux_dev = piedsjaloux.activationScript;
- system.extraSystemBuilderCmds = ''
- mkdir -p $out/webapps
- ln -s ${piedsjaloux.app.webRoot} $out/webapps/${piedsjaloux.apache.webappName}
+ services.phpfpm.pools.piedsjaloux_integration = {
+ user = config.services.httpd.Inte.user;
+ group = config.services.httpd.Inte.group;
+ settings = {
+ "listen.owner" = config.services.httpd.Inte.user;
+ "listen.group" = config.services.httpd.Inte.group;
+ "php_admin_value[open_basedir]" = builtins.concatStringsSep ":" [
+ ftpRoot
+ config.secrets.fullPaths."websites/piedsjaloux/integration"
+ "/tmp"
+ ];
+ "php_admin_value[session.save_handler]" = "redis";
+ "php_admin_value[session.save_path]" = "'unix:///run/redis-php-sessions/redis.sock?persistent=1&prefix=PiedsJaloux:Integration:'";
+ "php_admin_value[upload_max_filesize]" = "20M";
+ "php_admin_value[post_max_size]" = "20M";
+ #"php_admin_flag[log_errors]" = "on";
+ "pm" = "ondemand";
+ "pm.max_children" = "5";
+ "pm.process_idle_timeout" = "60";
+ };
+ phpEnv = {
+ SYMFONY_DEBUG_MODE = "\"yes\"";
+ };
+ phpPackage = pkgs.php74.withExtensions({ enabled, all }: enabled ++ [all.redis]);
+ };
+ systemd.services."phpfpm-piedsjaloux_integration" = {
+ after = lib.mkAfter ["mysql.service"];
+ wants = ["mysql.service"];
+ path = lib.mkAfter [ pkgs.gnutar pkgs.gzip pkgs.php74 ];
+ preStart = let
+ script = pkgs.writeScriptBin "piedsjaloux-integration-pre" ''
+ #! ${pkgs.stdenv.shell}
+
+ [ -f ${packagePath}/${branch}.tar.gz ] || exit 1
+
+ cd ${ftpRoot}
+ if ! [ -f .tarball_sum ] || ! sha256sum -c .tarball_sum; then
+ tar -xf ${packagePath}/${branch}.tar.gz --one-top-level=php_new
+ if [ -d php ]; then
+ mv php php_old
+ fi
+ mv php_new php
+ fi
+ cd php
+ rm -rf var/{logs,cache,data,miniatures,tmp}
+ ln -sf ${varDir}/{logs,cache,data,miniatures,tmp} var/
+ ln -sf ${config.secrets.fullPaths."websites/piedsjaloux/integration"} app/config/parameters.yml
+ SYMFONY_ENV=dev ./bin/console --env=dev cache:clear --no-warmup
+ sha256sum ${packagePath}/${branch}.tar.gz > ${ftpRoot}/.tarball_sum
+ '';
+ in
+ "/run/wrappers/bin/sudo -u ${config.services.httpd.Inte.user} ${script}/bin/piedsjaloux-integration-pre";
+ postStart = let
+ script = pkgs.writeScriptBin "piedsjaloux-integration-post" ''
+ #! ${pkgs.stdenv.shell}
+
+ cd ${ftpRoot}
+ if [ -d php_old ]; then
+ rm -rf php_old
+ fi
+ '';
+ in
+ "/run/wrappers/bin/sudo -u ${config.services.httpd.Inte.user} ${script}/bin/piedsjaloux-integration-post";
+ serviceConfig.TimeoutStartSec="infinity";
+ };
+ services.filesWatcher.phpfpm-piedsjaloux_integration = {
+ restart = true;
+ paths = [ "${packagePath}/${branch}.tar.gz" ];
+ };
+
+ system.activationScripts.piedsjaloux_integration = {
+ deps = ["users"];
+ text = ''
+ install -m 0700 -o ${config.services.httpd.Inte.user} -g ${config.services.httpd.Inte.group} -d ${ftpRoot}