From 4360f70d7a9966593d9e04043fa0a75defc094e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 1 Jun 2019 12:22:13 +0200 Subject: Add phpFpm prestart script to lib --- modules/private/websites/florian/builder_app.nix | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'modules/private/websites/florian') 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 = '' -- cgit v1.2.3