]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame_incremental - modules/private/websites/tools/git/mantisbt.nix
Add backup MX
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / git / mantisbt.nix
... / ...
CommitLineData
1{ env, mantisbt_2, mantisbt_2-plugins }:
2rec {
3 activationScript = {
4 deps = [ "httpd" ];
5 text = ''
6 install -m 0755 -o ${apache.user} -g ${apache.group} -d /var/lib/php/sessions/mantisbt
7 '';
8 };
9 keys = [{
10 dest = "webapps/tools-mantisbt";
11 user = apache.user;
12 group = apache.group;
13 permissions = "0400";
14 text = ''
15 <?php
16 $g_hostname = '${env.postgresql.socket}';
17 $g_db_username = '${env.postgresql.user}';
18 $g_db_password = '${env.postgresql.password}';
19 $g_database_name = '${env.postgresql.database}';
20 $g_db_type = 'pgsql';
21 $g_crypto_master_salt = '${env.master_salt}';
22 $g_allow_signup = OFF;
23 $g_allow_anonymous_login = ON;
24 $g_anonymous_account = 'anonymous';
25
26 $g_phpMailer_method = PHPMAILER_METHOD_SENDMAIL;
27 $g_smtp_host = 'localhost';
28 $g_smtp_username = ''';
29 $g_smtp_password = ''';
30 $g_webmaster_email = 'mantisbt@tools.immae.eu';
31 $g_from_email = 'mantisbt@tools.immae.eu';
32 $g_return_path_email = 'mantisbt@tools.immae.eu';
33 $g_from_name = 'Mantis Bug Tracker at git.immae.eu';
34 $g_email_receive_own = ON;
35 # --- LDAP ---
36 $g_login_method = LDAP;
37 $g_ldap_protocol_version = 3;
38 $g_ldap_server = 'ldaps://${env.ldap.host}:636';
39 $g_ldap_root_dn = 'ou=users,${env.ldap.base}';
40 $g_ldap_bind_dn = '${env.ldap.dn}';
41 $g_ldap_bind_passwd = '${env.ldap.password}';
42 $g_use_ldap_email = ON;
43 $g_use_ldap_realname = ON;
44 $g_ldap_uid_field = 'uid';
45 $g_ldap_realname_field = 'cn';
46 $g_ldap_organization = '${env.ldap.filter}';
47 '';
48 }];
49 webRoot = (mantisbt_2.override { mantis_config = "/var/secrets/webapps/tools-mantisbt"; }).withPlugins (builtins.attrValues mantisbt_2-plugins);
50 apache = rec {
51 user = "wwwrun";
52 group = "wwwrun";
53 modules = [ "proxy_fcgi" ];
54 webappName = "tools_mantisbt";
55 root = "/run/current-system/webapps/${webappName}";
56 vhostConf = ''
57 Alias /mantisbt "${root}"
58 <Directory "${root}">
59 DirectoryIndex index.php
60 <FilesMatch "\.php$">
61 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
62 </FilesMatch>
63
64 AllowOverride All
65 Options FollowSymlinks
66 Require all granted
67 </Directory>
68 <Directory "${root}/admin">
69 #Reenable during upgrade
70 Require all denied
71 </Directory>
72 '';
73 };
74 phpFpm = rec {
75 serviceDeps = [ "postgresql.service" "openldap.service" ];
76 basedir = builtins.concatStringsSep ":" (
77 [ webRoot "/var/secrets/webapps/tools-mantisbt" ]
78 ++ webRoot.plugins);
79 socket = "/var/run/phpfpm/mantisbt.sock";
80 pool = ''
81 listen = ${socket}
82 user = ${apache.user}
83 group = ${apache.group}
84 listen.owner = ${apache.user}
85 listen.group = ${apache.group}
86 pm = ondemand
87 pm.max_children = 60
88 pm.process_idle_timeout = 60
89
90 php_admin_value[upload_max_filesize] = 5000000
91
92 php_admin_value[open_basedir] = "${basedir}:/tmp:/var/lib/php/sessions/mantisbt"
93 php_admin_value[session.save_path] = "/var/lib/php/sessions/mantisbt"
94 '';
95 };
96}