aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-08-24 09:49:29 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-08-24 09:49:29 +0000
commit3eb6f59243de90ff9ba2138e820e902603ad1996 (patch)
tree94b02e65973b8cc98d18d402ba68b0d5b7bbec13
parentef4d70929c7b687a7b974e9ae438f6b8a164f16f (diff)
downloadalpine_aports-3eb6f59243de90ff9ba2138e820e902603ad1996.tar.bz2
alpine_aports-3eb6f59243de90ff9ba2138e820e902603ad1996.tar.xz
alpine_aports-3eb6f59243de90ff9ba2138e820e902603ad1996.zip
main/haproxy: better example config
also move the homedir for haproxy user to /var/lib/haproxy
-rw-r--r--main/haproxy/APKBUILD6
-rw-r--r--main/haproxy/haproxy.cfg89
-rw-r--r--main/haproxy/haproxy.pre-upgrade2
3 files changed, 85 insertions, 12 deletions
diff --git a/main/haproxy/APKBUILD b/main/haproxy/APKBUILD
index 2b7f820cf6..f89237b629 100644
--- a/main/haproxy/APKBUILD
+++ b/main/haproxy/APKBUILD
@@ -2,7 +2,7 @@
2# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 2# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
3pkgname=haproxy 3pkgname=haproxy
4pkgver=1.4.22 4pkgver=1.4.22
5pkgrel=1 5pkgrel=2
6pkgdesc="A TCP/HTTP reverse proxy for high availability environments" 6pkgdesc="A TCP/HTTP reverse proxy for high availability environments"
7url="http://haproxy.1wt.eu" 7url="http://haproxy.1wt.eu"
8arch="all" 8arch="all"
@@ -24,11 +24,11 @@ package() {
24 cd "$srcdir/$pkgname-$pkgver" 24 cd "$srcdir/$pkgname-$pkgver"
25 make DESTDIR="$pkgdir" PREFIX=/usr DOCDIR=/usr/share/doc/haproxy \ 25 make DESTDIR="$pkgdir" PREFIX=/usr DOCDIR=/usr/share/doc/haproxy \
26 install 26 install
27 install -d "$pkgdir"/usr/share/haproxy 27 install -d "$pkgdir"/var/lib/haproxy
28 install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname 28 install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
29 install -m644 -D "$srcdir"/haproxy.cfg "$pkgdir"/etc/haproxy/haproxy.cfg 29 install -m644 -D "$srcdir"/haproxy.cfg "$pkgdir"/etc/haproxy/haproxy.cfg
30} 30}
31 31
32md5sums="a0b007c76f6a78524f3b3dd5e704979c haproxy-1.4.22.tar.gz 32md5sums="a0b007c76f6a78524f3b3dd5e704979c haproxy-1.4.22.tar.gz
3381319456a35408bf47443e9c314d2e94 haproxy.initd 3381319456a35408bf47443e9c314d2e94 haproxy.initd
34f043f27db8081ee135fb452920405c51 haproxy.cfg" 341f337186b0e1ba5ee82760cb437fb810 haproxy.cfg"
diff --git a/main/haproxy/haproxy.cfg b/main/haproxy/haproxy.cfg
index 38f4625bbd..324ad5e229 100644
--- a/main/haproxy/haproxy.cfg
+++ b/main/haproxy/haproxy.cfg
@@ -1,13 +1,86 @@
1# dummy config 1#---------------------------------------------------------------------
2# Example configuration for a possible web application. See the
3# full configuration options online.
4#
5# http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
6#
7#---------------------------------------------------------------------
8
9#---------------------------------------------------------------------
10# Global settings
11#---------------------------------------------------------------------
2global 12global
3 user haproxy 13 # to have these messages end up in /var/log/haproxy.log you will
4 group haproxy 14 # need to:
5 chroot /usr/share/haproxy 15 #
6 daemon 16 # 1) configure syslog to accept network log events. This is done
17 # by adding the '-r' option to the SYSLOGD_OPTIONS in
18 # /etc/sysconfig/syslog
19 #
20 # 2) configure local2 events to go to the /var/log/haproxy.log
21 # file. A line like the following can be added to
22 # /etc/sysconfig/syslog
23 #
24 # local2.* /var/log/haproxy.log
25 #
26 log 127.0.0.1 local2
27
28 chroot /var/lib/haproxy
29 pidfile /var/run/haproxy.pid
30 maxconn 4000
31 user haproxy
32 group haproxy
33 daemon
34
35 # turn on stats unix socket
36 stats socket /var/lib/haproxy/stats
7 37
38#---------------------------------------------------------------------
39# common defaults that all the 'listen' and 'backend' sections will
40# use if not designated in their block
41#---------------------------------------------------------------------
8defaults 42defaults
9 contimeout 5000 43 mode http
10 clitimeout 50000 44 log global
45 option httplog
46 option dontlognull
47 option http-server-close
48 option forwardfor except 127.0.0.0/8
49 option redispatch
50 retries 3
51 timeout http-request 10s
52 timeout queue 1m
53 timeout connect 10s
54 timeout client 1m
55 timeout server 1m
56 timeout http-keep-alive 10s
57 timeout check 10s
58 maxconn 3000
59
60#---------------------------------------------------------------------
61# main frontend which proxys to the backends
62#---------------------------------------------------------------------
63frontend main *:5000
64 acl url_static path_beg -i /static /images /javascript /stylesheets
65 acl url_static path_end -i .jpg .gif .png .css .js
66
67 use_backend static if url_static
68 default_backend app
69
70#---------------------------------------------------------------------
71# static backend for serving up images, stylesheets and such
72#---------------------------------------------------------------------
73backend static
74 balance roundrobin
75 server static 127.0.0.1:4331 check
11 76
12listen dummy1 127.0.0.1:10001 77#---------------------------------------------------------------------
78# round robin balancing between the various backends
79#---------------------------------------------------------------------
80backend app
81 balance roundrobin
82 server app1 127.0.0.1:5001 check
83 server app2 127.0.0.1:5002 check
84 server app3 127.0.0.1:5003 check
85 server app4 127.0.0.1:5004 check
13 86
diff --git a/main/haproxy/haproxy.pre-upgrade b/main/haproxy/haproxy.pre-upgrade
index fa9083dc41..33e0164aff 100644
--- a/main/haproxy/haproxy.pre-upgrade
+++ b/main/haproxy/haproxy.pre-upgrade
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3addgroup haproxy 2>/dev/null 3addgroup haproxy 2>/dev/null
4adduser -S -H -h /usr/share/haproxy -s /bin/false -D \ 4adduser -S -H -h /var/lib/haproxy -s /bin/false -D \
5 -G haproxy haproxy 2>/dev/null 5 -G haproxy haproxy 2>/dev/null
6 6
7# move config to new location 7# move config to new location