https://github.com/elahe-dastan/haproxy
https://github.com/elahe-dastan/haproxy
docker-compose go golang haproxy http load-balancer
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/elahe-dastan/haproxy
- Owner: elahe-dastan
- Created: 2020-08-08T12:25:56.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-12T18:06:28.000Z (over 5 years ago)
- Last Synced: 2025-01-14T11:14:32.741Z (about 1 year ago)
- Topics: docker-compose, go, golang, haproxy, http, load-balancer
- Language: Go
- Homepage:
- Size: 165 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
[](https://cloud.drone.io/elahe-dastan/haproxy)
# haproxy
I have had a repository for learning and practicing 'nats' then I started thinking about what the difference is
between different technologies for load balancing.The biggest difference is that technologies like 'nats' and
'rabbitmq' are used to dispatch jobs inside a project to different workers but technologies like 'nginx' and 'haproxy'
are used to dispatch incoming http requests to different servers.
In this repository I want to learn how to use 'haproxy' to balance http traffic.
## How to use haproxy
Using haproxy is super simple regardless of the language of backend here I have an easy code in golang and then added
haproxy.
My code creates an endpoint and with every get request it just sleeps 5 seconds and then says hi.


then we need haproxy itself, I use docker-compose to run it

Haproxy needs a config file called haproxy.cfg that I show later, the point I want to mention in here is that since
I have used docker-compose to run haproxy I vae to mount the haproxy.cfg file as shown in the screenshot
Here is my haproxy.cfg file

Merge Request by [Parham Alvani](https://github.com/1995parham)