echo
}
'';
-
- phpFpmPreStart = { app, varDir, keyFiles, actions }: ''
- if [ ! -f "${varDir}/currentWebappDir" -o \
- ! -f "${varDir}/currentKey" -o \
- "${app}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ] \
- || ! sha512sum -c --status ${varDir}/currentKey; then
- pushd ${app} > /dev/null
- ${builtins.concatStringsSep "\n " actions}
- popd > /dev/null
- echo -n "${app}" > ${varDir}/currentWebappDir
- sha512sum ${builtins.concatStringsSep " " keyFiles} > ${varDir}/currentKey
- fi
- '';
}
'';
};
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";