]>
Commit | Line | Data |
---|---|---|
ab8f306d | 1 | { lib, pkgs, config, ... }: |
f8026b6e | 2 | let |
ab8f306d | 3 | secrets = config.myEnv.websites.connexionswing.integration; |
41cce84a IB |
4 | webRoot = "/var/lib/ftp/immae/connexionswing/web"; |
5 | varDir = "/var/lib/ftp/immae/connexionswing_var"; | |
f8026b6e | 6 | cfg = config.myServices.websites.connexionswing.integration; |
9f66adf4 | 7 | pcfg = config.services.phpApplication; |
f8026b6e IB |
8 | in { |
9 | options.myServices.websites.connexionswing.integration.enable = lib.mkEnableOption "enable Connexionswing's website in integration"; | |
10 | ||
11 | config = lib.mkIf cfg.enable { | |
d3452fc5 | 12 | services.phpApplication.apps.connexionswing_integration = { |
9f66adf4 IB |
13 | websiteEnv = "integration"; |
14 | httpdUser = config.services.httpd.Inte.user; | |
15 | httpdGroup = config.services.httpd.Inte.group; | |
41cce84a | 16 | inherit webRoot varDir; |
9f66adf4 IB |
17 | varDirPaths = { |
18 | "medias" = "0700"; | |
19 | "uploads" = "0700"; | |
20 | "var" = "0700"; | |
21 | }; | |
41cce84a | 22 | app = "/var/lib/ftp/immae/connexionswing"; |
9f66adf4 IB |
23 | serviceDeps = [ "mysql.service" ]; |
24 | preStartActions = [ | |
41cce84a | 25 | "./bin/console --env=dev cache:clear --no-warmup" |
9f66adf4 IB |
26 | ]; |
27 | phpOpenbasedir = [ "/tmp" "/run/wrappers/bin/sendmail" ]; | |
5400b9b6 IB |
28 | phpPool = { |
29 | "php_admin_value[upload_max_filesize]" = "20M"; | |
30 | "php_admin_value[post_max_size]" = "20M"; | |
31 | #"php_admin_flag[log_errors]" = "on"; | |
32 | "pm" = "ondemand"; | |
33 | "pm.max_children" = "5"; | |
34 | "pm.process_idle_timeout" = "60"; | |
35 | }; | |
36 | phpEnv = { | |
d3452fc5 | 37 | SYMFONY_DEBUG_MODE = "\"yes\""; |
5400b9b6 | 38 | }; |
9f66adf4 | 39 | phpWatchFiles = [ |
d3452fc5 | 40 | config.secrets.fullPaths."websites/connexionswing/integration" |
9f66adf4 | 41 | ]; |
dcac3ec7 | 42 | phpPackage = pkgs.php72; |
f40f5b23 | 43 | }; |
9f66adf4 | 44 | |
4c4652aa IB |
45 | secrets.keys."websites/connexionswing/integration" = { |
46 | user = config.services.httpd.Inte.user; | |
47 | group = config.services.httpd.Inte.group; | |
48 | permissions = "0400"; | |
49 | text = '' | |
50 | # This file is auto-generated during the composer install | |
51 | parameters: | |
52 | database_host: ${secrets.mysql.host} | |
53 | database_port: ${secrets.mysql.port} | |
54 | database_name: ${secrets.mysql.database} | |
55 | database_user: ${secrets.mysql.user} | |
56 | database_password: ${secrets.mysql.password} | |
57 | database_server_version: ${pkgs.mariadb.mysqlVersion} | |
58 | mailer_transport: sendmail | |
59 | mailer_host: null | |
60 | mailer_user: null | |
61 | mailer_password: null | |
62 | subscription_email: ${secrets.email} | |
63 | allow_robots: true | |
64 | secret: ${secrets.secret} | |
65 | ''; | |
66 | }; | |
9f66adf4 | 67 | |
d3452fc5 IB |
68 | services.websites.env.integration.vhostConfs.connexionswing_integration = { |
69 | certName = "integration"; | |
f8026b6e | 70 | addToCerts = true; |
7c5e6fe8 | 71 | hosts = ["connexionswing.cs.immae.dev" "sandetludo.cs.immae.dev" ]; |
41cce84a | 72 | root = webRoot; |
9f66adf4 IB |
73 | extraConfig = [ |
74 | '' | |
75 | <FilesMatch "\.php$"> | |
d3452fc5 | 76 | SetHandler "proxy:unix:${pcfg.phpListenPaths.connexionswing_integration}|fcgi://localhost" |
9f66adf4 IB |
77 | </FilesMatch> |
78 | ||
41cce84a | 79 | <Directory ${varDir}/medias> |
9f66adf4 IB |
80 | Options FollowSymLinks |
81 | AllowOverride None | |
82 | Require all granted | |
83 | </Directory> | |
84 | ||
41cce84a | 85 | <Directory ${varDir}/uploads> |
9f66adf4 IB |
86 | Options FollowSymLinks |
87 | AllowOverride None | |
88 | Require all granted | |
89 | </Directory> | |
90 | ||
91 | <Location /> | |
92 | Use LDAPConnect | |
7c5e6fe8 | 93 | Require ldap-group cn=cs.immae.dev,cn=httpd,ou=services,dc=immae,dc=eu |
9f66adf4 IB |
94 | ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://connexionswing.com\"></html>" |
95 | </Location> | |
96 | ||
41cce84a | 97 | <Directory ${webRoot}> |
9f66adf4 IB |
98 | Options Indexes FollowSymLinks MultiViews Includes |
99 | AllowOverride None | |
100 | Require all granted | |
101 | ||
102 | DirectoryIndex app_dev.php | |
103 | ||
104 | <IfModule mod_negotiation.c> | |
105 | Options -MultiViews | |
106 | </IfModule> | |
107 | ||
108 | <IfModule mod_rewrite.c> | |
109 | RewriteEngine On | |
110 | ||
111 | RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ | |
112 | RewriteRule ^(.*) - [E=BASE:%1] | |
113 | ||
114 | # Maintenance script | |
115 | RewriteCond %{DOCUMENT_ROOT}/maintenance.php -f | |
116 | RewriteCond %{SCRIPT_FILENAME} !maintenance.php | |
117 | RewriteRule ^.*$ %{ENV:BASE}/maintenance.php [R=503,L] | |
118 | ErrorDocument 503 /maintenance.php | |
119 | ||
120 | # Sets the HTTP_AUTHORIZATION header removed by Apache | |
121 | RewriteCond %{HTTP:Authorization} . | |
122 | RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | |
123 | ||
124 | RewriteCond %{ENV:REDIRECT_STATUS} ^$ | |
125 | RewriteRule ^app_dev\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L] | |
126 | ||
127 | # If the requested filename exists, simply serve it. | |
128 | # We only want to let Apache serve files and not directories. | |
129 | RewriteCond %{REQUEST_FILENAME} -f | |
130 | RewriteRule ^ - [L] | |
131 | ||
132 | # Rewrite all other queries to the front controller. | |
133 | RewriteRule ^ %{ENV:BASE}/app_dev.php [L] | |
134 | </IfModule> | |
135 | ||
136 | </Directory> | |
137 | '' | |
138 | ]; | |
17f6eae9 | 139 | }; |
f8026b6e IB |
140 | }; |
141 | } |