1 { lib, pkgs, config, ... }:
3 secrets = config.myEnv.websites.ludivine.integration;
4 app = pkgs.callPackage ./app {
5 composerEnv = pkgs.composerEnv.override { php = pkgs.php72; };
6 environment = secrets.environment;
7 varDir = "/var/lib/ludivine_integration";
8 secretsPath = config.secrets.fullPaths."websites/ludivine/integration";
10 cfg = config.myServices.websites.ludivine.integration;
11 pcfg = config.services.phpApplication;
13 options.myServices.websites.ludivine.integration.enable = lib.mkEnableOption "enable Ludivine's website in integration";
15 config = lib.mkIf cfg.enable {
16 services.duplyBackup.profiles.ludivine_integration.rootDir = app.varDir;
17 services.phpApplication.apps.ludivine_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 [
41 # below ones don't need to be in the PATH but they’re used in
43 pkgs.imagemagick pkgs.sass pkgs.ruby
45 SYMFONY_DEBUG_MODE = "\"yes\"";
48 config.secrets.fullPaths."websites/ludivine/integration"
50 phpPackage = pkgs.php72;
55 dest = "websites/ludivine/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 ldap_host: ldap.immae.eu
78 ldap_user_bind: 'uid={username},ou=users,dc=immae,dc=eu'
79 ldap_base_dn: 'dc=immae,dc=eu'
80 ldap_search_dn: '${secrets.ldap.dn}'
81 ldap_search_password: '${secrets.ldap.password}'
82 ldap_search_filter: '${secrets.ldap.filter}'
84 binary_path: ${pkgs.imagemagick}/bin
86 sass: ${pkgs.sass}/bin/sass
87 ruby: ${pkgs.ruby}/bin/ruby
92 services.websites.env.integration.vhostConfs.ludivine_integration = {
93 certName = "integration";
95 hosts = [ "ludivine.immae.eu" ];
96 root = pcfg.webappDirs.ludivine_integration;
100 SetHandler "proxy:unix:${pcfg.phpListenPaths.ludivine_integration}|fcgi://localhost"
105 Require ldap-group cn=ludivine.immae.eu,cn=httpd,ou=services,dc=immae,dc=eu
106 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://ludivinecassal.com\"></html>"
109 <Directory ${pcfg.webappDirs.ludivine_integration}>
110 Options Indexes FollowSymLinks MultiViews Includes
114 DirectoryIndex app_dev.php
116 <IfModule mod_negotiation.c>
120 <IfModule mod_rewrite.c>
123 RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
124 RewriteRule ^(.*) - [E=BASE:%1]
127 RewriteCond %{DOCUMENT_ROOT}/maintenance.php -f
128 RewriteCond %{SCRIPT_FILENAME} !maintenance.php
129 RewriteRule ^.*$ %{ENV:BASE}/maintenance.php [R=503,L]
130 ErrorDocument 503 /maintenance.php
132 # Sets the HTTP_AUTHORIZATION header removed by Apache
133 RewriteCond %{HTTP:Authorization} .
134 RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
136 RewriteCond %{ENV:REDIRECT_STATUS} ^$
137 RewriteRule ^app_dev\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
139 # If the requested filename exists, simply serve it.
140 # We only want to let Apache serve files and not directories.
141 RewriteCond %{REQUEST_FILENAME} -f
144 # Rewrite all other queries to the front controller.
145 RewriteRule ^ %{ENV:BASE}/app_dev.php [L]