X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprivate%2Fwebsites%2Fchloe%2Fintegration.nix;h=533568ebd108a57db511d52acb9e7eb1a7a329e3;hb=7c5e6fe8b639e3175798c097170a0b94ca7326b7;hp=d49a85c084cfc473528943630a3ae0f90602cae8;hpb=f40f5b235b890f46770a22f005f8a0f664cf0562;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/private/websites/chloe/integration.nix b/modules/private/websites/chloe/integration.nix index d49a85c..533568e 100644 --- a/modules/private/websites/chloe/integration.nix +++ b/modules/private/websites/chloe/integration.nix @@ -1,39 +1,104 @@ -{ lib, pkgs, config, myconfig, ... }: +{ lib, pkgs, config, ... }: let - chloe = pkgs.callPackage ./builder.nix { - inherit (pkgs.webapps) chloe; - config = myconfig.env.websites.chloe.integration; - apacheUser = config.services.httpd.Inte.user; - apacheGroup = config.services.httpd.Inte.group; - }; - + apacheUser = config.services.httpd.Inte.user; + apacheGroup = config.services.httpd.Inte.group; + ccfg = config.myEnv.websites.chloe.integration; + webRoot = "/var/lib/ftp/immae/chloe"; + varDir = "/var/lib/ftp/immae/chloe_var"; cfg = config.myServices.websites.chloe.integration; in { options.myServices.websites.chloe.integration.enable = lib.mkEnableOption "enable Chloe's website in integration"; config = lib.mkIf cfg.enable { - secrets.keys = chloe.keys; - systemd.services.phpfpm-chloe_dev.after = lib.mkAfter chloe.phpFpm.serviceDeps; - systemd.services.phpfpm-chloe_dev.wants = chloe.phpFpm.serviceDeps; - services.phpfpm.pools.chloe_dev = { - listen = chloe.phpFpm.socket; - extraConfig = chloe.phpFpm.pool; - phpOptions = config.services.phpfpm.phpOptions + '' - extension=${pkgs.php}/lib/php/extensions/mysqli.so + secrets.keys."websites/chloe/integration" = { + user = apacheUser; + group = apacheGroup; + permissions = "0400"; + text = '' + SetEnv SPIP_CONFIG_DIR "${./config}" + SetEnv SPIP_VAR_DIR "${varDir}" + SetEnv SPIP_SITE "chloe-dev" + 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}" ''; }; - system.activationScripts.chloe_dev = chloe.activationScript; - system.extraSystemBuilderCmds = '' - mkdir -p $out/webapps - ln -s ${chloe.app.webRoot} $out/webapps/${chloe.apache.webappName} + systemd.services.phpfpm-chloe_integration.after = lib.mkAfter [ "mysql.service" ]; + systemd.services.phpfpm-chloe_integration.wants = [ "mysql.service" ]; + services.phpfpm.pools.chloe_integration = { + user = config.services.httpd.Inte.user; + group = config.services.httpd.Inte.group; + settings = { + "listen.owner" = apacheUser; + "listen.group" = apacheGroup; + "php_admin_value[upload_max_filesize]" = "20M"; + "php_admin_value[post_max_size]" = "20M"; + # "php_admin_flag[log_errors]" = "on"; + "php_admin_value[open_basedir]" = "${../../../../pkgs/webapps/spip/spip_mes_options.php}:${./config}:${webRoot}:${varDir}:/tmp"; + "php_admin_value[session.save_path]" = "${varDir}/phpSessions"; + "pm" = "ondemand"; + "pm.max_children" = "5"; + "pm.process_idle_timeout" = "60"; + }; + phpPackage = pkgs.php72; + }; + system.activationScripts.chloe_integration = { + deps = [ "wrappers" ]; + text = '' + install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d ${varDir} ${varDir}/IMG ${varDir}/tmp ${varDir}/local + install -m 0750 -o ${apacheUser} -g ${apacheGroup} -d ${varDir}/phpSessions ''; - services.websites.integration.modules = chloe.apache.modules; - services.websites.integration.vhostConfs.chloe = { - certName = "eldiron"; + }; + services.websites.env.integration.modules = [ "proxy_fcgi" ]; + services.websites.env.integration.vhostConfs.chloe_integration = { + certName = "integration"; addToCerts = true; - hosts = ["chloe.immae.eu" ]; - root = chloe.apache.root; - extraConfig = [ chloe.apache.vhostConf ]; + hosts = ["test.chc.immae.dev" ]; + root = webRoot; + extraConfig = [ + '' + Include ${config.secrets.fullPaths."websites/chloe/integration"} + + RewriteEngine On + + + SetHandler "proxy:unix:${config.services.phpfpm.pools.chloe_integration.socket}|fcgi://localhost" + + + + DirectoryIndex index.php index.htm index.html + Options -Indexes +FollowSymLinks +MultiViews +Includes + Include ${webRoot}/htaccess.txt + + AllowOverride AuthConfig FileInfo Limit + Require all granted + + + + Require all denied + + + + Require all denied + + + + Use LDAPConnect + Require ldap-group cn=chc.immae.dev,cn=httpd,ou=services,dc=immae,dc=eu + ErrorDocument 401 "" + + '' + ]; }; + services.websites.env.integration.watchPaths = [ + config.secrets.fullPaths."websites/chloe/integration" + ]; }; }