]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/tools/tools/ttrss.nix
Compress sql dumps
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / tools / ttrss.nix
CommitLineData
86663f17
IB
1{ php, env, ttrss, ttrss-plugins }:
2rec {
6a8252b1
IB
3 backups = {
4 rootDir = varDir;
5 };
86663f17
IB
6 varDir = "/var/lib/ttrss";
7 activationScript = {
8 deps = [ "wrappers" ];
9 text = ''
10 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
11 ${varDir}/lock ${varDir}/cache ${varDir}/feed-icons
12 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}/cache/export/ \
13 ${varDir}/cache/feeds/ \
14 ${varDir}/cache/images/ \
15 ${varDir}/cache/js/ \
16 ${varDir}/cache/simplepie/ \
17 ${varDir}/cache/upload/
18 touch ${varDir}/feed-icons/index.html
19 install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions
20 '';
21 };
22 keys = [{
23 dest = "webapps/tools-ttrss";
24 user = apache.user;
25 group = apache.group;
26 permissions = "0400";
27 text = ''
28 <?php
29
30 define('PHP_EXECUTABLE', '${php}/bin/php');
31
32 define('LOCK_DIRECTORY', 'lock');
33 define('CACHE_DIR', 'cache');
34 define('ICONS_DIR', 'feed-icons');
35 define('ICONS_URL', 'feed-icons');
36 define('SELF_URL_PATH', 'https://tools.immae.eu/ttrss/');
37
38 define('MYSQL_CHARSET', 'UTF8');
39
40 define('DB_TYPE', 'pgsql');
41 define('DB_HOST', '${env.postgresql.socket}');
42 define('DB_USER', '${env.postgresql.user}');
43 define('DB_NAME', '${env.postgresql.database}');
44 define('DB_PASS', '${env.postgresql.password}');
45 define('DB_PORT', '${env.postgresql.port}');
46
47 define('AUTH_AUTO_CREATE', true);
48 define('AUTH_AUTO_LOGIN', true);
49
50 define('SINGLE_USER_MODE', false);
51
52 define('SIMPLE_UPDATE_MODE', false);
53 define('CHECK_FOR_UPDATES', true);
54
55 define('FORCE_ARTICLE_PURGE', 0);
56 define('SESSION_COOKIE_LIFETIME', 60*60*24*120);
57 define('ENABLE_GZIP_OUTPUT', false);
58
59 define('PLUGINS', 'auth_ldap, note, instances');
60
61 define('LOG_DESTINATION', ''');
62 define('CONFIG_VERSION', 26);
63
64
65 define('SPHINX_SERVER', 'localhost:9312');
66 define('SPHINX_INDEX', 'ttrss, delta');
67
68 define('ENABLE_REGISTRATION', false);
69 define('REG_NOTIFY_ADDRESS', 'ttrss@tools.immae.eu');
70 define('REG_MAX_USERS', 10);
71
72 define('SMTP_FROM_NAME', 'Tiny Tiny RSS');
73 define('SMTP_FROM_ADDRESS', 'ttrss@tools.immae.eu');
74 define('DIGEST_SUBJECT', '[tt-rss] New headlines for last 24 hours');
75
ab8f306d 76 define('LDAP_AUTH_SERVER_URI', 'ldap://${env.ldap.host}:389/');
86663f17
IB
77 define('LDAP_AUTH_USETLS', TRUE);
78 define('LDAP_AUTH_ALLOW_UNTRUSTED_CERT', TRUE);
ab8f306d 79 define('LDAP_AUTH_BASEDN', '${env.ldap.base}');
86663f17 80 define('LDAP_AUTH_ANONYMOUSBEFOREBIND', FALSE);
ab8f306d 81 define('LDAP_AUTH_SEARCHFILTER', '${env.ldap.filter}');
86663f17 82
ab8f306d 83 define('LDAP_AUTH_BINDDN', '${env.ldap.dn}');
86663f17
IB
84 define('LDAP_AUTH_BINDPW', '${env.ldap.password}');
85 define('LDAP_AUTH_LOGIN_ATTRIB', 'immaeTtrssLogin');
86
87 define('LDAP_AUTH_LOG_ATTEMPTS', FALSE);
88 define('LDAP_AUTH_DEBUG', FALSE);
eb770e14 89 '';
86663f17 90 }];
34c7b88e
IB
91 webRoot = (ttrss.override { ttrss_config = "/var/secrets/webapps/tools-ttrss"; }).withPlugins (p: [
92 p.auth_ldap p.ff_instagram p.tumblr_gdpr_ua
93 (p.af_feedmod.override { patched = true; })
94 (p.feediron.override { patched = true; })
95 ]);
86663f17
IB
96 apache = rec {
97 user = "wwwrun";
98 group = "wwwrun";
99 modules = [ "proxy_fcgi" ];
100 webappName = "tools_ttrss";
101 root = "/run/current-system/webapps/${webappName}";
5400b9b6 102 vhostConf = socket: ''
86663f17
IB
103 Alias /ttrss "${root}"
104 <Directory "${root}">
105 DirectoryIndex index.php
106 <FilesMatch "\.php$">
5400b9b6 107 SetHandler "proxy:unix:${socket}|fcgi://localhost"
86663f17
IB
108 </FilesMatch>
109
110 AllowOverride All
111 Options FollowSymlinks
112 Require all granted
113 </Directory>
eb770e14 114 '';
86663f17
IB
115 };
116 phpFpm = rec {
117 serviceDeps = [ "postgresql.service" "openldap.service" ];
118 basedir = builtins.concatStringsSep ":" (
119 [ webRoot "/var/secrets/webapps/tools-ttrss" varDir ]
120 ++ webRoot.plugins);
5400b9b6
IB
121 pool = {
122 "listen.owner" = apache.user;
123 "listen.group" = apache.group;
124 "pm" = "ondemand";
125 "pm.max_children" = "60";
126 "pm.process_idle_timeout" = "60";
127
128 # Needed to avoid clashes in browser cookies (same domain)
129 "php_value[session.name]" = "TtrssPHPSESSID";
130 "php_admin_value[open_basedir]" = "${basedir}:/tmp";
131 "php_admin_value[session.save_path]" = "${varDir}/phpSessions";
132 };
eb770e14 133 };
86663f17 134}