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/aten | |
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/aten')
-rw-r--r-- | modules/private/websites/aten/builder.nix | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/modules/private/websites/aten/builder.nix b/modules/private/websites/aten/builder.nix index 9a2e1a7..83a8f70 100644 --- a/modules/private/websites/aten/builder.nix +++ b/modules/private/websites/aten/builder.nix | |||
@@ -1,18 +1,16 @@ | |||
1 | { apacheUser, apacheGroup, aten, lib, config }: rec { | 1 | { apacheUser, apacheGroup, aten, lib, mylibs, config }: rec { |
2 | app = aten.override { inherit (config) environment; }; | 2 | app = aten.override { inherit (config) environment; }; |
3 | phpFpm = rec { | 3 | phpFpm = rec { |
4 | preStart = '' | 4 | preStart = mylibs.phpFpmPreStart { |
5 | if [ ! -f "${app.varDir}/currentWebappDir" -o \ | 5 | inherit app; |
6 | ! -f "${app.varDir}/currentKey" -o \ | 6 | inherit (app) varDir; |
7 | "${app}" != "$(cat ${app.varDir}/currentWebappDir 2>/dev/null)" ] \ | 7 | keyFiles = [ |
8 | || ! sha512sum -c --status ${app.varDir}/currentKey; then | 8 | "/var/secrets/webapps/${app.environment}-aten" |
9 | pushd ${app} > /dev/null | 9 | ]; |
10 | /run/wrappers/bin/sudo -u ${apacheUser} APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup | 10 | actions = [ |
11 | popd > /dev/null | 11 | "/run/wrappers/bin/sudo -u ${apacheUser} APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup" |
12 | echo -n "${app}" > ${app.varDir}/currentWebappDir | 12 | ]; |
13 | sha512sum /var/secrets/webapps/${app.environment}-aten > ${app.varDir}/currentKey | 13 | }; |
14 | fi | ||
15 | ''; | ||
16 | serviceDeps = [ "postgresql.service" ]; | 14 | serviceDeps = [ "postgresql.service" ]; |
17 | socket = "/var/run/phpfpm/aten-${app.environment}.sock"; | 15 | socket = "/var/run/phpfpm/aten-${app.environment}.sock"; |
18 | pool = '' | 16 | pool = '' |