File tree Expand file tree Collapse file tree 1 file changed +71
-0
lines changed
Expand file tree Collapse file tree 1 file changed +71
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,77 @@ Usage of ./haproxy-consul-connect:
4949 Consul ACL token./haproxy-consul-connect --help
5050```
5151
52+ ## Minimal working example
53+
54+ You will need 2 SEPARATE servers within the same network, one for the server and another for the client.
55+ On both you need all 3 binaries - consul, dataplaneapi and haproxy-consul-connect.
56+
57+ ### The services
58+
59+ #### Server
60+
61+ Create this config file for consul:
62+ ```
63+ {
64+ "service": {
65+ "name": "server",
66+ "port": 8181,
67+ "connect": { "sidecar_service": {} }
68+ }
69+ }
70+ ```
71+ Run consul:
72+ ```
73+ consul agent -dev -config-file client.cfg
74+ ```
75+ Run the test server:
76+ ```
77+ python -m SimpleHTTPServer 8181
78+ ```
79+ Run haproxy-connect (assuming that ` haproxy ` and ` dataplaneapi ` are $PATH):
80+ ```
81+ haproxy-consul-connect -sidecar-for server
82+ ```
83+
84+ #### Client
85+
86+ Create this config file for consul:
87+ ```
88+ {
89+ "service": {
90+ "name": "client",
91+ "port": 8080,
92+ "connect": {
93+ "sidecar_service": {
94+ "proxy": {
95+ "upstreams": [
96+ {
97+ "destination_name": "server",
98+ "local_bind_port": 9191
99+ }
100+ ]
101+ }
102+ }
103+ }
104+ }
105+ }
106+ ```
107+ Run consul:
108+ ```
109+ consul agent -dev -config-file server.cfg
110+ ```
111+ Run haproxy-connect (assuming that ` haproxy ` and ` dataplaneapi ` in $PATH) :
112+ ```
113+ haproxy-consul-connect -sidecar-for client -log-level debug
114+ ```
115+
116+ ### Testing
117+
118+ On the server:
119+ ```
120+ curl -v 127.0.0.1:9191/
121+ ```
122+
52123## Contributing
53124
54125For commit messages and general style please follow the haproxy project's [ CONTRIBUTING guide] ( https://github.com/haproxy/haproxy/blob/master/CONTRIBUTING ) and use that where applicable.
You can’t perform that action at this time.
0 commit comments