sous-chefs / haproxy

Development repository for the haproxy cookbook
https://supermarket.chef.io/cookbooks/haproxy
Apache License 2.0
158 stars 248 forks source link

haproxy lwrp resource does not generate syntactically correct frontend and backend sections in haproxy.cfg #60

Closed nitinmohan87 closed 7 years ago

nitinmohan87 commented 10 years ago

According to the README, I created the config Mash as follows

{"global"=>
  {"maxconn"=>4096,
   "user"=>"haproxy",
   "group"=>"haproxy",
   "daemon"=>true,
   "quiet"=>true,},
 "defaults"=>
  {"timeout"=>{"client"=>"10s", "server"=>"10s", "connect"=>"10s"},
   "log"=>"global",
   "mode"=>"http"},
 "frontend"=>
  {"all_requests"=>{"bind"=>"10.0.0.1:80", "default_backend"=>"app1"}},
 "backend"=>
  {"default"=>
    {"mode"=>"http"},
   "app1"=>
    {"mode"=>"http",
     "balance"=>"roundrobin"}

This is the haproxy.cfg file the template created

global
     maxconn 4096
     user haproxy
     group haproxy
     daemon
     quiet
defaults
     timeout client 10s
     timeout server 10s
     timeout connect 10s

     log global
     mode http
frontend
     all_requests bind 10.0.0.1:80
     all_requests default_backend app3
backend
     default mode http

     app1 mode http
     app1 balance roundrobin

As you can notice the frontend and backend section don't look quite right. It should be generated in this format

frontend all_requests
     bind 10.0.0.1:80
     default_backend app1
backend default
     mode http

backend app1
     mode http
     balance roundrobin

The template and config generator needs to be modified to provide a syntactically correct haproxy.cfg - https://github.com/hw-cookbooks/haproxy/blob/master/templates/default/haproxy.dynamic.cfg.erb#L1-L4

lock[bot] commented 6 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.