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