]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - systems/eldiron/websites/tools/dokuwiki.nix
Squash changes containing private information
[perso/Immae/Config/Nix.git] / systems / eldiron / websites / tools / dokuwiki.nix
1 { lib, stdenv, dokuwiki, dokuwiki-plugins, config }:
2 rec {
3 varDir = "/var/lib/dokuwiki";
4 activationScript = {
5 deps = [ "wrappers" ];
6 text = ''
7 if [ ! -d ${varDir} ]; then
8 install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
9 ${varDir}/animals
10 cp -a ${webRoot}/conf.dist ${varDir}/conf
11 cp -a ${webRoot}/data.dist ${varDir}/data
12 cp -a ${webRoot}/
13 chown -R ${apache.user}:${apache.user} ${varDir}/config ${varDir}/data
14 chmod -R 755 ${varDir}/config ${varDir}/data
15 fi
16 '';
17 };
18 chatonsHostingProperties = {
19 file.datetime = "2022-08-21T22:50:00";
20 hosting = {
21 name = "Dokuwiki";
22 description = "DokuWiki is a simple to use and highly versatile Open Source wiki software";
23 website = "https://tools.immae.eu/dokuwiki/";
24 logo = "https://tools.immae.eu/dokuwiki/lib/tpl/dokuwiki/images/apple-touch-icon.png";
25 type = "INSTANCE";
26 status.level = "OK";
27 status.description = "OK";
28 registration.load = "OPEN";
29 install.type = "PACKAGE";
30 };
31 };
32 chatonsProperties = {
33 file.datetime = "2022-08-21T22:50:00";
34 service = {
35 name = "Dokuwiki";
36 description = "DokuWiki is a simple to use and highly versatile Open Source wiki software";
37 website = "https://tools.immae.eu/dokuwiki/";
38 logo = "https://tools.immae.eu/dokuwiki/lib/tpl/dokuwiki/images/apple-touch-icon.png";
39 status.level = "OK";
40 status.description = "OK";
41 registration."" = ["MEMBER" "CLIENT"];
42 registration.load = "OPEN";
43 install.type = "PACKAGE";
44 };
45 software = {
46 name = "Dokuwiki";
47 website = "https://www.dokuwiki.org/dokuwiki";
48 license.url = "http://www.gnu.org/licenses/gpl-2.0.html";
49 license.name = "GNU General Public License Version 2";
50 version = webRoot.version;
51 source.url = "https://download.dokuwiki.org/";
52 modules = map (a: a.pluginName) webRoot.plugins;
53 };
54 };
55 webRoot = dokuwiki.withPlugins (p: [ p.farmer p.todo ]);
56 apache = rec {
57 user = "wwwrun";
58 group = "wwwrun";
59 modules = [ "proxy_fcgi" ];
60 root = webRoot;
61 vhostConf = socket: ''
62 Alias /dokuwiki "${root}"
63 <Directory "${root}">
64 DirectoryIndex index.php
65 <FilesMatch "\.php$">
66 SetHandler "proxy:unix:${socket}|fcgi://localhost"
67 </FilesMatch>
68
69 AllowOverride All
70 Options +FollowSymlinks
71 Require all granted
72 </Directory>
73 '';
74 };
75 phpFpm = rec {
76 serviceDeps = [ "openldap.service" ];
77 basedir = builtins.concatStringsSep ":" (
78 [ webRoot varDir ] ++ webRoot.plugins);
79 pool = {
80 "listen.owner" = apache.user;
81 "listen.group" = apache.group;
82 "pm" = "ondemand";
83 "pm.max_children" = "60";
84 "pm.process_idle_timeout" = "60";
85
86 # Needed to avoid clashes in browser cookies (same domain)
87 "php_value[session.name]" = "DokuwikiPHPSESSID";
88 "php_admin_value[open_basedir]" = "${basedir}:/tmp";
89 "php_admin_value[session.save_handler]" = "redis";
90 "php_admin_value[session.save_path]" = "'unix:///run/redis-php-sessions/redis.sock?persistent=1&prefix=Tools:Dokuwiki:'";
91 };
92 };
93 monitoringPlugins = [ "http" ];
94 monitoringObjects.service = [
95 {
96 service_description = "dokuwiki website is running on tools.immae.eu";
97 host_name = config.hostEnv.fqdn;
98 use = "external-web-service";
99 check_command = ["check_https" "tools.immae.eu" "/dokuwiki/" "<title>start"];
100
101 servicegroups = "webstatus-webapps";
102 _webstatus_name = "Dokuwiki";
103 _webstatus_url = "https://tools.immae.eu/dokuwiki/";
104 }
105 ];
106 }