X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprivate%2Fwebsites%2Ftools%2Ftools%2Fwallabag.nix;h=ba755e4d514fbc3636960f0f0e906f138a528e8c;hb=4360f70d7a9966593d9e04043fa0a75defc094e0;hp=d6e588285e19eaa4159d633237d04afdcca439ac;hpb=4288c2f2431fb782b0d512b1b3749187f2374b6a;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/private/websites/tools/tools/wallabag.nix b/modules/private/websites/tools/tools/wallabag.nix index d6e5882..ba755e4 100644 --- a/modules/private/websites/tools/tools/wallabag.nix +++ b/modules/private/websites/tools/tools/wallabag.nix @@ -1,4 +1,4 @@ -{ env, wallabag }: +{ env, wallabag, mylibs }: rec { varDir = "/var/lib/wallabag"; keys = [{ @@ -110,20 +110,18 @@ rec { ''; }; 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=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 - ''; + 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" + ]; + }; serviceDeps = [ "postgresql.service" "openldap.service" ]; basedir = builtins.concatStringsSep ":" [ webappDir "/var/secrets/webapps/tools-wallabag" varDir ]; socket = "/var/run/phpfpm/wallabag.sock";