diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-06-01 12:22:13 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-06-01 12:22:13 +0200 |
commit | 4360f70d7a9966593d9e04043fa0a75defc094e0 (patch) | |
tree | 57e7a062754c823c9f91f13742b9b7de08937097 /modules/private/websites/florian | |
parent | 02d6e977e309355ae728422e26063090e8a2f193 (diff) | |
download | Nix-4360f70d7a9966593d9e04043fa0a75defc094e0.tar.gz Nix-4360f70d7a9966593d9e04043fa0a75defc094e0.tar.zst Nix-4360f70d7a9966593d9e04043fa0a75defc094e0.zip |
Add phpFpm prestart script to lib
Diffstat (limited to 'modules/private/websites/florian')
-rw-r--r-- | modules/private/websites/florian/builder_app.nix | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/modules/private/websites/florian/builder_app.nix b/modules/private/websites/florian/builder_app.nix index e521f6e..c12663a 100644 --- a/modules/private/websites/florian/builder_app.nix +++ b/modules/private/websites/florian/builder_app.nix | |||
@@ -1,4 +1,4 @@ | |||
1 | { apacheUser, apacheGroup, tellesflorian, config }: | 1 | { apacheUser, apacheGroup, tellesflorian, mylibs, config }: |
2 | rec { | 2 | rec { |
3 | app = tellesflorian.override { inherit (config) environment; }; | 3 | app = tellesflorian.override { inherit (config) environment; }; |
4 | keys = [ | 4 | keys = [ |
@@ -33,18 +33,16 @@ rec { | |||
33 | } | 33 | } |
34 | ]; | 34 | ]; |
35 | phpFpm = rec { | 35 | phpFpm = rec { |
36 | preStart = '' | 36 | preStart = mylibs.phpFpmPreStart { |
37 | if [ ! -f "${app.varDir}/currentWebappDir" -o \ | 37 | inherit app; |
38 | ! -f "${app.varDir}/currentKey" -o \ | 38 | inherit (app) varDir; |
39 | "${app}" != "$(cat ${app.varDir}/currentWebappDir 2>/dev/null)" ] \ | 39 | keyFiles = [ |
40 | || ! sha512sum -c --status ${app.varDir}/currentKey; then | 40 | "/var/secrets/webapps/${app.environment}-tellesflorian" |
41 | pushd ${app} > /dev/null | 41 | ]; |
42 | /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=${app.environment} cache:clear --no-warmup | 42 | actions = [ |
43 | popd > /dev/null | 43 | "/run/wrappers/bin/sudo -u wwwrun ./bin/console --env=${app.environment} cache:clear --no-warmup" |
44 | echo -n "${app}" > ${app.varDir}/currentWebappDir | 44 | ]; |
45 | sha512sum /var/secrets/webapps/${app.environment}-tellesflorian > ${app.varDir}/currentKey | 45 | }; |
46 | fi | ||
47 | ''; | ||
48 | serviceDeps = [ "mysql.service" ]; | 46 | serviceDeps = [ "mysql.service" ]; |
49 | socket = "/var/run/phpfpm/floriantelles-${app.environment}.sock"; | 47 | socket = "/var/run/phpfpm/floriantelles-${app.environment}.sock"; |
50 | pool = '' | 48 | pool = '' |