From 9247b444929061f32be9b003621e1da555ebc770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Mon, 3 Jun 2019 13:25:26 +0200 Subject: Fix files watcher path --- modules/private/websites/tools/tools/wallabag.nix | 26 ++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'modules/private/websites/tools/tools/wallabag.nix') diff --git a/modules/private/websites/tools/tools/wallabag.nix b/modules/private/websites/tools/tools/wallabag.nix index ba755e4..2912b2c 100644 --- a/modules/private/websites/tools/tools/wallabag.nix +++ b/modules/private/websites/tools/tools/wallabag.nix @@ -110,18 +110,20 @@ rec { ''; }; phpFpm = rec { - preStart = mylibs.phpFpmPreStart { - app = webappDir; - inherit varDir; - keyFiles = [ - "/var/secrets/webapps/tools-wallabag" - ]; - actions = [ - "/run/wrappers/bin/sudo -u wwwrun ./bin/console --env=prod cache:clear" - "rm -rf /var/lib/wallabag/var/cache/pro_" - "/run/wrappers/bin/sudo -u wwwrun ./bin/console --env=prod doctrine:migrations:migrate --no-interaction" - ]; - }; + 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=prod cache:clear + rm -rf /var/lib/wallabag/var/cache/pro_ + /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=prod doctrine:migrations:migrate --no-interaction + popd > /dev/null + echo -n "${webappDir}" > ${varDir}/currentWebappDir + sha512sum /var/secrets/webapps/tools-wallabag > ${varDir}/currentKey + fi + ''; serviceDeps = [ "postgresql.service" "openldap.service" ]; basedir = builtins.concatStringsSep ":" [ webappDir "/var/secrets/webapps/tools-wallabag" varDir ]; socket = "/var/run/phpfpm/wallabag.sock"; -- cgit v1.2.3