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 | |
parent | 43fe68fb9fc66bda710974fe2a1a3321aa853303 (diff) | |
download | Nix-8eded9ecb6220bb26599419a4aaea1743d3d187e.tar.gz Nix-8eded9ecb6220bb26599419a4aaea1743d3d187e.tar.zst Nix-8eded9ecb6220bb26599419a4aaea1743d3d187e.zip |
Move cache clearing of php applications to preStart systemd
-rw-r--r-- | nixops/modules/websites/aten/aten.nix | 19 | ||||
-rw-r--r-- | nixops/modules/websites/aten/default.nix | 2 | ||||
-rw-r--r-- | nixops/modules/websites/connexionswing/connexionswing.nix | 19 | ||||
-rw-r--r-- | nixops/modules/websites/connexionswing/default.nix | 2 | ||||
-rw-r--r-- | nixops/modules/websites/ludivine/default.nix | 2 | ||||
-rw-r--r-- | nixops/modules/websites/ludivine/ludivinecassal.nix | 19 | ||||
-rw-r--r-- | nixops/modules/websites/phpfpm/default.nix | 16 | ||||
-rw-r--r-- | nixops/modules/websites/piedsjaloux/default.nix | 2 | ||||
-rw-r--r-- | nixops/modules/websites/piedsjaloux/piedsjaloux.nix | 19 | ||||
-rw-r--r-- | nixops/modules/websites/tellesflorian/default.nix | 1 | ||||
-rw-r--r-- | nixops/modules/websites/tellesflorian/tellesflorian.nix | 19 | ||||
-rw-r--r-- | nixops/modules/websites/tools/tools/default.nix | 3 | ||||
-rw-r--r-- | nixops/modules/websites/tools/tools/wallabag.nix | 23 |
13 files changed, 101 insertions, 45 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 |
diff --git a/nixops/modules/websites/aten/default.nix b/nixops/modules/websites/aten/default.nix index 58228ed..b0f7fdb 100644 --- a/nixops/modules/websites/aten/default.nix +++ b/nixops/modules/websites/aten/default.nix | |||
@@ -41,6 +41,7 @@ in { | |||
41 | }; | 41 | }; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | services.myPhpfpm.preStart.aten_prod = aten_prod.phpFpm.preStart; | ||
44 | services.myPhpfpm.serviceDependencies.aten_prod = aten_prod.phpFpm.serviceDeps; | 45 | services.myPhpfpm.serviceDependencies.aten_prod = aten_prod.phpFpm.serviceDeps; |
45 | services.myPhpfpm.poolConfigs.aten_prod = aten_prod.phpFpm.pool; | 46 | services.myPhpfpm.poolConfigs.aten_prod = aten_prod.phpFpm.pool; |
46 | system.activationScripts.aten_prod = aten_prod.activationScript; | 47 | system.activationScripts.aten_prod = aten_prod.activationScript; |
@@ -60,6 +61,7 @@ in { | |||
60 | (lib.mkIf cfg.integration.enable { | 61 | (lib.mkIf cfg.integration.enable { |
61 | deployment.keys = aten_dev.keys; | 62 | deployment.keys = aten_dev.keys; |
62 | security.acme.certs."eldiron".extraDomains."dev.aten.pro" = null; | 63 | security.acme.certs."eldiron".extraDomains."dev.aten.pro" = null; |
64 | services.myPhpfpm.preStart.aten_dev = aten_dev.phpFpm.preStart; | ||
63 | services.myPhpfpm.serviceDependencies.aten_dev = aten_dev.phpFpm.serviceDeps; | 65 | services.myPhpfpm.serviceDependencies.aten_dev = aten_dev.phpFpm.serviceDeps; |
64 | services.myPhpfpm.poolConfigs.aten_dev = aten_dev.phpFpm.pool; | 66 | services.myPhpfpm.poolConfigs.aten_dev = aten_dev.phpFpm.pool; |
65 | system.activationScripts.aten_dev = aten_dev.activationScript; | 67 | system.activationScripts.aten_dev = aten_dev.activationScript; |
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 ( |
diff --git a/nixops/modules/websites/connexionswing/default.nix b/nixops/modules/websites/connexionswing/default.nix index 9c74f02..ccbaa02 100644 --- a/nixops/modules/websites/connexionswing/default.nix +++ b/nixops/modules/websites/connexionswing/default.nix | |||
@@ -43,6 +43,7 @@ in { | |||
43 | }; | 43 | }; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | services.myPhpfpm.preStart.connexionswing_prod = connexionswing_prod.phpFpm.preStart; | ||
46 | services.myPhpfpm.serviceDependencies.connexionswing_prod = connexionswing_prod.phpFpm.serviceDeps; | 47 | services.myPhpfpm.serviceDependencies.connexionswing_prod = connexionswing_prod.phpFpm.serviceDeps; |
47 | services.myPhpfpm.poolConfigs.connexionswing_prod = connexionswing_prod.phpFpm.pool; | 48 | services.myPhpfpm.poolConfigs.connexionswing_prod = connexionswing_prod.phpFpm.pool; |
48 | services.myPhpfpm.poolPhpConfigs.connexionswing_prod = connexionswing_prod.phpFpm.phpConfig; | 49 | services.myPhpfpm.poolPhpConfigs.connexionswing_prod = connexionswing_prod.phpFpm.phpConfig; |
@@ -63,6 +64,7 @@ in { | |||
63 | deployment.keys = connexionswing_dev.keys; | 64 | deployment.keys = connexionswing_dev.keys; |
64 | security.acme.certs."eldiron".extraDomains."sandetludo.immae.eu" = null; | 65 | security.acme.certs."eldiron".extraDomains."sandetludo.immae.eu" = null; |
65 | security.acme.certs."eldiron".extraDomains."connexionswing.immae.eu" = null; | 66 | security.acme.certs."eldiron".extraDomains."connexionswing.immae.eu" = null; |
67 | services.myPhpfpm.preStart.connexionswing_dev = connexionswing_dev.phpFpm.preStart; | ||
66 | services.myPhpfpm.serviceDependencies.connexionswing_dev = connexionswing_dev.phpFpm.serviceDeps; | 68 | services.myPhpfpm.serviceDependencies.connexionswing_dev = connexionswing_dev.phpFpm.serviceDeps; |
67 | services.myPhpfpm.poolConfigs.connexionswing_dev = connexionswing_dev.phpFpm.pool; | 69 | services.myPhpfpm.poolConfigs.connexionswing_dev = connexionswing_dev.phpFpm.pool; |
68 | services.myPhpfpm.poolPhpConfigs.connexionswing_dev = connexionswing_dev.phpFpm.phpConfig; | 70 | services.myPhpfpm.poolPhpConfigs.connexionswing_dev = connexionswing_dev.phpFpm.phpConfig; |
diff --git a/nixops/modules/websites/ludivine/default.nix b/nixops/modules/websites/ludivine/default.nix index c5a904b..814764f 100644 --- a/nixops/modules/websites/ludivine/default.nix +++ b/nixops/modules/websites/ludivine/default.nix | |||
@@ -37,6 +37,7 @@ in { | |||
37 | }; | 37 | }; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | services.myPhpfpm.preStart.ludivinecassal_prod = ludivinecassal_prod.phpFpm.preStart; | ||
40 | services.myPhpfpm.serviceDependencies.ludivinecassal_prod = ludivinecassal_prod.phpFpm.serviceDeps; | 41 | services.myPhpfpm.serviceDependencies.ludivinecassal_prod = ludivinecassal_prod.phpFpm.serviceDeps; |
41 | services.myPhpfpm.poolConfigs.ludivinecassal_prod = ludivinecassal_prod.phpFpm.pool; | 42 | services.myPhpfpm.poolConfigs.ludivinecassal_prod = ludivinecassal_prod.phpFpm.pool; |
42 | system.activationScripts.ludivinecassal_prod = ludivinecassal_prod.activationScript; | 43 | system.activationScripts.ludivinecassal_prod = ludivinecassal_prod.activationScript; |
@@ -56,6 +57,7 @@ in { | |||
56 | deployment.keys = ludivinecassal_dev.keys; | 57 | deployment.keys = ludivinecassal_dev.keys; |
57 | security.acme.certs."eldiron".extraDomains."ludivine.immae.eu" = null; | 58 | security.acme.certs."eldiron".extraDomains."ludivine.immae.eu" = null; |
58 | 59 | ||
60 | services.myPhpfpm.preStart.ludivinecassal_dev = ludivinecassal_dev.phpFpm.preStart; | ||
59 | services.myPhpfpm.serviceDependencies.ludivinecassal_dev = ludivinecassal_dev.phpFpm.serviceDeps; | 61 | services.myPhpfpm.serviceDependencies.ludivinecassal_dev = ludivinecassal_dev.phpFpm.serviceDeps; |
60 | services.myPhpfpm.poolConfigs.ludivinecassal_dev = ludivinecassal_dev.phpFpm.pool; | 62 | services.myPhpfpm.poolConfigs.ludivinecassal_dev = ludivinecassal_dev.phpFpm.pool; |
61 | system.activationScripts.ludivinecassal_dev = ludivinecassal_dev.activationScript; | 63 | system.activationScripts.ludivinecassal_dev = ludivinecassal_dev.activationScript; |
diff --git a/nixops/modules/websites/ludivine/ludivinecassal.nix b/nixops/modules/websites/ludivine/ludivinecassal.nix index 423bbda..439d3c9 100644 --- a/nixops/modules/websites/ludivine/ludivinecassal.nix +++ b/nixops/modules/websites/ludivine/ludivinecassal.nix | |||
@@ -40,6 +40,18 @@ let | |||
40 | ''; | 40 | ''; |
41 | }; | 41 | }; |
42 | phpFpm = rec { | 42 | phpFpm = rec { |
43 | preStart = '' | ||
44 | if [ ! -f "${varDir}/currentWebappDir" -o \ | ||
45 | ! -f "${varDir}/currentKey" -o \ | ||
46 | "${webappDir}" != "$(cat ${varDir}/currentWebappDir 2>/dev/null)" ] \ | ||
47 | || ! sha512sum -c --status ${varDir}/currentKey; then | ||
48 | pushd ${webappDir} > /dev/null | ||
49 | /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=${environment} cache:clear --no-warmup | ||
50 | popd > /dev/null | ||
51 | echo -n "${webappDir}" > ${varDir}/currentWebappDir | ||
52 | sha512sum /run/keys/webapps/${environment}-ludivinecassal > ${varDir}/currentKey | ||
53 | fi | ||
54 | ''; | ||
43 | serviceDeps = [ "mysql.service" "${environment}-ludivinecassal-key.service" ]; | 55 | serviceDeps = [ "mysql.service" "${environment}-ludivinecassal-key.service" ]; |
44 | socket = "/var/run/phpfpm/ludivinecassal-${environment}.sock"; | 56 | socket = "/var/run/phpfpm/ludivinecassal-${environment}.sock"; |
45 | pool = '' | 57 | pool = '' |
@@ -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 | install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}/tmp | 154 | install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}/tmp |
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 ( |
diff --git a/nixops/modules/websites/phpfpm/default.nix b/nixops/modules/websites/phpfpm/default.nix index 9c068bf..60959e0 100644 --- a/nixops/modules/websites/phpfpm/default.nix +++ b/nixops/modules/websites/phpfpm/default.nix | |||
@@ -95,6 +95,20 @@ in { | |||
95 | ''; | 95 | ''; |
96 | }; | 96 | }; |
97 | 97 | ||
98 | preStart = mkOption { | ||
99 | default = {}; | ||
100 | type = types.attrsOf types.lines; | ||
101 | example = literalExample '' | ||
102 | { mypool = ''' | ||
103 | touch foo | ||
104 | '''; | ||
105 | } | ||
106 | ''; | ||
107 | description = '' | ||
108 | Extra lines that will go into the preStart systemd service | ||
109 | ''; | ||
110 | }; | ||
111 | |||
98 | poolPhpConfigs = mkOption { | 112 | poolPhpConfigs = mkOption { |
99 | default = {}; | 113 | default = {}; |
100 | type = types.attrsOf types.lines; | 114 | type = types.attrsOf types.lines; |
@@ -181,7 +195,7 @@ in { | |||
181 | partOf = [ "phpfpm.target" ]; | 195 | partOf = [ "phpfpm.target" ]; |
182 | preStart = '' | 196 | preStart = '' |
183 | mkdir -p ${stateDir} | 197 | mkdir -p ${stateDir} |
184 | ''; | 198 | '' + (cfg.preStart.${pool} or ""); |
185 | serviceConfig = let | 199 | serviceConfig = let |
186 | cfgFile = fpmCfgFile pool poolConfig; | 200 | cfgFile = fpmCfgFile pool poolConfig; |
187 | poolPhpIni = cfg.poolPhpConfigs.${pool} or ""; | 201 | poolPhpIni = cfg.poolPhpConfigs.${pool} or ""; |
diff --git a/nixops/modules/websites/piedsjaloux/default.nix b/nixops/modules/websites/piedsjaloux/default.nix index 7552db4..57849a3 100644 --- a/nixops/modules/websites/piedsjaloux/default.nix +++ b/nixops/modules/websites/piedsjaloux/default.nix | |||
@@ -41,6 +41,7 @@ in { | |||
41 | }; | 41 | }; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | services.myPhpfpm.preStart.piedsjaloux_prod = piedsjaloux_prod.phpFpm.preStart; | ||
44 | services.myPhpfpm.serviceDependencies.piedsjaloux_prod = piedsjaloux_prod.phpFpm.serviceDeps; | 45 | services.myPhpfpm.serviceDependencies.piedsjaloux_prod = piedsjaloux_prod.phpFpm.serviceDeps; |
45 | services.myPhpfpm.poolConfigs.piedsjaloux_prod = piedsjaloux_prod.phpFpm.pool; | 46 | services.myPhpfpm.poolConfigs.piedsjaloux_prod = piedsjaloux_prod.phpFpm.pool; |
46 | system.activationScripts.piedsjaloux_prod = piedsjaloux_prod.activationScript; | 47 | system.activationScripts.piedsjaloux_prod = piedsjaloux_prod.activationScript; |
@@ -59,6 +60,7 @@ in { | |||
59 | (lib.mkIf cfg.integration.enable { | 60 | (lib.mkIf cfg.integration.enable { |
60 | deployment.keys = piedsjaloux_dev.keys; | 61 | deployment.keys = piedsjaloux_dev.keys; |
61 | security.acme.certs."eldiron".extraDomains."piedsjaloux.immae.eu" = null; | 62 | security.acme.certs."eldiron".extraDomains."piedsjaloux.immae.eu" = null; |
63 | services.myPhpfpm.preStart.piedsjaloux_dev = piedsjaloux_dev.phpFpm.preStart; | ||
62 | services.myPhpfpm.serviceDependencies.piedsjaloux_dev = piedsjaloux_dev.phpFpm.serviceDeps; | 64 | services.myPhpfpm.serviceDependencies.piedsjaloux_dev = piedsjaloux_dev.phpFpm.serviceDeps; |
63 | services.myPhpfpm.poolConfigs.piedsjaloux_dev = piedsjaloux_dev.phpFpm.pool; | 65 | services.myPhpfpm.poolConfigs.piedsjaloux_dev = piedsjaloux_dev.phpFpm.pool; |
64 | system.activationScripts.piedsjaloux_dev = piedsjaloux_dev.activationScript; | 66 | system.activationScripts.piedsjaloux_dev = piedsjaloux_dev.activationScript; |
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 ( |
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 ( |
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"; |