domain = "naturaloutil.immae.eu";
};
- services.myPhpfpm.poolConfigs.jerome = let
- configFile = pkgs.writeText "naturaloutil.inc.php" ''
+ deployment.keys."prod-naturaloutil" = {
+ destDir = "/run/keys/webapps";
+ user = "wwwrun";
+ group = "wwwrun";
+ text = ''
<?php
$mysql_user = '${env.mysql.user}' ;
$mysql_server = '${env.mysql.host}' ;
'' else ""}
$database = connect_db($db, $mysql_server, $mysql_base, $mysql_user, $mysql_password);
?>
- '';
- in ''
+ '';
+ };
+ services.myPhpfpm.serviceDependencies.jerome = [ "mysql.service" "prod-naturaloutil-key.service" ];
+ services.myPhpfpm.poolConfigs.jerome = ''
listen = /run/phpfpm/naturaloutil.sock
user = wwwrun
group = wwwrun
pm.max_children = 5
pm.process_idle_timeout = 60
- env[BDD_CONNECT] = "${configFile}"
- php_admin_value[open_basedir] = "${configFile}:${varDir}:/tmp"
+ env[BDD_CONNECT] = "/run/keys/webapps/prod-naturaloutil"
+ php_admin_value[open_basedir] = "/run/keys/webapps/prod-naturaloutil:${varDir}:/tmp"
'';
services.myPhpfpm.poolPhpConfigs.jerome = ''
extension=${pkgs.php}/lib/php/extensions/mysqli.so
'';
};
davical = rec {
- config = writeText "davical_config.php" ''
+ keys."dav-davical" = {
+ destDir = "/run/keys/webapps";
+ user = apache.user;
+ group = apache.group;
+ permissions = "0700";
+ text = ''
<?php
$c->pg_connect[] = "dbname=${env.postgresql.database} user=${env.postgresql.user} host=${env.postgresql.socket} password=${env.postgresql.password}";
$c->do_not_sync_from_ldap = array('admin' => true);
include('drivers_ldap.php');
'';
+ };
webapp = stdenv.mkDerivation rec {
version = "1.1.7";
name = "davical-${version}";
installPhase = ''
mkdir -p $out
cp -ra config dba docs htdocs inc locale po scripts testing zonedb $out
- ln -s ${config} $out/config/config.php
+ ln -s /run/keys/webapps/dav-davical $out/config/config.php
'';
buildInputs = [ gettext ];
};
'';
};
phpFpm = rec {
- basedir = builtins.concatStringsSep ":" [ webapp config awl ];
+ serviceDeps = [ "postgresql.service" "openldap.service" "dav-davical-key.service" ];
+ basedir = builtins.concatStringsSep ":" [ webapp "/run/keys/webapps/dav-davical" awl ];
socket = "/var/run/phpfpm/davical.sock";
pool = ''
listen = ${socket}
config = lib.mkIf cfg.enable {
security.acme.certs."eldiron".extraDomains."dav.immae.eu" = null;
+ deployment.keys = davical.keys;
services.myWebsites.tools.modules = davical.apache.modules;
services.myWebsites.tools.vhostConfs.dav = {