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