chloe = { config }: rec {
environment = config.environment;
phpFpm = rec {
+ serviceDeps = [ "mysql.service" "${environment}-chloe-key.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."${environment}-chloe" = {
+ destDir = "/run/keys/webapps";
+ 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 /run/keys/webapps/${environment}-chloe
+
RewriteEngine On
${if environment == "prod" then ''
RewriteRule ^/news.rss /spip.php?page=backend&id_rubrique=1
config = lib.mkMerge [
(lib.mkIf cfg.production.enable {
+ deployment.keys = chloe_prod.keys;
services.myWebsites.commons.stats.enable = true;
services.myWebsites.commons.stats.sites = [
{
};
};
+ services.myPhpfpm.serviceDependencies.chloe_prod = chloe_prod.phpFpm.serviceDeps;
services.myPhpfpm.poolConfigs.chloe_prod = chloe_prod.phpFpm.pool;
services.myPhpfpm.poolPhpConfigs.chloe_prod = ''
extension=${pkgs.php}/lib/php/extensions/mysqli.so
};
})
(lib.mkIf cfg.integration.enable {
+ deployment.keys = chloe_dev.keys;
security.acme.certs."eldiron".extraDomains."chloe.immae.eu" = null;
+ services.myPhpfpm.serviceDependencies.chloe_dev = chloe_dev.phpFpm.serviceDeps;
services.myPhpfpm.poolConfigs.chloe_dev = chloe_dev.phpFpm.pool;
services.myPhpfpm.poolPhpConfigs.chloe_dev = ''
extension=${pkgs.php}/lib/php/extensions/mysqli.so