X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=nixops%2Fmodules%2Fwebsites%2Fconnexionswing%2Fconnexionswing.nix;fp=nixops%2Fmodules%2Fwebsites%2Fconnexionswing%2Fconnexionswing.nix;h=13d4fbabb228a794b5d9d05a98f2553b08b2e383;hb=8eded9ecb6220bb26599419a4aaea1743d3d187e;hp=2960c6a84e282d87ad8a3537d3c1cf7f76644d54;hpb=43fe68fb9fc66bda710974fe2a1a3321aa853303;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/nixops/modules/websites/connexionswing/connexionswing.nix b/nixops/modules/websites/connexionswing/connexionswing.nix index 2960c6a..13d4fba 100644 --- a/nixops/modules/websites/connexionswing/connexionswing.nix +++ b/nixops/modules/websites/connexionswing/connexionswing.nix @@ -33,6 +33,18 @@ let ''; }; 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 ./bin/console --env=${environment} cache:clear --no-warmup + popd > /dev/null + echo -n "${webappDir}" > ${varDir}/currentWebappDir + sha512sum /run/keys/webapps/${environment}-connexionswing > ${varDir}/currentKey + fi + ''; serviceDeps = [ "mysql.service" "${environment}-connexionswing-key.service" ]; socket = "/var/run/phpfpm/connexionswing-${environment}.sock"; phpConfig = '' @@ -151,13 +163,6 @@ let ${varDir}/uploads \ ${varDir}/var 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 ./bin/console --env=${environment} cache:clear --no-warmup - popd > /dev/null - echo -n "${webappDir}" > ${varDir}/currentWebappDir - fi ''; }; webappDir = composerEnv.buildPackage (