Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,77 @@ Usage of ./haproxy-consul-connect:
Consul ACL token./haproxy-consul-connect --help
```

## Minimal working example

You will need 2 SEPARATE servers within the same network, one for the server and another for the client.
On both you need all 3 binaries - consul, dataplaneapi and haproxy-consul-connect.

### The services

#### Server

Create this config file for consul:
```
{
"service": {
"name": "server",
"port": 8181,
"connect": { "sidecar_service": {} }
}
}
```
Run consul:
```
consul agent -dev -config-file client.cfg
```
Run the test server:
```
python -m SimpleHTTPServer 8181
```
Run haproxy-connect (assuming that `haproxy` and `dataplaneapi` are $PATH):
```
haproxy-consul-connect -sidecar-for server
```

#### Client

Create this config file for consul:
```
{
"service": {
"name": "client",
"port": 8080,
"connect": {
"sidecar_service": {
"proxy": {
"upstreams": [
{
"destination_name": "server",
"local_bind_port": 9191
}
]
}
}
}
}
}
```
Run consul:
```
consul agent -dev -config-file server.cfg
```
Run haproxy-connect (assuming that `haproxy` and `dataplaneapi` in $PATH) :
```
haproxy-consul-connect -sidecar-for client -log-level debug
```

### Testing

On the server:
```
curl -v 127.0.0.1:9191/
```

## Contributing

For 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.