aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-06-03 13:25:26 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-06-03 13:25:26 +0200
commit9247b444929061f32be9b003621e1da555ebc770 (patch)
treed31ca3f426d28a984124de9d85bd12223c90422f
parent8164ed90c7fdd93fd035bce3dc1b3fc6bde9e30e (diff)
downloadNix-9247b444929061f32be9b003621e1da555ebc770.tar.gz
Nix-9247b444929061f32be9b003621e1da555ebc770.tar.zst
Nix-9247b444929061f32be9b003621e1da555ebc770.zip
Fix files watcher path
-rw-r--r--lib/private/default.nix13
-rw-r--r--modules/private/websites/tools/tools/default.nix2
-rw-r--r--modules/private/websites/tools/tools/wallabag.nix26
3 files changed, 15 insertions, 26 deletions
diff --git a/lib/private/default.nix b/lib/private/default.nix
index b04f7b3..c7d753a 100644
--- a/lib/private/default.nix
+++ b/lib/private/default.nix
@@ -17,17 +17,4 @@
17 echo 17 echo
18 } 18 }
19 ''; 19 '';
20
21 phpFpmPreStart = { app, varDir, keyFiles, actions }: ''
22 if [ ! -f "${varDir}/currentWebappDir" -o \
23 ! -f "${varDir}/currentKey" -o \
24 "${app}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ] \
25 || ! sha512sum -c --status ${varDir}/currentKey; then
26 pushd ${app} > /dev/null
27 ${builtins.concatStringsSep "\n " actions}
28 popd > /dev/null
29 echo -n "${app}" > ${varDir}/currentWebappDir
30 sha512sum ${builtins.concatStringsSep " " keyFiles} > ${varDir}/currentKey
31 fi
32 '';
33} 20}
diff --git a/modules/private/websites/tools/tools/default.nix b/modules/private/websites/tools/tools/default.nix
index 5ca9851..9908d99 100644
--- a/modules/private/websites/tools/tools/default.nix
+++ b/modules/private/websites/tools/tools/default.nix
@@ -303,7 +303,7 @@ in {
303 }; 303 };
304 304
305 services.websites.env.tools.watchPaths = [ 305 services.websites.env.tools.watchPaths = [
306 "/var/secrets/webapps/tools-wallabag" 306 "/var/secrets/webapps/tools-shaarli"
307 ]; 307 ];
308 services.filesWatcher.phpfpm-wallabag = { 308 services.filesWatcher.phpfpm-wallabag = {
309 restart = true; 309 restart = true;
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 {
110 ''; 110 '';
111 }; 111 };
112 phpFpm = rec { 112 phpFpm = rec {
113 preStart = mylibs.phpFpmPreStart { 113 preStart = ''
114 app = webappDir; 114 if [ ! -f "${varDir}/currentWebappDir" -o \
115 inherit varDir; 115 ! -f "${varDir}/currentKey" -o \
116 keyFiles = [ 116 "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ] \
117 "/var/secrets/webapps/tools-wallabag" 117 || ! sha512sum -c --status ${varDir}/currentKey; then
118 ]; 118 pushd ${webappDir} > /dev/null
119 actions = [ 119 /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=prod cache:clear
120 "/run/wrappers/bin/sudo -u wwwrun ./bin/console --env=prod cache:clear" 120 rm -rf /var/lib/wallabag/var/cache/pro_
121 "rm -rf /var/lib/wallabag/var/cache/pro_" 121 /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=prod doctrine:migrations:migrate --no-interaction
122 "/run/wrappers/bin/sudo -u wwwrun ./bin/console --env=prod doctrine:migrations:migrate --no-interaction" 122 popd > /dev/null
123 ]; 123 echo -n "${webappDir}" > ${varDir}/currentWebappDir
124 }; 124 sha512sum /var/secrets/webapps/tools-wallabag > ${varDir}/currentKey
125 fi
126 '';
125 serviceDeps = [ "postgresql.service" "openldap.service" ]; 127 serviceDeps = [ "postgresql.service" "openldap.service" ];
126 basedir = builtins.concatStringsSep ":" [ webappDir "/var/secrets/webapps/tools-wallabag" varDir ]; 128 basedir = builtins.concatStringsSep ":" [ webappDir "/var/secrets/webapps/tools-wallabag" varDir ];
127 socket = "/var/run/phpfpm/wallabag.sock"; 129 socket = "/var/run/phpfpm/wallabag.sock";