Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trungams/simple-cloud
Dynamic configuration of HAProxy inside Docker containers using consul-template and registrator
https://github.com/trungams/simple-cloud
Last synced: about 1 month ago
JSON representation
Dynamic configuration of HAProxy inside Docker containers using consul-template and registrator
- Host: GitHub
- URL: https://github.com/trungams/simple-cloud
- Owner: trungams
- License: mit
- Created: 2019-05-13T07:12:16.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T05:15:37.000Z (about 2 years ago)
- Last Synced: 2023-03-08T18:42:52.645Z (almost 2 years ago)
- Language: Python
- Size: 4.06 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dynamic-proxy
Dynamic configuration of HAProxy inside Docker containers using consul-template and registrator## Quick start:
For an example config file, look at `examples/sample_config.json`
To start a docker cloud from the config file, run:
```shell
python main.py -f path/to/config/file.json
```## Example
```shell
python main.py -f ./examples/sample_config.json
```Wait for Docker to start all the containers (you can check `docker ps`), there will be 13 new containers created. Note that the assigned address for proxy container is 192.168.10.128. And the load balancing algorithm is round robin
Send HTTP requests to the first service, which is running on port 80:
```shell
for i in $(seq 10); do curl 192.168.10.128:80; done
```Now send HTTP requests to the second service, which is listening on port 8080:
```shell
for i in $(seq 10); do curl 192.168.10.128:8080; done
```You will see different hostnames and IP addresses in the replies. Which proves that there are more than one server to handle web requests.