diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-04-21 19:31:06 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-04-21 19:31:06 +0200 |
commit | 8eded9ecb6220bb26599419a4aaea1743d3d187e (patch) | |
tree | 45538fcc9fa3bc9476311c14af8d399b25110a2b /nixops/modules/websites/aten/aten.nix | |
parent | 43fe68fb9fc66bda710974fe2a1a3321aa853303 (diff) | |
download | Nix-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/aten/aten.nix')
-rw-r--r-- | nixops/modules/websites/aten/aten.nix | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/nixops/modules/websites/aten/aten.nix b/nixops/modules/websites/aten/aten.nix index 6059eb6..567dcd1 100644 --- a/nixops/modules/websites/aten/aten.nix +++ b/nixops/modules/websites/aten/aten.nix | |||
@@ -4,6 +4,18 @@ let | |||
4 | environment = config.environment; | 4 | environment = config.environment; |
5 | varDir = "/var/lib/aten_${environment}"; | 5 | varDir = "/var/lib/aten_${environment}"; |
6 | phpFpm = rec { | 6 | phpFpm = rec { |
7 | preStart = '' | ||
8 | if [ ! -f "${varDir}/currentWebappDir" -o \ | ||
9 | ! -f "${varDir}/currentKey" -o \ | ||
10 | "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ] \ | ||
11 | || ! sha512sum -c --status ${varDir}/currentKey; then | ||
12 | pushd ${webappDir} > /dev/null | ||
13 | /run/wrappers/bin/sudo -u wwwrun APP_ENV=${environment} ./bin/console --env=${environment} cache:clear --no-warmup | ||
14 | popd > /dev/null | ||
15 | echo -n "${webappDir}" > ${varDir}/currentWebappDir | ||
16 | sha512sum /run/keys/webapps/${environment}-aten > ${varDir}/currentKey | ||
17 | fi | ||
18 | ''; | ||
7 | serviceDeps = [ "postgresql.service" "${environment}-aten-key.service" ]; | 19 | serviceDeps = [ "postgresql.service" "${environment}-aten-key.service" ]; |
8 | socket = "/var/run/phpfpm/aten-${environment}.sock"; | 20 | socket = "/var/run/phpfpm/aten-${environment}.sock"; |
9 | pool = '' | 21 | pool = '' |
@@ -90,13 +102,6 @@ let | |||
90 | text = '' | 102 | text = '' |
91 | install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} | 103 | install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} |
92 | install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions | 104 | install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions |
93 | if [ ! -f "${varDir}/currentWebappDir" -o \ | ||
94 | "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ]; then | ||
95 | pushd ${webappDir} > /dev/null | ||
96 | $wrapperDir/sudo -u wwwrun APP_ENV=${environment} ./bin/console --env=${environment} cache:clear --no-warmup | ||
97 | popd > /dev/null | ||
98 | echo -n "${webappDir}" > ${varDir}/currentWebappDir | ||
99 | fi | ||
100 | ''; | 105 | ''; |
101 | }; | 106 | }; |
102 | yarnModules = let | 107 | yarnModules = let |