aboutsummaryrefslogtreecommitdiff
path: root/nixops/modules/websites/connexionswing/connexionswing.nix
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/connexionswing/connexionswing.nix
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/connexionswing/connexionswing.nix')
-rw-r--r--nixops/modules/websites/connexionswing/connexionswing.nix19
1 files changed, 12 insertions, 7 deletions
diff --git a/nixops/modules/websites/connexionswing/connexionswing.nix b/nixops/modules/websites/connexionswing/connexionswing.nix
index 2960c6a..13d4fba 100644
--- a/nixops/modules/websites/connexionswing/connexionswing.nix
+++ b/nixops/modules/websites/connexionswing/connexionswing.nix
@@ -33,6 +33,18 @@ let
33 ''; 33 '';
34 }; 34 };
35 phpFpm = rec { 35 phpFpm = rec {
36 preStart = ''
37 if [ ! -f "${varDir}/currentWebappDir" -o \
38 ! -f "${varDir}/currentKey" -o \
39 "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ] \
40 || ! sha512sum -c --status ${varDir}/currentKey; then
41 pushd ${webappDir} > /dev/null
42 /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=${environment} cache:clear --no-warmup
43 popd > /dev/null
44 echo -n "${webappDir}" > ${varDir}/currentWebappDir
45 sha512sum /run/keys/webapps/${environment}-connexionswing > ${varDir}/currentKey
46 fi
47 '';
36 serviceDeps = [ "mysql.service" "${environment}-connexionswing-key.service" ]; 48 serviceDeps = [ "mysql.service" "${environment}-connexionswing-key.service" ];
37 socket = "/var/run/phpfpm/connexionswing-${environment}.sock"; 49 socket = "/var/run/phpfpm/connexionswing-${environment}.sock";
38 phpConfig = '' 50 phpConfig = ''
@@ -151,13 +163,6 @@ let
151 ${varDir}/uploads \ 163 ${varDir}/uploads \
152 ${varDir}/var 164 ${varDir}/var
153 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions 165 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
154 if [ ! -f "${varDir}/currentWebappDir" -o \
155 "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ]; then
156 pushd ${webappDir} > /dev/null
157 $wrapperDir/sudo -u wwwrun ./bin/console --env=${environment} cache:clear --no-warmup
158 popd > /dev/null
159 echo -n "${webappDir}" > ${varDir}/currentWebappDir
160 fi
161 ''; 166 '';
162 }; 167 };
163 webappDir = composerEnv.buildPackage ( 168 webappDir = composerEnv.buildPackage (