aboutsummaryrefslogtreecommitdiff
path: root/nixops/modules/websites/tellesflorian
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/tellesflorian
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/tellesflorian')
-rw-r--r--nixops/modules/websites/tellesflorian/default.nix1
-rw-r--r--nixops/modules/websites/tellesflorian/tellesflorian.nix19
2 files changed, 13 insertions, 7 deletions
diff --git a/nixops/modules/websites/tellesflorian/default.nix b/nixops/modules/websites/tellesflorian/default.nix
index 171d2e7..9bf4a48 100644
--- a/nixops/modules/websites/tellesflorian/default.nix
+++ b/nixops/modules/websites/tellesflorian/default.nix
@@ -18,6 +18,7 @@ in {
18 config = lib.mkIf cfg.integration.enable { 18 config = lib.mkIf cfg.integration.enable {
19 deployment.keys = tellesflorian_dev.keys; 19 deployment.keys = tellesflorian_dev.keys;
20 security.acme.certs."eldiron".extraDomains."app.tellesflorian.com" = null; 20 security.acme.certs."eldiron".extraDomains."app.tellesflorian.com" = null;
21 services.myPhpfpm.preStart.tellesflorian_dev = tellesflorian_dev.phpFpm.preStart;
21 services.myPhpfpm.serviceDependencies.tellesflorian_dev = tellesflorian_dev.phpFpm.serviceDeps; 22 services.myPhpfpm.serviceDependencies.tellesflorian_dev = tellesflorian_dev.phpFpm.serviceDeps;
22 services.myPhpfpm.poolConfigs.tellesflorian_dev = tellesflorian_dev.phpFpm.pool; 23 services.myPhpfpm.poolConfigs.tellesflorian_dev = tellesflorian_dev.phpFpm.pool;
23 system.activationScripts.tellesflorian_dev = tellesflorian_dev.activationScript; 24 system.activationScripts.tellesflorian_dev = tellesflorian_dev.activationScript;
diff --git a/nixops/modules/websites/tellesflorian/tellesflorian.nix b/nixops/modules/websites/tellesflorian/tellesflorian.nix
index a8e741e..ba46c0c 100644
--- a/nixops/modules/websites/tellesflorian/tellesflorian.nix
+++ b/nixops/modules/websites/tellesflorian/tellesflorian.nix
@@ -24,6 +24,18 @@ let
24 ''; 24 '';
25 }; 25 };
26 phpFpm = rec { 26 phpFpm = rec {
27 preStart = ''
28 if [ ! -f "${varDir}/currentWebappDir" -o \
29 ! -f "${varDir}/currentKey" -o \
30 "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ] \
31 || ! sha512sum -c --status ${varDir}/currentKey; then
32 pushd ${webappDir} > /dev/null
33 /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=${environment} cache:clear --no-warmup
34 popd > /dev/null
35 echo -n "${webappDir}" > ${varDir}/currentWebappDir
36 sha512sum /run/keys/webapps/${environment}-tellesflorian > ${varDir}/currentKey
37 fi
38 '';
27 serviceDeps = [ 39 serviceDeps = [
28 "mysql.service" 40 "mysql.service"
29 "${environment}-tellesflorian-passwords-key.service" 41 "${environment}-tellesflorian-passwords-key.service"
@@ -141,13 +153,6 @@ let
141 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \ 153 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
142 ${varDir}/var 154 ${varDir}/var
143 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions 155 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
144 if [ ! -f "${varDir}/currentWebappDir" -o \
145 "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ]; then
146 pushd ${webappDir} > /dev/null
147 $wrapperDir/sudo -u wwwrun ./bin/console --env=${environment} cache:clear --no-warmup
148 popd > /dev/null
149 echo -n "${webappDir}" > ${varDir}/currentWebappDir
150 fi
151 ''; 156 '';
152 }; 157 };
153 webappDir = composerEnv.buildPackage ( 158 webappDir = composerEnv.buildPackage (