aboutsummaryrefslogtreecommitdiff
path: root/nixops
diff options
context:
space:
mode:
Diffstat (limited to 'nixops')
-rw-r--r--nixops/modules/websites/commons/adminer.nix104
1 files changed, 38 insertions, 66 deletions
diff --git a/nixops/modules/websites/commons/adminer.nix b/nixops/modules/websites/commons/adminer.nix
index ab789b3..e911347 100644
--- a/nixops/modules/websites/commons/adminer.nix
+++ b/nixops/modules/websites/commons/adminer.nix
@@ -1,68 +1,40 @@
1{ stdenv, fetchurl, nginx }: 1{ stdenv, fetchurl, webapps }:
2let 2rec {
3 adminer = rec { 3 webRoot = webapps.adminer;
4 webRoot = stdenv.mkDerivation rec { 4 phpFpm = rec {
5 version = "4.7.0"; 5 socket = "/var/run/phpfpm/adminer.sock";
6 name = "adminer-${version}"; 6 pool = ''
7 src = fetchurl { 7 listen = ${socket}
8 url = "https://www.adminer.org/static/download/${version}/${name}.php"; 8 user = ${apache.user}
9 sha256 = "1qq2g7rbfh2vrqfm3g0bz0qs057b049n0mhabnsbd1sgnpvnc5z7"; 9 group = ${apache.group}
10 }; 10 listen.owner = ${apache.user}
11 phases = "installPhase"; 11 listen.group = ${apache.group}
12 installPhase = '' 12 pm = ondemand
13 mkdir -p $out 13 pm.max_children = 5
14 cp $src $out/index.php 14 pm.process_idle_timeout = 60
15 ;php_admin_flag[log_errors] = on
16 ; Needed to avoid clashes in browser cookies (same domain)
17 php_value[session.name] = AdminerPHPSESSID
18 php_admin_value[open_basedir] = "${webRoot}:/tmp:/var/lib/php/sessions/adminer:/var/lib/php/tmp/adminer"
19 php_admin_value[session.save_path] = "/var/lib/php/sessions/adminer"
20 php_admin_value[upload_tmp_dir] = "/var/lib/php/tmp/adminer"
15 ''; 21 '';
16 };
17 phpFpm = rec {
18 socket = "/var/run/phpfpm/adminer.sock";
19 pool = ''
20 listen = ${socket}
21 user = ${apache.user}
22 group = ${apache.group}
23 listen.owner = ${apache.user}
24 listen.group = ${apache.group}
25 pm = ondemand
26 pm.max_children = 5
27 pm.process_idle_timeout = 60
28 ;php_admin_flag[log_errors] = on
29 ; Needed to avoid clashes in browser cookies (same domain)
30 php_value[session.name] = AdminerPHPSESSID
31 php_admin_value[open_basedir] = "${webRoot}:/tmp:/var/lib/php/sessions/adminer:/var/lib/php/tmp/adminer"
32 php_admin_value[session.save_path] = "/var/lib/php/sessions/adminer"
33 php_admin_value[upload_tmp_dir] = "/var/lib/php/tmp/adminer"
34 '';
35 };
36 apache = rec {
37 user = "wwwrun";
38 group = "wwwrun";
39 modules = [ "proxy_fcgi" ];
40 webappName = "_adminer";
41 root = "/run/current-system/webapps/${webappName}";
42 vhostConf = ''
43 Alias /adminer ${root}
44 <Directory ${root}>
45 DirectoryIndex index.php
46 Require all granted
47 <FilesMatch "\.php$">
48 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
49 </FilesMatch>
50 </Directory>
51 '';
52 };
53 nginxConf = {
54 alias = webRoot;
55 index = "index.php";
56 extraConfig = ''
57 include ${nginx}/conf/fastcgi.conf;
58 fastcgi_split_path_info ^(.+?\.php)(/.*)$;
59 fastcgi_param HTTP_PROXY "";
60 fastcgi_param SCRIPT_FILENAME ${webRoot}/index.php;
61 fastcgi_pass unix:${phpFpm.socket};
62 fastcgi_index index.php;
63 fastcgi_intercept_errors on;
64 '';
65 };
66 }; 22 };
67in 23 apache = rec {
68 adminer 24 user = "wwwrun";
25 group = "wwwrun";
26 modules = [ "proxy_fcgi" ];
27 webappName = "_adminer";
28 root = "/run/current-system/webapps/${webappName}";
29 vhostConf = ''
30 Alias /adminer ${root}
31 <Directory ${root}>
32 DirectoryIndex index.php
33 Require all granted
34 <FilesMatch "\.php$">
35 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
36 </FilesMatch>
37 </Directory>
38 '';
39 };
40}