]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/tools/tools/kanboard.nix
Compress sql dumps
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / tools / kanboard.nix
CommitLineData
d21de7a0 1{ env, kanboard }:
d4ed0eff 2rec {
6a8252b1
IB
3 backups = {
4 rootDir = varDir;
5 };
d4ed0eff
IB
6 varDir = "/var/lib/kanboard";
7 activationScript = {
8 deps = [ "wrappers" ];
9 text = ''
10 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}/data
11 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
12 install -TDm644 ${webRoot}/dataold/.htaccess ${varDir}/data/.htaccess
13 install -TDm644 ${webRoot}/dataold/web.config ${varDir}/data/web.config
14 '';
15 };
8db8e666
IB
16 keys = [{
17 dest = "webapps/tools-kanboard";
98163486
IB
18 user = apache.user;
19 group = apache.group;
85f5ed68 20 permissions = "0400";
98163486
IB
21 text = ''
22 <?php
23 define('MAIL_FROM', 'kanboard@tools.immae.eu');
d4ed0eff 24
98163486
IB
25 define('DB_DRIVER', 'postgres');
26 define('DB_USERNAME', '${env.postgresql.user}');
27 define('DB_PASSWORD', '${env.postgresql.password}');
28 define('DB_HOSTNAME', '${env.postgresql.socket}');
29 define('DB_NAME', '${env.postgresql.database}');
d4ed0eff 30
3d409f87 31 define('DATA_DIR', '${varDir}');
98163486
IB
32 define('LDAP_AUTH', true);
33 define('LDAP_SERVER', '${env.ldap.host}');
34 define('LDAP_START_TLS', true);
d4ed0eff 35
98163486
IB
36 define('LDAP_BIND_TYPE', 'proxy');
37 define('LDAP_USERNAME', '${env.ldap.dn}');
38 define('LDAP_PASSWORD', '${env.ldap.password}');
39 define('LDAP_USER_BASE_DN', '${env.ldap.base}');
ab8f306d
IB
40 define('LDAP_USER_FILTER', '${env.ldap.filter}');
41 define('LDAP_GROUP_ADMIN_DN', '${env.ldap.admin_dn}');
98163486
IB
42 ?>
43 '';
8db8e666 44 }];
d21de7a0 45 webRoot = kanboard { kanboard_config = "/var/secrets/webapps/tools-kanboard"; };
d4ed0eff
IB
46 apache = rec {
47 user = "wwwrun";
48 group = "wwwrun";
49 modules = [ "proxy_fcgi" ];
50 webappName = "tools_kanboard";
51 root = "/run/current-system/webapps/${webappName}";
5400b9b6 52 vhostConf = socket: ''
d4ed0eff
IB
53 Alias /kanboard "${root}"
54 <Directory "${root}">
55 DirectoryIndex index.php
56 AllowOverride All
57 Options FollowSymlinks
58 Require all granted
59
60 <FilesMatch "\.php$">
5400b9b6 61 SetHandler "proxy:unix:${socket}|fcgi://localhost"
d4ed0eff
IB
62 </FilesMatch>
63 </Directory>
64 <DirectoryMatch "${root}/data">
65 Require all denied
66 </DirectoryMatch>
67 '';
68 };
69 phpFpm = rec {
8db8e666
IB
70 serviceDeps = [ "postgresql.service" "openldap.service" ];
71 basedir = builtins.concatStringsSep ":" [ webRoot varDir "/var/secrets/webapps/tools-kanboard" ];
5400b9b6
IB
72 pool = {
73 "listen.owner" = apache.user;
74 "listen.group" = apache.group;
75 "pm" = "ondemand";
76 "pm.max_children" = "60";
77 "pm.process_idle_timeout" = "60";
d4ed0eff 78
5400b9b6
IB
79 # Needed to avoid clashes in browser cookies (same domain)
80 "php_value[session.name]" = "KanboardPHPSESSID";
81 "php_admin_value[open_basedir]" = "${basedir}:/tmp";
82 "php_admin_value[session.save_path]" = "${varDir}/phpSessions";
83 };
d4ed0eff
IB
84 };
85}