Sign inSign up

chklang/dockate-haproxy

By chklang

•Updated about 8 years ago

Docker version of Dockate with the HAPROXY connector

Image
0

347

chklang/dockate-haproxy repository overview

⁠What is dockate?

Dockate is a nodeJS application to synchronize any routeur (without docker) with a Swarm. It works with "ProxyConnector".

⁠How to run it?

1-You must define some environnement variables :

  • INTERVAL_BETWEEN_CHECK : Optional, default="5000" : Time in ms between two checks of swarm nodes
  • SWARM_HOST : Mandatory : URL of swarm manager
  • SWARM_PORT_HTTP : Mandatory : HTTP port of docker API
  • SWARM_PORT_SSH : Mandatory : SSH port of swarm manager
  • SWARM_USERNAME : Mandatory : Usrename for ssh connection to swarm manager
  • SWARM_PASSWORD : Mandatory : Password for ssh connection to swarm manager
  • HAPROXY_HOST : Mandatory : URL of HAPROXY
  • HAPROXY_PORT_SSH : Mandatory : SSH port of HAPROXY
  • HAPROXY_USERNAME_SSH : Mandatory : Usrename for ssh connection to HAPROXY
  • HAPROXY_PASSWORD_SSH : Mandatory : Password for ssh connection to HAPROXY
  • HAPROXY_FOLDER : Mandatory : Folder to save HAPROXY configuration
  • HAPROXY_HTTP_PORT : Mandatory : HTTP port of HAPROXY
  • HAPROXY_HTTPS_PORT : Optional : HTTPS port of HAPROXY
  • HAPROXY_FORCE_HTTPS : Optional, default="false" : Force https connections
  • HAPROXY_CERTIFICATS_PATH : Optional : Path of certificats (generated by acme.sh)
  • HAPROXY_RELOAD_COMMAND : Mandatory : SSH command to reload HAPROXY (ex : /etc/init.d/haproxy reload)
  • HAPROXY_USE_CAT : Optional, default="false" : Use "CAT <<'EOF' > $CONF\n##CONTENT##\nEOF' to write conf files instead of sftp (to use if sftp isn't implemented on proxy)

2-You must attach labels to yours services:

  • dockate.([0-9]+.)?port : Mandatory : Internal port of your service. Mapped with "PORTS" property
  • dockate.([0-9]+.)?domains: Optional : Domains list of the service, separate by ','. Implemented with "hdr(host) eq"
  • dockate.([0-9]+.)?authents: Optional : Users list of the service for basic authentification, separate by ','. Users declared into HAPROXY with "userlist " directive
  • dockate.([0-9]+.)?paths: Optional : Base paths to filter request, separate by ','. Implemented with "path_beg"

⁠Why dockate.([0-9]+.)?port and not dockate.port?

You can use :

  • dockate.port
  • dockate.0.port
  • dockate.5496.port
  • ...

The number is used to create some groups of constraints. Ex :

  • First :
    • dockate.0.paths=/public
  • Second :
    • dockage.1.authents=USERSCONTROL
  • And general :
    • dockate.port=80
    • dockate.domains=toto.fr

Result is :

1-Create first backend, mapped to port 80 of the container, if domain === toto.fr and request path begin with /public

2-Create second backend, mapped to port 80 of the container, if domain === toto.fr and add basic auth to userlist 'USERSCONTROL'

Rules are created by this number, asc ordered (you can use 5,10,50, or 1,2,3, etc...).

BUT WARN : rules without numbers are only for rules templates (a constraint isn't created with these rules)

Tag summary

Content type

Image

Digest

Size

22 MB

Last updated

about 8 years ago

docker pull chklang/dockate-haproxy