1 { apacheUser, apacheGroup, 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 ${apacheUser} 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 = ${apacheGroup}
22 listen.owner = ${apacheUser}
23 listen.group = ${apacheGroup}
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}"
54 modules = [ "proxy_fcgi" ];
55 webappName = "aten_${app.environment}";
56 root = "/run/current-system/webapps/${webappName}";
59 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
62 Include /var/secrets/webapps/${app.environment}-aten
64 ${if app.environment == "dev" then ''
67 Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
68 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
73 Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
74 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
81 Require ldap-group cn=aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
82 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
87 Options Indexes FollowSymLinks MultiViews Includes
90 DirectoryIndex index.php
91 FallbackResource /index.php
96 deps = [ "wrappers" ];
98 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d ${app.varDir}
99 install -m 0750 -o ${apacheUser} -g ${apacheGroup} -d ${app.varDir}/phpSessions