Skip to content

Commit 0b4927c

Browse files
committed
Updated README with link to appliance
This patch updates the README with a link to the appliance, as well as how to deploy the appliance using the official quick start guide.
1 parent 6d8b28a commit 0b4927c

File tree

3 files changed

+205
-215
lines changed

3 files changed

+205
-215
lines changed

README.md

Lines changed: 17 additions & 215 deletions
Original file line numberDiff line numberDiff line change
@@ -1,226 +1,28 @@
1-
# haproxy
1+
# VMware + HAProxy
22

3-
HAProxy and its [dataplane API](https://www.haproxy.com/documentation/dataplaneapi/latest) provide a remotely-configurable, open source load balancer solution for the load balancer API.
3+
This project enables customers to build an OSS virtual appliance with HAProxy and its [Data Plane API](https://www.haproxy.com/documentation/dataplaneapi/latest) designed to enable Kubernetes workload management with Project Pacific on vSphere 7.
44

5-
## Overview
5+
* [Download](#download)
6+
* [Deploy](#deploy)
7+
* [Build](#build)
8+
* [Test](#test)
69

7-
This document provides:
10+
## Download
811

9-
* [A quick and easy demonstration of HAProxy as a load-balancer using containers](#quickstart)
10-
* [Instructions for building a light-weight, HAProxy load-balancer OVA](#ova)
12+
The latest version of the appliance OVA is always available from the [releases](https://github.com/haproxytech/vmware-haproxy/releases) page:
1113

12-
## Quickstart
14+
| Version | SHA256 |
15+
|---|---|
16+
| [v0.1.8](https://github.com/haproxytech/vmware-haproxy/releases/download/v0.1.8/vmware-haproxy-v0.1.8.ova) | `eac73c1207c05aeeece6d17dd1ac1dde0e557d94812f19082751cfb6925ad082` |
1317

14-
Illustrating the utility of haproxy as a load-balancer is best accomplished using a container:
18+
## Deploy
1519

16-
1. Build the image:
20+
Please see the [_vSphere with Tanzu Quick Start Guide_](https://core.vmware.com/resource/vsphere-tanzu-quick-start-guide) on how to deploy the appliance on vSphere with Tanzu.
1721

18-
```shell
19-
make build-image
20-
```
22+
## Build
2123

22-
2. Start the haproxy image in detached mode and map its secure, dataplane API port (`5556`) and the port used by the load balancer (`8085`) to the local host:
24+
Documentation on how to build the appliance is available [here](./docs/how-to-build-ova.md).
2325

24-
```shell
25-
docker run -it --name haproxy -d --rm -p 5556:5556 -p 8085:8085 haproxy
26-
```
26+
## Test
2727

28-
3. Create a [frontend configuration](https://www.haproxy.com/documentation/dataplaneapi/latest/#tag/Frontend):
29-
30-
```shell
31-
$ curl -X POST \
32-
--cacert example/ca.crt \
33-
--cert example/client.crt --key example/client.key \
34-
--user client:cert \
35-
-H "Content-Type: application/json" \
36-
-d '{"name": "lb-frontend", "mode": "tcp"}' \
37-
"https://localhost:5556/v2/services/haproxy/configuration/frontends?version=1"
38-
{"mode":"tcp","name":"lb-frontend"}
39-
```
40-
41-
4. [Bind](https://www.haproxy.com/documentation/dataplaneapi/latest/#tag/Bind) the frontend configuration to `*:8085`:
42-
43-
```shell
44-
$ curl -X POST \
45-
--cacert example/ca.crt \
46-
--cert example/client.crt --key example/client.key \
47-
--user client:cert \
48-
-H "Content-Type: application/json" \
49-
-d '{"name": "lb-frontend", "address": "*", "port": 8085}' \
50-
"https://localhost:5556/v2/services/haproxy/configuration/binds?frontend=lb-frontend&version=2"
51-
{"address":"*","name":"lb-frontend","port":8085}
52-
```
53-
54-
5. At this point it is possible to curl the load balancer, even if there is no one on the backend answering the query:
55-
56-
```shell
57-
$ curl http://localhost:8085
58-
<html><body><h1>503 Service Unavailable</h1>
59-
No server is available to handle this request.
60-
</body></html>
61-
```
62-
63-
6. Create a [backend configuration](https://www.haproxy.com/documentation/dataplaneapi/latest/#tag/Backend) and bind it to the frontend configuration:
64-
65-
```shell
66-
$ curl -X POST \
67-
--cacert example/ca.crt \
68-
--cert example/client.crt --key example/client.key \
69-
--user client:cert \
70-
-H "Content-Type: application/json" \
71-
-d '{"name": "lb-backend", "mode":"tcp", "balance": {"algorithm":"roundrobin"}, "adv_check": "tcp-check"}' \
72-
"https://localhost:5556/v2/services/haproxy/configuration/backends?version=3"
73-
{"adv_check":"tcp-check","balance":{"algorithm":"roundrobin","arguments":null},"mode":"tcp","name":"lb-backend"}
74-
```
75-
76-
7. Update the frontend to use the backend:
77-
78-
```shell
79-
$ curl -X PUT \
80-
--cacert example/ca.crt \
81-
--cert example/client.crt --key example/client.key \
82-
--user client:cert \
83-
-H "Content-Type: application/json" \
84-
-d '{"name": "lb-frontend", "mode": "tcp", "default_backend": "lb-backend"}' \
85-
"https://localhost:5556/v2/services/haproxy/configuration/frontends/lb-frontend?version=4"
86-
{"default_backend":"lb-backend","mode":"tcp","name":"lb-frontend"}
87-
```
88-
89-
8. Run two simple web servers in detached mode named `http1` and `http2`:
90-
91-
```shell
92-
docker run --rm -d -p 8086:80 --name "http1" nginxdemos/hello:plain-text && \
93-
docker run --rm -d -p 8087:80 --name "http2" nginxdemos/hello:plain-text
94-
```
95-
96-
9. Add the first web [server](https://www.haproxy.com/documentation/dataplaneapi/latest/#tag/Server) to the backend configuration:
97-
98-
```shell
99-
$ curl -X POST \
100-
--cacert example/ca.crt \
101-
--cert example/client.crt --key example/client.key \
102-
--user client:cert \
103-
-H "Content-Type: application/json" \
104-
-d '{"name": "lb-backend-server-1", "address": "'"$(docker inspect http1 -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}')"'", "port": 80, "check": "enabled", "maxconn": 30, "verify": "none", "weight": 100}' \
105-
"https://localhost:5556/v2/services/haproxy/configuration/servers?backend=lb-backend&version=5"
106-
{"address":"172.17.0.2","check":"enabled","maxconn":30,"name":"lb-backend-server-1","port":80,"weight":100}
107-
```
108-
109-
10. With the first web server attached to the load balancer's backend configuration, it should now be possible to query the load balancer and get more than an empty reply:
110-
111-
```shell
112-
$ curl http://localhost:8085
113-
Server address: 172.17.0.2:80
114-
Server name: 456dbfd57701
115-
Date: 21/Dec/2019:22:22:22 +0000
116-
URI: /
117-
Request ID: 7bcabcecb553bcee5ed7efb4b8725f96
118-
```
119-
120-
Sure enough, the server address `172.17.0.2` is the same as the reported IP address of `lb-backend-server-1` above!
121-
122-
11. Add the second web server to the backend configuration:
123-
124-
```shell
125-
$ curl -X POST \
126-
--cacert example/ca.crt \
127-
--cert example/client.crt --key example/client.key \
128-
--user client:cert \
129-
-H "Content-Type: application/json" \
130-
-d '{"name": "lb-backend-server-2", "address": "'"$(docker inspect http2 -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}')"'", "port": 80, "check": "enabled", "maxconn": 30, "verify": "none", "weight": 100}' \
131-
"https://localhost:5556/v2/services/haproxy/configuration/servers?backend=lb-backend&version=6"
132-
{"address":"172.17.0.3","check":"enabled","maxconn":30,"name":"lb-backend-server-2","port":80,"weight":100}
133-
```
134-
135-
12. Now that both web servers are connected to the load-balancer, use `curl` to query the load-balanced endpoint a few times to validate that both backend servers are being used:
136-
137-
```shell
138-
$ for i in {1..4}; do curl http://localhost:8085 && echo; done
139-
Server address: 172.17.0.2:80
140-
Server name: 456dbfd57701
141-
Date: 21/Dec/2019:22:26:51 +0000
142-
URI: /
143-
Request ID: 77918aee58dd1eb7ba068b081d843a7c
144-
145-
Server address: 172.17.0.3:80
146-
Server name: 877362812ed9
147-
Date: 21/Dec/2019:22:26:51 +0000
148-
URI: /
149-
Request ID: 097ccb892b565193f334fb544239fca6
150-
151-
Server address: 172.17.0.2:80
152-
Server name: 456dbfd57701
153-
Date: 21/Dec/2019:22:26:51 +0000
154-
URI: /
155-
Request ID: 61022aa3a8a37cdf37541ec1c24b383e
156-
157-
Server address: 172.17.0.3:80
158-
Server name: 877362812ed9
159-
Date: 21/Dec/2019:22:26:51 +0000
160-
URI: /
161-
Request ID: 2b2b9a0ef2e4eba53f6c5c118c10e1d8
162-
```
163-
164-
It's alive!
165-
166-
13. Stop haproxy and kill the web servers:
167-
168-
```shell
169-
docker kill haproxy http1 http2
170-
```
171-
172-
## OVA
173-
174-
In production the HAProxy loadbalancer is deployed as an OVA.
175-
176-
### OVA Requirements
177-
178-
Building the OVA requires:
179-
180-
* VMware Fusion or Workstation
181-
* Packer 1.4.1
182-
* Ansible 2.8+
183-
184-
### Building the OVA
185-
186-
To build the OVA please run the following the command:
187-
188-
```shell
189-
export PATH=/Applications/VMware\ Fusion.app/Contents/Library/:$PATH ## add `vmware-vdiskmanager` to path
190-
make build-ova
191-
```
192-
193-
The above command build the OVA with Packer in _headless_ mode, meaning that VMware Fusion/Workstation will not display the virtual machine (VM) as it is being built. If the build process fails or times out, please use the following command to build the OVA in the foreground:
194-
195-
```shell
196-
export PATH=/Applications/VMware\ Fusion.app/Contents/Library/:$PATH ## add `vmware-vdiskmanager` to path
197-
FOREGROUND=1 make build-ova
198-
```
199-
200-
Once the OVA is built, it should be located at `./output/ova/haproxy.ova` and be around `500MiB`.
201-
202-
### Downloading the OVA
203-
204-
A full list of the published HAProxy load balancer images for CAPV may be obtained with the following command:
205-
206-
```shell
207-
gsutil ls gs://load-balancer-api/ova/release
208-
```
209-
210-
To produce a list of URLs for released images (and their checksums), the following command may be used:
211-
212-
```shell
213-
gsutil ls gs://load-balancer-api/ova/release/*/*.{ova,sha256} | sed 's~^gs://~http://storage.googleapis.com/~'
214-
```
215-
216-
A list of unreleased images are also avaialble:
217-
218-
```shell
219-
gsutil ls gs://load-balancer-api/ova/ci
220-
```
221-
222-
And to get a list of URLs for unreleased images:
223-
224-
```shell
225-
gsutil ls gs://load-balancer-api/ova/ci/*/*.{ova,sha256} | sed 's~^gs://~http://storage.googleapis.com/~'
226-
```
28+
Documentation on how to test the components in the appliance with Docker containers is available [here](./docs/how-to-container.md).

docs/how-to-build-ova.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Building the Appliance
2+
3+
This page describes how to build the appliance OVA.
4+
5+
## Requirements
6+
7+
Building the OVA requires:
8+
9+
* VMware Fusion or Workstation
10+
* Packer 1.4.1
11+
* Ansible 2.8+
12+
13+
## Build the OVA
14+
15+
To build the OVA please run the following the command:
16+
17+
```shell
18+
export PATH=/Applications/VMware\ Fusion.app/Contents/Library/:$PATH ## add `vmware-vdiskmanager` to path
19+
make build-ova
20+
```
21+
22+
The above command build the OVA with Packer in _headless_ mode, meaning that VMware Fusion/Workstation will not display the virtual machine (VM) as it is being built. If the build process fails or times out, please use the following command to build the OVA in the foreground:
23+
24+
```shell
25+
export PATH=/Applications/VMware\ Fusion.app/Contents/Library/:$PATH ## add `vmware-vdiskmanager` to path
26+
FOREGROUND=1 make build-ova
27+
```
28+
29+
Once the OVA is built, it should be located at `./output/ova/haproxy.ova` and be around `500MiB`.

0 commit comments

Comments
 (0)