1 { lib, pkgs, config, ... }:
3 secrets = config.myEnv.websites.piedsjaloux.integration;
4 app = pkgs.callPackage ./app {
5 composerEnv = pkgs.composerEnv.override { php = pkgs.php72; };
6 environment = secrets.environment;
7 varDir = "/var/lib/piedsjaloux_integration";
8 secretsPath = config.secrets.fullPaths."websites/piedsjaloux/integration";
10 cfg = config.myServices.websites.piedsjaloux.integration;
11 pcfg = config.services.phpApplication;
12 texlive = pkgs.texlive.combine { inherit (pkgs.texlive) attachfile preprint scheme-small; };
14 options.myServices.websites.piedsjaloux.integration.enable = lib.mkEnableOption "enable PiedsJaloux's website in integration";
16 config = lib.mkIf cfg.enable {
17 services.duplyBackup.profiles.piedsjaloux_integration.rootDir = app.varDir;
18 services.phpApplication.apps.piedsjaloux_integration = {
19 websiteEnv = "integration";
20 httpdUser = config.services.httpd.Inte.user;
21 httpdGroup = config.services.httpd.Inte.group;
22 inherit (app) webRoot varDir;
27 serviceDeps = [ "mysql.service" ];
29 "./bin/console --env=${app.environment} cache:clear --no-warmup"
31 phpOpenbasedir = [ "/tmp" ];
33 "php_admin_value[upload_max_filesize]" = "20M";
34 "php_admin_value[post_max_size]" = "20M";
35 #"php_admin_flag[log_errors]" = "on";
37 "pm.max_children" = "5";
38 "pm.process_idle_timeout" = "60";
41 PATH = lib.makeBinPath [
43 # below ones don't need to be in the PATH but they’re used in
45 pkgs.imagemagick texlive
47 SYMFONY_DEBUG_MODE = "\"yes\"";
52 phpPackage = pkgs.php72;
57 dest = "websites/piedsjaloux/integration";
58 user = config.services.httpd.Inte.user;
59 group = config.services.httpd.Inte.group;
62 # This file is auto-generated during the composer install
64 database_host: ${secrets.mysql.host}
65 database_port: ${secrets.mysql.port}
66 database_name: ${secrets.mysql.database}
67 database_user: ${secrets.mysql.user}
68 database_password: ${secrets.mysql.password}
69 database_server_version: ${pkgs.mariadb.mysqlVersion}
70 mailer_transport: smtp
71 mailer_host: 127.0.0.1
74 secret: ${secrets.secret}
75 pdflatex: "${texlive}/bin/pdflatex"
77 binary_path: ${pkgs.imagemagick}/bin
82 services.websites.env.integration.vhostConfs.piedsjaloux_integration = {
83 certName = "integration";
85 hosts = [ "piedsjaloux.immae.eu" ];
86 root = pcfg.webappDirs.piedsjaloux_integration;
90 SetHandler "proxy:unix:${pcfg.phpListenPaths.piedsjaloux_integration}|fcgi://localhost"
95 Require ldap-group cn=piedsjaloux.immae.eu,cn=httpd,ou=services,dc=immae,dc=eu
96 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://piedsjaloux.fr\"></html>"
99 <Directory ${pcfg.webappDirs.piedsjaloux_integration}>
100 Options Indexes FollowSymLinks MultiViews Includes
104 DirectoryIndex app_dev.php
106 <IfModule mod_negotiation.c>
110 <IfModule mod_rewrite.c>
113 RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
114 RewriteRule ^(.*) - [E=BASE:%1]
117 RewriteCond %{DOCUMENT_ROOT}/maintenance.php -f
118 RewriteCond %{SCRIPT_FILENAME} !maintenance.php
119 RewriteRule ^.*$ %{ENV:BASE}/maintenance.php [R=503,L]
120 ErrorDocument 503 /maintenance.php
122 # Sets the HTTP_AUTHORIZATION header removed by Apache
123 RewriteCond %{HTTP:Authorization} .
124 RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
126 RewriteCond %{ENV:REDIRECT_STATUS} ^$
127 RewriteRule ^app_dev\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
129 # If the requested filename exists, simply serve it.
130 # We only want to let Apache serve files and not directories.
131 RewriteCond %{REQUEST_FILENAME} -f
134 # Rewrite all other queries to the front controller.
135 RewriteRule ^ %{ENV:BASE}/app_dev.php [L]