1 { aten, lib, config }: rec {
2 app = aten.override { inherit (config) environment; };
5 if [ ! -f "${app.varDir}/currentWebappDir" -o \
6 ! -f "${app.varDir}/currentKey" -o \
7 "${app}" != "$(cat ${app.varDir}/currentWebappDir 2>/dev/null)" ] \
8 || ! sha512sum -c --status ${app.varDir}/currentKey; then
9 pushd ${app} > /dev/null
10 /run/wrappers/bin/sudo -u wwwrun APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup
12 echo -n "${app}" > ${app.varDir}/currentWebappDir
13 sha512sum /var/secrets/webapps/${app.environment}-aten > ${app.varDir}/currentKey
16 serviceDeps = [ "postgresql.service" ];
17 socket = "/var/run/phpfpm/aten-${app.environment}.sock";
21 group = ${apache.group}
22 listen.owner = ${apache.user}
23 listen.group = ${apache.group}
24 php_admin_value[upload_max_filesize] = 20M
25 php_admin_value[post_max_size] = 20M
26 ;php_admin_flag[log_errors] = on
27 php_admin_value[open_basedir] = "${app}:${app.varDir}:/tmp"
28 php_admin_value[session.save_path] = "${app.varDir}/phpSessions"
29 ${if app.environment == "dev" then ''
32 pm.process_idle_timeout = 60
33 env[SYMFONY_DEBUG_MODE] = "yes"
38 pm.min_spare_servers = 1
39 pm.max_spare_servers = 3
43 dest = "webapps/${app.environment}-aten";
48 SetEnv APP_ENV "${app.environment}"
49 SetEnv APP_SECRET "${config.secret}"
50 SetEnv DATABASE_URL "${config.psql_url}"
56 modules = [ "proxy_fcgi" ];
57 webappName = "aten_${app.environment}";
58 root = "/run/current-system/webapps/${webappName}";
61 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
64 Include /var/secrets/webapps/${app.environment}-aten
66 ${if app.environment == "dev" then ''
69 Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
70 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
75 Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
76 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
83 Require ldap-group cn=aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
84 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
89 Options Indexes FollowSymLinks MultiViews Includes
92 DirectoryIndex index.php
93 FallbackResource /index.php
98 deps = [ "wrappers" ];
100 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${app.varDir}
101 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${app.varDir}/phpSessions