1
0
Fork 0

Update README to support swarm

This commit is contained in:
Joao Gilberto Magalhaes 2019-07-19 00:04:55 -05:00
parent 7e2b6f0f01
commit 8d7723e415
3 changed files with 13 additions and 29 deletions

View file

@ -83,7 +83,18 @@ Important: easyhaproxy needs to be in the same network of the containers or othe
| com.byjg.easyhaproxy.redirect.<definition> | Host redirects from connections in the port defined above. | | com.byjg.easyhaproxy.redirect.<definition> | Host redirects from connections in the port defined above. |
| com.byjg.easyhaproxy.sslcert.<definition> | Cert PEM Base64 encoded. | | com.byjg.easyhaproxy.sslcert.<definition> | Cert PEM Base64 encoded. |
E.g.
Note: if you are deploying a stack set labels at the `deploy` level:
```yaml
services:
foo:
deploy:
labels:
com.byjg.easyhaproxy.definitions: "http,https"
...
```
### Single Definition: ### Single Definition:

View file

@ -6,6 +6,7 @@ RELOAD="true"
if [[ "$DISCOVER" == "static" ]]; then if [[ "$DISCOVER" == "static" ]]; then
CONTROL_FILE="/etc/haproxy/haproxy.cfg" CONTROL_FILE="/etc/haproxy/haproxy.cfg"
touch ${CONTROL_FILE}
cp ${CONTROL_FILE} ${CONTROL_FILE}.old cp ${CONTROL_FILE} ${CONTROL_FILE}.old
python3 static.py /etc/haproxy/easyconfig.yml > ${CONTROL_FILE} python3 static.py /etc/haproxy/easyconfig.yml > ${CONTROL_FILE}
else else

View file

@ -1,28 +0,0 @@
#!/usr/bin/env bash
#docker run \
# -l com.byjg.easyhaproxy.definitions=http \
# -l com.byjg.easyhaproxy.port.http=80 \
# -l com.byjg.easyhaproxy.port.localport=80 \
# -l com.byjg.easyhaproxy.host.http=byjg.com.br \
# -l com.byjg.easyhaproxy.redirect.http=byjg.com.br--http://www.byjg.com.br,byjg.com--http://www.byjg.com.br \
#-d byjg/php:7.3-fpm-nginx
touch /tmp/.docker_data /tmp/docker_data_old
cp ./.docker_data ./docker_data_old
CONTAINERS=$(docker node ps $(docker node ls -q) --format "{{ .Name }}" --filter desired-state=running | cut -d. -f1 | sort | uniq)
for container in $CONTAINERS; do
docker inspect --format "{{ json .Spec.Labels }}" $container | xargs -I % echo $container=% >> ./.docker_data
done
if cmp -s ./.docker_data ./.docker_data_old ; then
exit 0
fi
python3 swarm.py
# byjg_site={"com.byjg.easyhaproxy.definition":"http","com.byjg.easyhaproxy.host.http":"byjg.com.br","com.byjg.easyhaproxy.port.http":"80","com.byjg.easyhaproxy.redirect.http":"byjg.com.br%http://www.byjg.com.br,byjg.com%http://www.byjg.com.br","maintainer":"Joao Gilberto Magalhaes"}