chloe = { config }: rec {
environment = config.environment;
phpFpm = rec {
+ serviceDeps = [ "mysql.service" ];
socket = "/var/run/phpfpm/chloe-${environment}.sock";
pool = ''
listen = ${socket}
;php_admin_flag[log_errors] = on
php_admin_value[open_basedir] = "${../commons/spip/spip_mes_options.php}:${configDir}:${webRoot}:${varDir}:/tmp"
php_admin_value[session.save_path] = "${varDir}/phpSessions"
- env[SPIP_CONFIG_DIR] = "${configDir}"
- env[SPIP_VAR_DIR] = "${varDir}"
- env[SPIP_SITE] = "chloe-${environment}"
- env[SPIP_LDAP_BASE] = "dc=immae,dc=eu"
- env[SPIP_LDAP_HOST] = "ldaps://ldap.immae.eu"
- env[SPIP_LDAP_SEARCH_DN] = "${config.ldap.dn}"
- env[SPIP_LDAP_SEARCH_PW] = "${config.ldap.password}"
- env[SPIP_LDAP_SEARCH] = "${config.ldap.search}"
- env[SPIP_MYSQL_HOST] = "${config.mysql.host}"
- env[SPIP_MYSQL_PORT] = "${config.mysql.port}"
- env[SPIP_MYSQL_DB] = "${config.mysql.name}"
- env[SPIP_MYSQL_USER] = "${config.mysql.user}"
- env[SPIP_MYSQL_PASSWORD] = "${config.mysql.password}"
${if environment == "dev" then ''
pm = ondemand
pm.max_children = 5
pm.max_spare_servers = 3
''}'';
};
+ keys = [{
+ dest = "webapps/${environment}-chloe";
+ user = apache.user;
+ group = apache.group;
+ permissions = "0400";
+ text = ''
+ SetEnv SPIP_CONFIG_DIR "${configDir}"
+ SetEnv SPIP_VAR_DIR "${varDir}"
+ SetEnv SPIP_SITE "chloe-${environment}"
+ SetEnv SPIP_LDAP_BASE "dc=immae,dc=eu"
+ SetEnv SPIP_LDAP_HOST "ldaps://ldap.immae.eu"
+ SetEnv SPIP_LDAP_SEARCH_DN "${config.ldap.dn}"
+ SetEnv SPIP_LDAP_SEARCH_PW "${config.ldap.password}"
+ SetEnv SPIP_LDAP_SEARCH "${config.ldap.search}"
+ SetEnv SPIP_MYSQL_HOST "${config.mysql.host}"
+ SetEnv SPIP_MYSQL_PORT "${config.mysql.port}"
+ SetEnv SPIP_MYSQL_DB "${config.mysql.name}"
+ SetEnv SPIP_MYSQL_USER "${config.mysql.user}"
+ SetEnv SPIP_MYSQL_PASSWORD "${config.mysql.password}"
+ '';
+ }];
apache = rec {
user = "wwwrun";
group = "wwwrun";
webappName = "chloe_${environment}";
root = "/run/current-system/webapps/${webappName}";
vhostConf = ''
+ Include /var/secrets/webapps/${environment}-chloe
+
RewriteEngine On
${if environment == "prod" then ''
RewriteRule ^/news.rss /spip.php?page=backend&id_rubrique=1
SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
</FilesMatch>
- <Directory ${if environment == "dev" then root else webRoot}>
+ <Directory ${root}>
DirectoryIndex index.php index.htm index.html
Options -Indexes +FollowSymLinks +MultiViews +Includes
- Include ${if environment == "dev" then root else webRoot}/htaccess.txt
+ Include ${root}/htaccess.txt
AllowOverride AuthConfig FileInfo Limit
Require all granted
</Directory>
- <DirectoryMatch "${if environment == "dev" then root else webRoot}/squelettes">
+ <DirectoryMatch "${root}/squelettes">
Require all denied
</DirectoryMatch>
rm -rf IMG local tmp config/remove.txt
ln -sf ${../commons/spip/spip_mes_options.php} config/mes_options.php
echo "Require all denied" > "config/.htaccess"
- ln -sf ../../../../../${varDir}/{IMG,local} .
+ ln -sf ${varDir}/{IMG,local} .
'';
installPhase = ''
cp -a . $out