1 { lib, pkgs, config, ... }:
3 secrets = config.myEnv.websites.piedsjaloux.integration;
4 webRoot = "/var/lib/ftp/immae/piedsjaloux/web";
5 cfg = config.myServices.websites.piedsjaloux.integration;
6 pcfg = config.services.phpApplication;
7 texlive = pkgs.texlive.combine { inherit (pkgs.texlive) attachfile preprint scheme-small; };
9 options.myServices.websites.piedsjaloux.integration.enable = lib.mkEnableOption "enable PiedsJaloux's website in integration";
11 config = lib.mkIf cfg.enable {
12 services.phpApplication.apps.piedsjaloux_integration = {
13 websiteEnv = "integration";
14 httpdUser = config.services.httpd.Inte.user;
15 httpdGroup = config.services.httpd.Inte.group;
17 varDir = "/var/lib/ftp/immae/piedsjaloux_var";
21 app = "/var/lib/ftp/immae/piedsjaloux";
22 serviceDeps = [ "mysql.service" ];
24 "./bin/console --env=dev cache:clear --no-warmup"
26 phpOpenbasedir = [ "/tmp" ];
28 "php_admin_value[upload_max_filesize]" = "20M";
29 "php_admin_value[post_max_size]" = "20M";
30 #"php_admin_flag[log_errors]" = "on";
32 "pm.max_children" = "5";
33 "pm.process_idle_timeout" = "60";
36 PATH = lib.makeBinPath [
38 # below ones don't need to be in the PATH but they’re used in
40 pkgs.imagemagick texlive
42 SYMFONY_DEBUG_MODE = "\"yes\"";
45 config.secrets.fullPaths."websites/piedsjaloux/integration"
47 phpPackage = pkgs.php72;
50 secrets.keys."websites/piedsjaloux/integration" = {
51 user = config.services.httpd.Inte.user;
52 group = config.services.httpd.Inte.group;
55 # This file is auto-generated during the composer install
57 database_host: ${secrets.mysql.host}
58 database_port: ${secrets.mysql.port}
59 database_name: ${secrets.mysql.database}
60 database_user: ${secrets.mysql.user}
61 database_password: ${secrets.mysql.password}
62 database_server_version: ${pkgs.mariadb.mysqlVersion}
63 mailer_transport: smtp
64 mailer_host: 127.0.0.1
67 secret: ${secrets.secret}
68 pdflatex: "${texlive}/bin/pdflatex"
70 binary_path: ${pkgs.imagemagick}/bin
74 services.websites.env.integration.vhostConfs.piedsjaloux_integration = {
75 certName = "integration";
77 hosts = [ "test.pj.immae.dev" ];
82 SetHandler "proxy:unix:${pcfg.phpListenPaths.piedsjaloux_integration}|fcgi://localhost"
87 Require ldap-group cn=pj.immae.dev,cn=httpd,ou=services,dc=immae,dc=eu
88 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://piedsjaloux.fr\"></html>"
91 <Directory ${webRoot}>
92 Options Indexes FollowSymLinks MultiViews Includes
96 DirectoryIndex app_dev.php
98 <IfModule mod_negotiation.c>
102 <IfModule mod_rewrite.c>
105 RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
106 RewriteRule ^(.*) - [E=BASE:%1]
109 RewriteCond %{DOCUMENT_ROOT}/maintenance.php -f
110 RewriteCond %{SCRIPT_FILENAME} !maintenance.php
111 RewriteRule ^.*$ %{ENV:BASE}/maintenance.php [R=503,L]
112 ErrorDocument 503 /maintenance.php
114 # Sets the HTTP_AUTHORIZATION header removed by Apache
115 RewriteCond %{HTTP:Authorization} .
116 RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
118 RewriteCond %{ENV:REDIRECT_STATUS} ^$
119 RewriteRule ^app_dev\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
121 # If the requested filename exists, simply serve it.
122 # We only want to let Apache serve files and not directories.
123 RewriteCond %{REQUEST_FILENAME} -f
126 # Rewrite all other queries to the front controller.
127 RewriteRule ^ %{ENV:BASE}/app_dev.php [L]