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.phpApplication.apps.ludivine_integration = {
12 websiteEnv = "integration";
13 httpdUser = config.services.httpd.Inte.user;
14 httpdGroup = config.services.httpd.Inte.group;
16 varDir = "/var/lib/ftp/immae/ludivine_var";
17 app = "/var/lib/ftp/immae/ludivine";
21 serviceDeps = [ "mysql.service" ];
23 "./bin/console --env=dev cache:clear --no-warmup"
25 phpOpenbasedir = [ "/tmp" ];
27 "php_admin_value[upload_max_filesize]" = "20M";
28 "php_admin_value[post_max_size]" = "20M";
29 #"php_admin_flag[log_errors]" = "on";
31 "pm.max_children" = "5";
32 "pm.process_idle_timeout" = "60";
35 PATH = lib.makeBinPath [
36 # below ones don't need to be in the PATH but they’re used in
38 pkgs.imagemagick pkgs.sass pkgs.ruby
40 SYMFONY_DEBUG_MODE = "\"yes\"";
43 config.secrets.fullPaths."websites/ludivine/integration"
45 phpPackage = pkgs.php72;
48 secrets.keys."websites/ludivine/integration" = {
49 user = config.services.httpd.Inte.user;
50 group = config.services.httpd.Inte.group;
53 # This file is auto-generated during the composer install
55 database_host: ${secrets.mysql.host}
56 database_port: ${secrets.mysql.port}
57 database_name: ${secrets.mysql.database}
58 database_user: ${secrets.mysql.user}
59 database_password: ${secrets.mysql.password}
60 database_server_version: ${pkgs.mariadb.mysqlVersion}
61 mailer_transport: smtp
62 mailer_host: 127.0.0.1
65 secret: ${secrets.secret}
66 ldap_host: ldap.immae.eu
71 ldap_user_bind: 'uid={username},ou=users,dc=immae,dc=eu'
72 ldap_base_dn: 'dc=immae,dc=eu'
73 ldap_search_dn: '${secrets.ldap.dn}'
74 ldap_search_password: '${secrets.ldap.password}'
75 ldap_search_filter: '${secrets.ldap.filter}'
77 binary_path: ${pkgs.imagemagick}/bin
79 sass: ${pkgs.sass}/bin/sass
80 ruby: ${pkgs.ruby}/bin/ruby
84 services.websites.env.integration.vhostConfs.ludivine_integration = {
85 certName = "integration";
87 hosts = [ "test.lc.immae.dev" ];
92 SetHandler "proxy:unix:${pcfg.phpListenPaths.ludivine_integration}|fcgi://localhost"
97 Require ldap-group cn=lc.immae.dev,cn=httpd,ou=services,dc=immae,dc=eu
98 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://ludivinecassal.com\"></html>"
101 <Directory ${webRoot}>
102 Options Indexes FollowSymLinks MultiViews Includes
106 DirectoryIndex app_dev.php
108 <IfModule mod_negotiation.c>
112 <IfModule mod_rewrite.c>
115 RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
116 RewriteRule ^(.*) - [E=BASE:%1]
119 RewriteCond %{DOCUMENT_ROOT}/maintenance.php -f
120 RewriteCond %{SCRIPT_FILENAME} !maintenance.php
121 RewriteRule ^.*$ %{ENV:BASE}/maintenance.php [R=503,L]
122 ErrorDocument 503 /maintenance.php
124 # Sets the HTTP_AUTHORIZATION header removed by Apache
125 RewriteCond %{HTTP:Authorization} .
126 RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
128 RewriteCond %{ENV:REDIRECT_STATUS} ^$
129 RewriteRule ^app_dev\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
131 # If the requested filename exists, simply serve it.
132 # We only want to let Apache serve files and not directories.
133 RewriteCond %{REQUEST_FILENAME} -f
136 # Rewrite all other queries to the front controller.
137 RewriteRule ^ %{ENV:BASE}/app_dev.php [L]