X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fprivate%2Fwebsites%2Fflorian%2Fbuilder_app.nix;h=c12663a7175e4fd09ff76f8e4886c885723926e9;hb=4360f70d7a9966593d9e04043fa0a75defc094e0;hp=e521f6ebfe6e8d2b7c6df46a1e97c8177af2c1b1;hpb=02d6e977e309355ae728422e26063090e8a2f193;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/private/websites/florian/builder_app.nix b/modules/private/websites/florian/builder_app.nix index e521f6e..c12663a 100644 --- a/modules/private/websites/florian/builder_app.nix +++ b/modules/private/websites/florian/builder_app.nix @@ -1,4 +1,4 @@ -{ apacheUser, apacheGroup, tellesflorian, config }: +{ apacheUser, apacheGroup, tellesflorian, mylibs, config }: rec { app = tellesflorian.override { inherit (config) environment; }; keys = [ @@ -33,18 +33,16 @@ rec { } ]; phpFpm = rec { - preStart = '' - if [ ! -f "${app.varDir}/currentWebappDir" -o \ - ! -f "${app.varDir}/currentKey" -o \ - "${app}" != "$(cat ${app.varDir}/currentWebappDir 2>/dev/null)" ] \ - || ! sha512sum -c --status ${app.varDir}/currentKey; then - pushd ${app} > /dev/null - /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=${app.environment} cache:clear --no-warmup - popd > /dev/null - echo -n "${app}" > ${app.varDir}/currentWebappDir - sha512sum /var/secrets/webapps/${app.environment}-tellesflorian > ${app.varDir}/currentKey - fi - ''; + preStart = mylibs.phpFpmPreStart { + inherit app; + inherit (app) varDir; + keyFiles = [ + "/var/secrets/webapps/${app.environment}-tellesflorian" + ]; + actions = [ + "/run/wrappers/bin/sudo -u wwwrun ./bin/console --env=${app.environment} cache:clear --no-warmup" + ]; + }; serviceDeps = [ "mysql.service" ]; socket = "/var/run/phpfpm/floriantelles-${app.environment}.sock"; pool = ''