aboutsummaryrefslogtreecommitdiff
path: root/nixops/modules/websites/tools/tools
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-04-21 19:31:06 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-04-21 19:31:06 +0200
commit8eded9ecb6220bb26599419a4aaea1743d3d187e (patch)
tree45538fcc9fa3bc9476311c14af8d399b25110a2b /nixops/modules/websites/tools/tools
parent43fe68fb9fc66bda710974fe2a1a3321aa853303 (diff)
downloadNix-8eded9ecb6220bb26599419a4aaea1743d3d187e.tar.gz
Nix-8eded9ecb6220bb26599419a4aaea1743d3d187e.tar.zst
Nix-8eded9ecb6220bb26599419a4aaea1743d3d187e.zip
Move cache clearing of php applications to preStart systemd
Diffstat (limited to 'nixops/modules/websites/tools/tools')
-rw-r--r--nixops/modules/websites/tools/tools/default.nix3
-rw-r--r--nixops/modules/websites/tools/tools/wallabag.nix23
2 files changed, 17 insertions, 9 deletions
diff --git a/nixops/modules/websites/tools/tools/default.nix b/nixops/modules/websites/tools/tools/default.nix
index fc5b48d..1aa70b8 100644
--- a/nixops/modules/websites/tools/tools/default.nix
+++ b/nixops/modules/websites/tools/tools/default.nix
@@ -175,6 +175,9 @@ in {
175 ''; 175 '';
176 roundcubemail = roundcubemail.phpFpm.phpConfig; 176 roundcubemail = roundcubemail.phpFpm.phpConfig;
177 }; 177 };
178 services.myPhpfpm.preStart = {
179 wallabag = wallabag.phpFpm.preStart;
180 };
178 services.myPhpfpm.poolConfigs = { 181 services.myPhpfpm.poolConfigs = {
179 adminer = adminer.phpFpm.pool; 182 adminer = adminer.phpFpm.pool;
180 ttrss = ttrss.phpFpm.pool; 183 ttrss = ttrss.phpFpm.pool;
diff --git a/nixops/modules/websites/tools/tools/wallabag.nix b/nixops/modules/websites/tools/tools/wallabag.nix
index 0cacad3..f145bf3 100644
--- a/nixops/modules/websites/tools/tools/wallabag.nix
+++ b/nixops/modules/websites/tools/tools/wallabag.nix
@@ -119,15 +119,6 @@ let
119 activationScript = '' 119 activationScript = ''
120 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \ 120 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
121 ${varDir}/var ${varDir}/data/db ${varDir}/assets/images 121 ${varDir}/var ${varDir}/data/db ${varDir}/assets/images
122 if [ ! -f "${varDir}/currentWebappDir" -o \
123 "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ]; then
124 pushd ${webappDir} > /dev/null
125 $wrapperDir/sudo -u wwwrun ./bin/console --env=prod cache:clear
126 rm -rf /var/lib/wallabag/var/cache/pro_
127 $wrapperDir/sudo -u wwwrun ./bin/console --env=prod doctrine:migrations:migrate --no-interaction
128 popd > /dev/null
129 echo -n "${webappDir}" > ${varDir}/currentWebappDir
130 fi
131 ''; 122 '';
132 webRoot = "${webappDir}/web"; 123 webRoot = "${webappDir}/web";
133 # Domain migration: Table wallabag_entry contains whole 124 # Domain migration: Table wallabag_entry contains whole
@@ -169,6 +160,20 @@ let
169 ''; 160 '';
170 }; 161 };
171 phpFpm = rec { 162 phpFpm = rec {
163 preStart = ''
164 if [ ! -f "${varDir}/currentWebappDir" -o \
165 ! -f "${varDir}/currentKey" -o \
166 "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ] \
167 || ! sha512sum -c --status ${varDir}/currentKey; then
168 pushd ${webappDir} > /dev/null
169 /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=prod cache:clear
170 rm -rf /var/lib/wallabag/var/cache/pro_
171 /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=prod doctrine:migrations:migrate --no-interaction
172 popd > /dev/null
173 echo -n "${webappDir}" > ${varDir}/currentWebappDir
174 sha512sum /run/keys/webapps/tools-wallabag > ${varDir}/currentKey
175 fi
176 '';
172 serviceDeps = [ "postgresql.service" "openldap.service" "tools-wallabag-key.service" ]; 177 serviceDeps = [ "postgresql.service" "openldap.service" "tools-wallabag-key.service" ];
173 basedir = builtins.concatStringsSep ":" [ webappDir "/run/keys/webapps/tools-wallabag" varDir ]; 178 basedir = builtins.concatStringsSep ":" [ webappDir "/run/keys/webapps/tools-wallabag" varDir ];
174 socket = "/var/run/phpfpm/wallabag.sock"; 179 socket = "/var/run/phpfpm/wallabag.sock";