summaryrefslogtreecommitdiff
path: root/puppet
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2013-03-19 16:09:34 -0400
committerMicah Anderson <micah@riseup.net>2013-03-19 16:10:00 -0400
commitf1b405b503a76526551ac0110cad8798de46dfd8 (patch)
tree6123ff1f444cd4eecc9a6b39bff752180bc766d6 /puppet
parent7c7ca311ff00c5cddaee892c173354a69f4e59e4 (diff)
configure site_webapp::haproxy to ship a haproxy config::fragment to setup the
haproxy listener 'bigcouch-in'. This haproxy listener is configured to listen on port 4096 (arbitrarily chosen) and balance across the locally configured stunnels to the bigcouch instances It may be that we will need some additional haproxy options for handling persistence, cookies, or other HTTP headers, I'm unsure as of this moment
Diffstat (limited to 'puppet')
-rw-r--r--puppet/modules/site_webapp/manifests/haproxy.pp14
-rw-r--r--puppet/modules/site_webapp/manifests/init.pp1
-rw-r--r--puppet/modules/site_webapp/templates/haproxy_couchdb.cfg.erb16
3 files changed, 31 insertions, 0 deletions
diff --git a/puppet/modules/site_webapp/manifests/haproxy.pp b/puppet/modules/site_webapp/manifests/haproxy.pp
new file mode 100644
index 00000000..4a7e3c25
--- /dev/null
+++ b/puppet/modules/site_webapp/manifests/haproxy.pp
@@ -0,0 +1,14 @@
+class site_webapp::haproxy {
+
+ include site_haproxy
+
+ $haproxy = hiera('haproxy')
+ $local_ports = $haproxy['local_ports']
+
+ # Template uses $global_options, $defaults_options
+ concat::fragment { 'leap_haproxy_webapp_couchdb':
+ target => '/etc/haproxy/haproxy.cfg',
+ order => '20',
+ content => template('site_webapp/haproxy_couchdb.cfg.erb'),
+ }
+}
diff --git a/puppet/modules/site_webapp/manifests/init.pp b/puppet/modules/site_webapp/manifests/init.pp
index e8134521..ec70a68d 100644
--- a/puppet/modules/site_webapp/manifests/init.pp
+++ b/puppet/modules/site_webapp/manifests/init.pp
@@ -17,6 +17,7 @@ class site_webapp {
include site_webapp::apache
include site_webapp::couchdb
include site_webapp::client_ca
+ include site_webapp::haproxy
group { 'leap-webapp':
ensure => present,
diff --git a/puppet/modules/site_webapp/templates/haproxy_couchdb.cfg.erb b/puppet/modules/site_webapp/templates/haproxy_couchdb.cfg.erb
new file mode 100644
index 00000000..a9bdb923
--- /dev/null
+++ b/puppet/modules/site_webapp/templates/haproxy_couchdb.cfg.erb
@@ -0,0 +1,16 @@
+
+listen bigcouch-in
+ mode http
+ balance roundrobin
+
+ option httplog
+ option dontlognull
+ option tcplog
+
+ bind localhost:4096
+<% for port in @local_ports -%>
+ server couchdb_<%=port%> localhost:<%=port%>
+<% end -%>
+
+
+