1 { lib, pkgs, config, ... }:
3 secrets = config.myEnv.websites.ludivine.integration;
4 cfg = config.myServices.websites.ludivine.integration;
5 pcfg = config.services.phpApplication;
6 webRoot = "/var/lib/ftp/immae/ludivine/web";
8 options.myServices.websites.ludivine.integration.enable = lib.mkEnableOption "enable Ludivine's website in integration";
10 config = lib.mkIf cfg.enable {
11 services.duplyBackup.profiles.ludivine_integration.rootDir = app.varDir;
12 services.phpApplication.apps.ludivine_integration = {
13 websiteEnv = "integration";
14 httpdUser = config.services.httpd.Inte.user;
15 httpdGroup = config.services.httpd.Inte.group;
17 varDir = "/var/lib/ftp/immae/ludivine_var";
18 app = "/var/lib/ftp/immae/ludivine";
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 [
37 # below ones don't need to be in the PATH but they’re used in
39 pkgs.imagemagick pkgs.sass pkgs.ruby
41 SYMFONY_DEBUG_MODE = "\"yes\"";
44 config.secrets.fullPaths."websites/ludivine/integration"
46 phpPackage = pkgs.php72;
49 secrets.keys."websites/ludivine/integration" = {
50 user = config.services.httpd.Inte.user;
51 group = config.services.httpd.Inte.group;
54 # This file is auto-generated during the composer install
56 database_host: ${secrets.mysql.host}
57 database_port: ${secrets.mysql.port}
58 database_name: ${secrets.mysql.database}
59 database_user: ${secrets.mysql.user}
60 database_password: ${secrets.mysql.password}
61 database_server_version: ${pkgs.mariadb.mysqlVersion}
62 mailer_transport: smtp
63 mailer_host: 127.0.0.1
66 secret: ${secrets.secret}
67 ldap_host: ldap.immae.eu
72 ldap_user_bind: 'uid={username},ou=users,dc=immae,dc=eu'
73 ldap_base_dn: 'dc=immae,dc=eu'
74 ldap_search_dn: '${secrets.ldap.dn}'
75 ldap_search_password: '${secrets.ldap.password}'
76 ldap_search_filter: '${secrets.ldap.filter}'
78 binary_path: ${pkgs.imagemagick}/bin
80 sass: ${pkgs.sass}/bin/sass
81 ruby: ${pkgs.ruby}/bin/ruby
85 services.websites.env.integration.vhostConfs.ludivine_integration = {
86 certName = "integration";
88 hosts = [ "ludivine.immae.eu" ];
93 SetHandler "proxy:unix:${pcfg.phpListenPaths.ludivine_integration}|fcgi://localhost"
98 Require ldap-group cn=ludivine.immae.eu,cn=httpd,ou=services,dc=immae,dc=eu
99 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://ludivinecassal.com\"></html>"
102 <Directory ${webRoot}>
103 Options Indexes FollowSymLinks MultiViews Includes
107 DirectoryIndex app_dev.php
109 <IfModule mod_negotiation.c>
113 <IfModule mod_rewrite.c>
116 RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
117 RewriteRule ^(.*) - [E=BASE:%1]
120 RewriteCond %{DOCUMENT_ROOT}/maintenance.php -f
121 RewriteCond %{SCRIPT_FILENAME} !maintenance.php
122 RewriteRule ^.*$ %{ENV:BASE}/maintenance.php [R=503,L]
123 ErrorDocument 503 /maintenance.php
125 # Sets the HTTP_AUTHORIZATION header removed by Apache
126 RewriteCond %{HTTP:Authorization} .
127 RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
129 RewriteCond %{ENV:REDIRECT_STATUS} ^$
130 RewriteRule ^app_dev\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
132 # If the requested filename exists, simply serve it.
133 # We only want to let Apache serve files and not directories.
134 RewriteCond %{REQUEST_FILENAME} -f
137 # Rewrite all other queries to the front controller.
138 RewriteRule ^ %{ENV:BASE}/app_dev.php [L]