1 { lib, pkgs, config, ... }:
3 secrets = config.myEnv.websites.piedsjaloux.integration;
4 app = pkgs.callPackage ./app {
5 environment = secrets.environment;
6 varDir = "/var/lib/piedsjaloux_integration";
7 secretsPath = config.secrets.fullPaths."websites/piedsjaloux/integration";
9 cfg = config.myServices.websites.piedsjaloux.integration;
10 pcfg = config.services.phpApplication;
11 texlive = pkgs.texlive.combine { inherit (pkgs.texlive) attachfile preprint scheme-small; };
13 options.myServices.websites.piedsjaloux.integration.enable = lib.mkEnableOption "enable PiedsJaloux's website in integration";
15 config = lib.mkIf cfg.enable {
16 services.duplyBackup.profiles.piedsjaloux_integration.rootDir = app.varDir;
17 services.phpApplication.apps.piedsjaloux_integration = {
18 websiteEnv = "integration";
19 httpdUser = config.services.httpd.Inte.user;
20 httpdGroup = config.services.httpd.Inte.group;
21 inherit (app) webRoot varDir;
26 serviceDeps = [ "mysql.service" ];
28 "./bin/console --env=${app.environment} cache:clear --no-warmup"
30 phpOpenbasedir = [ "/tmp" ];
32 "php_admin_value[upload_max_filesize]" = "20M";
33 "php_admin_value[post_max_size]" = "20M";
34 #"php_admin_flag[log_errors]" = "on";
36 "pm.max_children" = "5";
37 "pm.process_idle_timeout" = "60";
40 PATH = lib.makeBinPath [
42 # below ones don't need to be in the PATH but they’re used in
44 pkgs.imagemagick texlive
46 SYMFONY_DEBUG_MODE = "\"yes\"";
55 dest = "websites/piedsjaloux/integration";
56 user = config.services.httpd.Inte.user;
57 group = config.services.httpd.Inte.group;
60 # This file is auto-generated during the composer install
62 database_host: ${secrets.mysql.host}
63 database_port: ${secrets.mysql.port}
64 database_name: ${secrets.mysql.database}
65 database_user: ${secrets.mysql.user}
66 database_password: ${secrets.mysql.password}
67 database_server_version: ${pkgs.mariadb.mysqlVersion}
68 mailer_transport: smtp
69 mailer_host: 127.0.0.1
72 secret: ${secrets.secret}
73 pdflatex: "${texlive}/bin/pdflatex"
75 binary_path: ${pkgs.imagemagick}/bin
80 services.websites.env.integration.vhostConfs.piedsjaloux_integration = {
81 certName = "integration";
83 hosts = [ "piedsjaloux.immae.eu" ];
84 root = pcfg.webappDirs.piedsjaloux_integration;
88 SetHandler "proxy:unix:${pcfg.phpListenPaths.piedsjaloux_integration}|fcgi://localhost"
93 Require ldap-group cn=piedsjaloux.immae.eu,cn=httpd,ou=services,dc=immae,dc=eu
94 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://piedsjaloux.fr\"></html>"
97 <Directory ${pcfg.webappDirs.piedsjaloux_integration}>
98 Options Indexes FollowSymLinks MultiViews Includes
102 DirectoryIndex app_dev.php
104 <IfModule mod_negotiation.c>
108 <IfModule mod_rewrite.c>
111 RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
112 RewriteRule ^(.*) - [E=BASE:%1]
115 RewriteCond %{DOCUMENT_ROOT}/maintenance.php -f
116 RewriteCond %{SCRIPT_FILENAME} !maintenance.php
117 RewriteRule ^.*$ %{ENV:BASE}/maintenance.php [R=503,L]
118 ErrorDocument 503 /maintenance.php
120 # Sets the HTTP_AUTHORIZATION header removed by Apache
121 RewriteCond %{HTTP:Authorization} .
122 RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
124 RewriteCond %{ENV:REDIRECT_STATUS} ^$
125 RewriteRule ^app_dev\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
127 # If the requested filename exists, simply serve it.
128 # We only want to let Apache serve files and not directories.
129 RewriteCond %{REQUEST_FILENAME} -f
132 # Rewrite all other queries to the front controller.
133 RewriteRule ^ %{ENV:BASE}/app_dev.php [L]