1 { apacheUser, apacheGroup, config, ludivinecassal, pkgs, ruby, sass, imagemagick }:
3 app = ludivinecassal.override { inherit (config) environment; };
4 varDir = "/var/lib/ludivinecassal_${app.environment}";
6 dest = "webapps/${app.environment}-ludivinecassal";
11 # This file is auto-generated during the composer install
13 database_host: ${config.mysql.host}
14 database_port: ${config.mysql.port}
15 database_name: ${config.mysql.name}
16 database_user: ${config.mysql.user}
17 database_password: ${config.mysql.password}
18 database_server_version: ${pkgs.mariadb.mysqlVersion}
19 mailer_transport: smtp
20 mailer_host: 127.0.0.1
23 secret: ${config.secret}
24 ldap_host: ldap.immae.eu
29 ldap_user_bind: 'uid={username},ou=users,dc=immae,dc=eu'
30 ldap_base_dn: 'dc=immae,dc=eu'
31 ldap_search_dn: '${config.ldap.dn}'
32 ldap_search_password: '${config.ldap.password}'
33 ldap_search_filter: '${config.ldap.search}'
35 binary_path: ${imagemagick}/bin
37 sass: ${sass}/bin/sass
38 ruby: ${ruby}/bin/ruby
43 if [ ! -f "${app.varDir}/currentWebappDir" -o \
44 ! -f "${app.varDir}/currentKey" -o \
45 "${app}" != "$(cat ${app.varDir}/currentWebappDir 2>/dev/null)" ] \
46 || ! sha512sum -c --status ${app.varDir}/currentKey; then
47 pushd ${app} > /dev/null
48 /run/wrappers/bin/sudo -u ${apacheUser} ./bin/console --env=${app.environment} cache:clear --no-warmup
50 echo -n "${app}" > ${app.varDir}/currentWebappDir
51 sha512sum /var/secrets/webapps/${app.environment}-ludivinecassal > ${app.varDir}/currentKey
54 serviceDeps = [ "mysql.service" ];
55 socket = "/var/run/phpfpm/ludivinecassal-${app.environment}.sock";
59 group = ${apacheGroup}
60 listen.owner = ${apacheUser}
61 listen.group = ${apacheGroup}
62 php_admin_value[upload_max_filesize] = 20M
63 php_admin_value[post_max_size] = 20M
64 ;php_admin_flag[log_errors] = on
65 php_admin_value[open_basedir] = "/var/secrets/webapps/${app.environment}-ludivinecassal:${app}:${app.varDir}:/tmp"
66 php_admin_value[session.save_path] = "${app.varDir}/phpSessions"
67 ${if app.environment == "dev" then ''
70 pm.process_idle_timeout = 60
71 env[SYMFONY_DEBUG_MODE] = "yes"
76 pm.min_spare_servers = 1
77 pm.max_spare_servers = 3
81 modules = [ "proxy_fcgi" ];
82 webappName = "ludivine_${app.environment}";
83 root = "/run/current-system/webapps/${webappName}";
86 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
89 ${if app.environment == "dev" then ''
92 Require ldap-group cn=ludivine.immae.eu,cn=httpd,ou=services,dc=immae,dc=eu
93 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://ludivinecassal.com\"></html>"
97 Options Indexes FollowSymLinks MultiViews Includes
101 DirectoryIndex app_dev.php
103 <IfModule mod_negotiation.c>
107 <IfModule mod_rewrite.c>
110 RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
111 RewriteRule ^(.*) - [E=BASE:%1]
114 RewriteCond %{DOCUMENT_ROOT}/maintenance.php -f
115 RewriteCond %{SCRIPT_FILENAME} !maintenance.php
116 RewriteRule ^.*$ %{ENV:BASE}/maintenance.php [R=503,L]
117 ErrorDocument 503 /maintenance.php
119 # Sets the HTTP_AUTHORIZATION header removed by Apache
120 RewriteCond %{HTTP:Authorization} .
121 RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
123 RewriteCond %{ENV:REDIRECT_STATUS} ^$
124 RewriteRule ^app_dev\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
126 # If the requested filename exists, simply serve it.
127 # We only want to let Apache serve files and not directories.
128 RewriteCond %{REQUEST_FILENAME} -f
131 # Rewrite all other queries to the front controller.
132 RewriteRule ^ %{ENV:BASE}/app_dev.php [L]
137 Use Stats ludivinecassal.com
140 Options Indexes FollowSymLinks MultiViews Includes
148 deps = [ "wrappers" ];
150 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d ${app.varDir}
151 install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d ${app.varDir}/tmp
152 install -m 0750 -o ${apacheUser} -g ${apacheGroup} -d ${app.varDir}/phpSessions