]>
Commit | Line | Data |
---|---|---|
1 | { lib, env, stdenv, fetchurl, shaarli }: | |
2 | let | |
3 | varDir = "/var/lib/shaarli"; | |
4 | in rec { | |
5 | backups = { | |
6 | rootDir = varDir; | |
7 | remotes = [ "eriomem" "ovh" ]; | |
8 | }; | |
9 | activationScript = '' | |
10 | install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \ | |
11 | ${varDir}/cache ${varDir}/pagecache ${varDir}/tmp ${varDir}/data \ | |
12 | ${varDir}/phpSessions | |
13 | ''; | |
14 | webRoot = shaarli varDir; | |
15 | apache = rec { | |
16 | user = "wwwrun"; | |
17 | group = "wwwrun"; | |
18 | modules = [ "proxy_fcgi" "rewrite" "env" ]; | |
19 | webappName = "tools_shaarli"; | |
20 | root = "/run/current-system/webapps/${webappName}"; | |
21 | vhostConf = socket: '' | |
22 | Alias /Shaarli "${root}" | |
23 | ||
24 | Include /var/secrets/webapps/tools-shaarli | |
25 | <Directory "${root}"> | |
26 | DirectoryIndex index.php index.htm index.html | |
27 | Options Indexes FollowSymLinks MultiViews Includes | |
28 | AllowOverride All | |
29 | Require all granted | |
30 | <FilesMatch "\.php$"> | |
31 | SetHandler "proxy:unix:${socket}|fcgi://localhost" | |
32 | </FilesMatch> | |
33 | </Directory> | |
34 | ''; | |
35 | }; | |
36 | keys = [{ | |
37 | dest = "webapps/tools-shaarli"; | |
38 | user = apache.user; | |
39 | group = apache.group; | |
40 | permissions = "0400"; | |
41 | text = '' | |
42 | SetEnv SHAARLI_LDAP_PASSWORD "${env.ldap.password}" | |
43 | SetEnv SHAARLI_LDAP_DN "${env.ldap.dn}" | |
44 | SetEnv SHAARLI_LDAP_HOST "ldaps://${env.ldap.host}" | |
45 | SetEnv SHAARLI_LDAP_BASE "${env.ldap.base}" | |
46 | SetEnv SHAARLI_LDAP_FILTER "${env.ldap.filter}" | |
47 | ''; | |
48 | }]; | |
49 | phpFpm = rec { | |
50 | serviceDeps = [ "openldap.service" ]; | |
51 | basedir = builtins.concatStringsSep ":" [ webRoot varDir ]; | |
52 | pool = { | |
53 | "listen.owner" = apache.user; | |
54 | "listen.group" = apache.group; | |
55 | "pm" = "ondemand"; | |
56 | "pm.max_children" = "60"; | |
57 | "pm.process_idle_timeout" = "60"; | |
58 | ||
59 | # Needed to avoid clashes in browser cookies (same domain) | |
60 | "php_value[session.name]" = "ShaarliPHPSESSID"; | |
61 | "php_admin_value[open_basedir]" = "${basedir}:/tmp"; | |
62 | "php_admin_value[session.save_path]" = "${varDir}/phpSessions"; | |
63 | }; | |
64 | }; | |
65 | } |