X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=nixops%2Fmodules%2Fwebsites%2Faten%2Faten.nix;fp=nixops%2Fmodules%2Fwebsites%2Faten%2Faten.nix;h=567dcd13dfc2fe7656f09a8db32d800ad18f3881;hb=8eded9ecb6220bb26599419a4aaea1743d3d187e;hp=6059eb6b85fd64eb07ae1d59c0054b1be88c9d83;hpb=43fe68fb9fc66bda710974fe2a1a3321aa853303;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/nixops/modules/websites/aten/aten.nix b/nixops/modules/websites/aten/aten.nix index 6059eb6..567dcd1 100644 --- a/nixops/modules/websites/aten/aten.nix +++ b/nixops/modules/websites/aten/aten.nix @@ -4,6 +4,18 @@ let environment = config.environment; varDir = "/var/lib/aten_${environment}"; phpFpm = rec { + preStart = '' + if [ ! -f "${varDir}/currentWebappDir" -o \ + ! -f "${varDir}/currentKey" -o \ + "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ] \ + || ! sha512sum -c --status ${varDir}/currentKey; then + pushd ${webappDir} > /dev/null + /run/wrappers/bin/sudo -u wwwrun APP_ENV=${environment} ./bin/console --env=${environment} cache:clear --no-warmup + popd > /dev/null + echo -n "${webappDir}" > ${varDir}/currentWebappDir + sha512sum /run/keys/webapps/${environment}-aten > ${varDir}/currentKey + fi + ''; serviceDeps = [ "postgresql.service" "${environment}-aten-key.service" ]; socket = "/var/run/phpfpm/aten-${environment}.sock"; pool = '' @@ -90,13 +102,6 @@ let text = '' install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions - if [ ! -f "${varDir}/currentWebappDir" -o \ - "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ]; then - pushd ${webappDir} > /dev/null - $wrapperDir/sudo -u wwwrun APP_ENV=${environment} ./bin/console --env=${environment} cache:clear --no-warmup - popd > /dev/null - echo -n "${webappDir}" > ${varDir}/currentWebappDir - fi ''; }; yarnModules = let