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