1 { lib, pkgs, config, ... }:
3 apacheUser = config.services.httpd.Inte.user;
4 apacheGroup = config.services.httpd.Inte.group;
5 ccfg = config.myEnv.websites.chloe.integration;
6 webRoot = "/var/lib/ftp/immae/chloe";
7 varDir = "/var/lib/ftp/immae/chloe_var";
8 cfg = config.myServices.websites.chloe.integration;
10 options.myServices.websites.chloe.integration.enable = lib.mkEnableOption "enable Chloe's website in integration";
12 config = lib.mkIf cfg.enable {
13 services.duplyBackup.profiles.chloe_integration.rootDir = app.varDir;
14 secrets.keys."websites/chloe/integration" = {
19 SetEnv SPIP_CONFIG_DIR "${./config}"
20 SetEnv SPIP_VAR_DIR "${varDir}"
21 SetEnv SPIP_SITE "chloe-dev"
22 SetEnv SPIP_LDAP_BASE "dc=immae,dc=eu"
23 SetEnv SPIP_LDAP_HOST "ldaps://ldap.immae.eu"
24 SetEnv SPIP_LDAP_SEARCH_DN "${ccfg.ldap.dn}"
25 SetEnv SPIP_LDAP_SEARCH_PW "${ccfg.ldap.password}"
26 SetEnv SPIP_LDAP_SEARCH "${ccfg.ldap.filter}"
27 SetEnv SPIP_MYSQL_HOST "${ccfg.mysql.host}"
28 SetEnv SPIP_MYSQL_PORT "${ccfg.mysql.port}"
29 SetEnv SPIP_MYSQL_DB "${ccfg.mysql.database}"
30 SetEnv SPIP_MYSQL_USER "${ccfg.mysql.user}"
31 SetEnv SPIP_MYSQL_PASSWORD "${ccfg.mysql.password}"
34 systemd.services.phpfpm-chloe_integration.after = lib.mkAfter [ "mysql.service" ];
35 systemd.services.phpfpm-chloe_integration.wants = [ "mysql.service" ];
36 services.phpfpm.pools.chloe_integration = {
37 user = config.services.httpd.Inte.user;
38 group = config.services.httpd.Inte.group;
40 "listen.owner" = apacheUser;
41 "listen.group" = apacheGroup;
42 "php_admin_value[upload_max_filesize]" = "20M";
43 "php_admin_value[post_max_size]" = "20M";
44 # "php_admin_flag[log_errors]" = "on";
45 "php_admin_value[open_basedir]" = "${../../../../pkgs/webapps/spip/spip_mes_options.php}:${./config}:${webRoot}:${varDir}:/tmp";
46 "php_admin_value[session.save_path]" = "${varDir}/phpSessions";
48 "pm.max_children" = "5";
49 "pm.process_idle_timeout" = "60";
51 phpPackage = pkgs.php72;
53 system.activationScripts.chloe_integration = {
54 deps = [ "wrappers" ];
56 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d ${varDir} ${varDir}/IMG ${varDir}/tmp ${varDir}/local
57 install -m 0750 -o ${apacheUser} -g ${apacheGroup} -d ${varDir}/phpSessions
60 services.websites.env.integration.modules = [ "proxy_fcgi" ];
61 services.websites.env.integration.vhostConfs.chloe_integration = {
62 certName = "integration";
64 hosts = ["chloe.immae.eu" ];
68 Include ${config.secrets.fullPaths."websites/chloe/integration"}
73 SetHandler "proxy:unix:${config.services.phpfpm.pools.chloe_integration.socket}|fcgi://localhost"
76 <Directory ${webRoot}>
77 DirectoryIndex index.php index.htm index.html
78 Options -Indexes +FollowSymLinks +MultiViews +Includes
79 Include ${webRoot}/htaccess.txt
81 AllowOverride AuthConfig FileInfo Limit
85 <DirectoryMatch "${webRoot}/squelettes">
89 <FilesMatch "(.htaccess|rewrite-rules|.gitignore)$">
95 Require ldap-group cn=chloe.immae.eu,cn=httpd,ou=services,dc=immae,dc=eu
96 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://osteopathe-cc.fr\"></html>"
101 services.websites.env.integration.watchPaths = [
102 config.secrets.fullPaths."websites/chloe/integration"