aboutsummaryrefslogtreecommitdiff
path: root/nixops/modules/websites/piedsjaloux/piedsjaloux.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/piedsjaloux/piedsjaloux.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/piedsjaloux/piedsjaloux.nix')
-rw-r--r--nixops/modules/websites/piedsjaloux/piedsjaloux.nix19
1 files changed, 12 insertions, 7 deletions
diff --git a/nixops/modules/websites/piedsjaloux/piedsjaloux.nix b/nixops/modules/websites/piedsjaloux/piedsjaloux.nix
index 1c7e983..87699db 100644
--- a/nixops/modules/websites/piedsjaloux/piedsjaloux.nix
+++ b/nixops/modules/websites/piedsjaloux/piedsjaloux.nix
@@ -28,6 +28,18 @@ let
28 ''; 28 '';
29 }; 29 };
30 phpFpm = rec { 30 phpFpm = rec {
31 preStart = ''
32 if [ ! -f "${varDir}/currentWebappDir" -o \
33 ! -f "${varDir}/currentKey" -o \
34 "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ] \
35 || ! sha512sum -c --status ${varDir}/currentKey; then
36 pushd ${webappDir} > /dev/null
37 /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=${environment} cache:clear --no-warmup
38 popd > /dev/null
39 echo -n "${webappDir}" > ${varDir}/currentWebappDir
40 sha512sum /run/keys/webapps/${environment}-piedsjaloux > ${varDir}/currentKey
41 fi
42 '';
31 serviceDeps = [ "mysql.service" "${environment}-piedsjaloux-key.service" ]; 43 serviceDeps = [ "mysql.service" "${environment}-piedsjaloux-key.service" ];
32 socket = "/var/run/phpfpm/piedsjaloux-${environment}.sock"; 44 socket = "/var/run/phpfpm/piedsjaloux-${environment}.sock";
33 pool = '' 45 pool = ''
@@ -130,13 +142,6 @@ let
130 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \ 142 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
131 ${varDir}/tmp 143 ${varDir}/tmp
132 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions 144 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
133 if [ ! -f "${varDir}/currentWebappDir" -o \
134 "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ]; then
135 pushd ${webappDir} > /dev/null
136 $wrapperDir/sudo -u wwwrun ./bin/console --env=${environment} cache:clear --no-warmup
137 popd > /dev/null
138 echo -n "${webappDir}" > ${varDir}/currentWebappDir
139 fi
140 ''; 145 '';
141 }; 146 };
142 webappDir = composerEnv.buildPackage ( 147 webappDir = composerEnv.buildPackage (