Skip to content

Commit

Permalink
DOC: Add minimal working example (#54)
Browse files Browse the repository at this point in the history
based on #5
  • Loading branch information
Greg Dubicki authored May 27, 2020
1 parent 9b0cea0 commit 198161d
Showing 1 changed file with 71 additions and 0 deletions.
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.

0 comments on commit 198161d

Please sign in to comment.