diff --git a/README.md b/README.md index e051e25..c1156b8 100644 --- a/README.md +++ b/README.md @@ -42,11 +42,11 @@ The environment variables will setup the HAProxy. |-------------------------------|-------------------------------------------------------------------------------| | EASYHAPROXY_DISCOVER | How `haproxy.cfg` will be created: `static`, `docker` or `swarm` | | EASYHAPROXY_LABEL_PREFIX | (Optional) The key will search to match resources. Default: `easyhaproxy`. | -[ EASYHAPROXY_LETSENCRYPT_EMAIL | (Optional) The email will be used to request certificate to letsencrypt | +| EASYHAPROXY_LETSENCRYPT_EMAIL | (Optional) The email will be used to request certificate to letsencrypt | | HAPROXY_USERNAME | (Optional) The HAProxy username to the statistics. Default: `admin` | | HAPROXY_PASSWORD | The HAProxy password to the statistics. If not set disable stats. | | HAPROXY_STATS_PORT | (Optional) The HAProxy port to the statistics. Default: `1936` | -| HAPROXY_CUSTOMERRORS. | (Optional) If HAProxy will use custom HTML errors. true/false. Default: false | +| HAPROXY_CUSTOMERRORS | (Optional) If HAProxy will use custom HTML errors. true/false. Default: false | The environment variable `EASYHAPROXY_DISCOVER` will define where is located your containers (see below more details): @@ -89,14 +89,14 @@ Important: easyhaproxy needs to be in the same network of the containers or othe | Tag | Description | Example | |---------------------------------------|---------------------------------------------------------------------------------------------------------|--------------| -| easyhaproxy.[definition].host | Host HAProxy is listening | somehost.com | +| easyhaproxy.[definition].host | Host(s) HAProxy is listening. More than one host use comma as delimiter | somehost.com OR host1.com,host2.com | | easyhaproxy.[definition].mode | (Optional) Is this `http` or `tcp` mode in HAProxy. (Defaults to http) | http | | easyhaproxy.[definition].port | (Optional) Port HAProxy will listen for the host. (Defaults to 80) | 80 | | easyhaproxy.[definition].localport | (Optional) Port container is listening. (Defaults to 80) | 8080 | -| easyhaproxy.[definition].redirect | (Optional) Host redirects from connections in the port defined above. | foo.com--https://bla.com,bar.com--https://bar.org | +| easyhaproxy.[definition].redirect | (Optional) JSON containing key/value pair from host/to url redirect. | {"foo.com":"https://bla.com", "bar.com":"https://bar.org"} | | easyhaproxy.[definition].sslcert | (Optional) Cert PEM Base64 encoded. Do not use this if letsencrypt is enabled. | | | easyhaproxy.[definition].health-check | (Optional) `ssl`, enable health check via SSL in `mode tcp` (Defaults to "empty") | | -| easyhaproxy.[definition].letsencrypt | (Optional) Generate certificate with letsencrypt. Do not use with sslcert | true, yes | +| easyhaproxy.[definition].letsencrypt | (Optional) Generate certificate with letsencrypt. Do not use with sslcert | true OR yes OR false OR no | ### Defining the labels in Docker Swarm @@ -153,7 +153,7 @@ docker run \ ```bash docker run \ - -l easyhaproxy.[definition].redirect=www.byjg.com.br--http://byjg.com.br,byjg.com--http://byjg.com.br + -l easyhaproxy.[definition].redirect='{"www.byjg.com.br":"http://byjg.com.br","byjg.com":"http://byjg.com.br"}' ``` ## EASYHAPROXY_DISCOVER: static @@ -230,10 +230,29 @@ docker run \ Caveats: - Your container **must** listen to the port 80. Besides no error, the certificate won't be issued if in a different port. -- The port 2080 is reserved for the certbot +- The port 2080 is reserved for the certbot and should not be exposed. - You cannot set the port 443 for the container with the Letsencrypt. EasyHAProxy will handle this automatically once the certificate is issued. - If you don't run the EasyHAProxy with the parameter `EASYHAPROXY_LETSENCRYPT_EMAIL` no certificate will be issued. +- Be aware about the issue limits - https://letsencrypt.org/docs/rate-limits/ +## Exposing Ports + +- You need to expose at least the ports `80` and `443` when you run the `byjg/easy-haproxy` image. +- If you enable the HAProxy statistics you must also expose the port defined in `HAPROXY_STATS_PORT` environment variable. +- Every port defined in `easyhaproxy.[definitions].port` also should be enabel. + +e.g. + +```bash +docker run \ + /* other parameters */ + -p 80:80 \ + -p 443:443 \ + -p 1936:1936 \ + -d byjg/easy-haproxy +``` + +Also, you need to expose these ports in the firewall. ## Mapping custom .cfg files diff --git a/assets/scripts/swarm.py b/assets/scripts/swarm.py index b746146..52fd829 100644 --- a/assets/scripts/swarm.py +++ b/assets/scripts/swarm.py @@ -2,7 +2,7 @@ import os from easymapping import HaproxyConfigGenerator with open("/tmp/.docker_data", 'r') as content_file: - lineList = content_file.readlines() + line_list = content_file.readlines() result = { "customerrors": True if os.getenv("HAPROXY_CUSTOMERRORS") == "true" else False @@ -18,7 +18,7 @@ if os.getenv("HAPROXY_PASSWORD"): result["lookup_label"] = os.getenv("EASYHAPROXY_LABEL_PREFIX") if os.getenv("EASYHAPROXY_LABEL_PREFIX") else "easyhaproxy" cfg = HaproxyConfigGenerator(result) -print(cfg.generate(lineList)) +print(cfg.generate(line_list)) path = os.path.dirname(os.path.realpath(__file__)) with open(path + "/letsencrypt_hosts.txt", 'w') as fp: diff --git a/easymapping/__init__.py b/easymapping/__init__.py index f3bca0a..2c5777c 100644 --- a/easymapping/__init__.py +++ b/easymapping/__init__.py @@ -30,6 +30,10 @@ class DockerLabelHandler: return self.__data[label].lower() in ["True", "true", "1", "yes"] return default_value + def get_json(self, label, default_value = {}): + if self.has_label(label): + return json.loads(self.__data[label]) + return default_value def set_data(self, data): self.__data = data @@ -110,7 +114,6 @@ class HaproxyConfigGenerator: self.label.create([definition, "letsencrypt"]), False ) and self.letsencrypt_email != "" - self.letsencrypt_hosts.append(d[host_label]) if letsencrypt and d[host_label] not in self.letsencrypt_hosts else self.letsencrypt_hosts if port not in easymapping: easymapping[port] = { @@ -132,45 +135,42 @@ class HaproxyConfigGenerator: "" ) - easymapping[port]["hosts"].setdefault(d[host_label], {}) - easymapping[port]["hosts"][d[host_label]].setdefault("containers", []) - easymapping[port]["hosts"][d[host_label]].setdefault("letsencrypt", False) - easymapping[port]["hosts"][d[host_label]]["containers"] += ["{}:{}".format(container, ct_port)] - easymapping[port]["hosts"][d[host_label]]["letsencrypt"] = letsencrypt - - if letsencrypt: - if "443" not in easymapping: - easymapping["443"] = { - "mode": "http", - "health-check": "ssl", - "port": "443", - "hosts": dict(), - "redirect": dict(), - } - easymapping["443"]["hosts"][d[host_label]] = dict(easymapping[port]["hosts"][d[host_label]]) - easymapping["443"]["hosts"][d[host_label]]["letsencrypt"] = False - easymapping["443"]["ssl_cert"] = "/etc/haproxy/certs" - - - # handle SSL - ssl_label = self.label.create([definition, "sslcert"]) - if self.label.has_label(ssl_label): - filename = "{}/{}.pem".format( - self.ssl_cert_folder, d[host_label] + for hostname in d[host_label].split(","): + hostname = hostname.strip() + easymapping[port]["hosts"].setdefault(hostname, {}) + easymapping[port]["hosts"][hostname].setdefault("containers", []) + easymapping[port]["hosts"][hostname].setdefault("letsencrypt", False) + easymapping[port]["hosts"][hostname]["containers"] += ["{}:{}".format(container, ct_port)] + easymapping[port]["hosts"][hostname]["letsencrypt"] = letsencrypt + easymapping[port]["redirect"] = self.label.get_json( + self.label.create([definition, "redirect"]) ) - easymapping[port]["ssl_cert"] = filename - with open(filename, 'wb') as file: - file.write( - base64.b64decode(d[ssl_label]) - ) - # handle redirects - redirect = self.label.get( - self.label.create([definition, "redirect"]) - ) - if len(redirect) > 0: - for r in redirect.split(","): - r_parts = r.split("--") - easymapping[port]["redirect"][r_parts[0]] = r_parts[1] + if letsencrypt: + if "443" not in easymapping: + easymapping["443"] = { + "mode": "http", + "health-check": "ssl", + "port": "443", + "hosts": dict(), + "redirect": dict(), + } + easymapping["443"]["hosts"][hostname] = dict(easymapping[port]["hosts"][hostname]) + easymapping["443"]["hosts"][hostname]["letsencrypt"] = False + easymapping["443"]["ssl_cert"] = "/etc/haproxy/certs" + self.letsencrypt_hosts.append(hostname) if hostname not in self.letsencrypt_hosts else self.letsencrypt_hosts + + + # handle SSL + ssl_label = self.label.create([definition, "sslcert"]) + if self.label.has_label(ssl_label): + filename = "{}/{}.pem".format( + self.ssl_cert_folder, d[host_label] + ) + easymapping[port]["ssl_cert"] = filename + with open(filename, 'wb') as file: + file.write( + base64.b64decode(d[ssl_label]) + ) return easymapping.values() diff --git a/examples/docker/docker-compose-multi-containers.yml b/examples/docker/docker-compose-multi-containers.yml index b2d7467..98e44cf 100644 --- a/examples/docker/docker-compose-multi-containers.yml +++ b/examples/docker/docker-compose-multi-containers.yml @@ -30,7 +30,7 @@ services: deploy: replicas: 2 labels: - easyhaproxy.http.redirect: google.helloworld.com--www.google.com + easyhaproxy.http.redirect: '{"google.helloworld.com": "www.google.com"}' easyhaproxy.http.host: www.helloworld.com easyhaproxy.http.port: 19901 easyhaproxy.http.localport: 80 diff --git a/tests/expected/services-multiple-hosts.txt b/tests/expected/services-multiple-hosts.txt new file mode 100644 index 0000000..4459421 --- /dev/null +++ b/tests/expected/services-multiple-hosts.txt @@ -0,0 +1,80 @@ +global + log stdout format raw local0 info + maxconn 2000 + tune.ssl.default-dh-param 2048 + + # intermediate configuration + ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 + ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256 + ssl-default-bind-options prefer-client-ciphers no-sslv3 no-tlsv10 no-tlsv11 no-tls-tickets + + ssl-default-server-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 + ssl-default-server-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256 + ssl-default-server-options no-sslv3 no-tlsv10 no-tlsv11 no-tls-tickets + + ssl-dh-param-file /etc/haproxy/dhparam + +defaults + log global + + timeout connect 3s + timeout client 10s + timeout server 10m + errorfile 400 /etc/haproxy/errors-custom/400.http + errorfile 403 /etc/haproxy/errors-custom/403.http + errorfile 408 /etc/haproxy/errors-custom/408.http + errorfile 500 /etc/haproxy/errors-custom/500.http + errorfile 502 /etc/haproxy/errors-custom/502.http + errorfile 503 /etc/haproxy/errors-custom/503.http + errorfile 504 /etc/haproxy/errors-custom/504.http + +frontend stats + bind *:1937 + mode http + stats enable + stats hide-version + stats realm Haproxy\ Statistics + stats uri / + stats auth joe:s3cr3t +# acl is_proxystats hdr(host) -i some.host.com +# default_backend srv_stats +# use_backend srv_stats if is_proxystats + default_backend srv_stats + +backend srv_stats + mode http + server Local 127.0.0.1:1937 + +frontend http_in_19901 + bind *:19901 + mode http + redirect prefix www.google.com code 301 if { hdr(host) -i google.helloworld.com } + + acl is_rule_hello_com_19901_1 hdr(host) -i hello.com + acl is_rule_hello_com_19901_2 hdr(host) -i hello.com:19901 + use_backend srv_hello_com_19901 if is_rule_hello_com_19901_1 OR is_rule_hello_com_19901_2 + + acl is_rule_www_helloworld_com_19901_1 hdr(host) -i www.helloworld.com + acl is_rule_www_helloworld_com_19901_2 hdr(host) -i www.helloworld.com:19901 + use_backend srv_www_helloworld_com_19901 if is_rule_www_helloworld_com_19901_1 OR is_rule_www_helloworld_com_19901_2 + +backend srv_hello_com_19901 + balance roundrobin + mode http + option forwardfor + http-request set-header X-Forwarded-Port %[dst_port] + http-request add-header X-Forwarded-Proto https if { ssl_fc } + server srv-0 3e63154954b0:80 check weight 1 + server srv-1 eb294c110eb1:80 check weight 1 +backend srv_www_helloworld_com_19901 + balance roundrobin + mode http + option forwardfor + http-request set-header X-Forwarded-Port %[dst_port] + http-request add-header X-Forwarded-Proto https if { ssl_fc } + server srv-0 3e63154954b0:80 check weight 1 + server srv-1 eb294c110eb1:80 check weight 1 + +backend letsencrypt_backend + mode http + server certbot 127.0.0.1:2080 \ No newline at end of file diff --git a/tests/fixtures/services b/tests/fixtures/services index c120d53..c77af21 100644 --- a/tests/fixtures/services +++ b/tests/fixtures/services @@ -3,4 +3,4 @@ my-stack_agent={"easyhaproxy.agent.host":"agent.quantum.example.org","easyhaprox my-stack_cadvisor={"easyhaproxy.cadvisor.host":"cadvisor.quantum.example.org","easyhaproxy.cadvisor.localport":"8080","easyhaproxy.cadvisor.port":"31337","com.docker.stack.image":"gcr.io/google-containers/cadvisor:v0.34.0","com.docker.stack.namespace":"my-stack","com.planetary-quantum":"monitoring"} my-stack_node-exporter={"easyhaproxy.exp.host":"node-exporter.quantum.example.org","easyhaproxy.exp.localport":"9100","easyhaproxy.exp.port":"31337","com.docker.stack.image":"stefanprodan/swarmprom-node-exporter:v0.16.0","com.docker.stack.namespace":"my-stack","com.planetary-quantum":"monitoring","easyhaproxy.exp.letsencrypt":"true"} my-stack_reverse-proxy={"com.docker.stack.image":"quay.io/pngmbh/easy-haproxy:tcp-mode","com.docker.stack.namespace":"my-stack","com.planetary-quantum":"monitoring"} -some-service={"easyhaproxy.http.port":"80","easyhaproxy.http.host":"www.somehost.com.br","easyhaproxy.http.localport":"80","easyhaproxy.http.redirect":"somehost.com.br--https://www.somehost.com.br,somehost.com--https://www.somehost.com.br,www.somehost.com--https://www.somehost.com.br,byjg.ca--https://www.somehost.com.br,www.byjg.ca--https://www.somehost.com.br","easyhaproxy.https.port":"443","easyhaproxy.https.host":"www.somehost.com.br","easyhaproxy.https.localport":"80","easyhaproxy.https.redirect":"somehost.com.br--https://www.somehost.com.br,somehost.com--https://www.somehost.com.br,www.somehost.com--https://www.somehost.com.br,byjg.ca--https://www.somehost.com.br,www.byjg.ca--https://www.somehost.com.br","easyhaproxy.https.sslcert":"U29tZSBQRU0gQ2VydGlmaWNhdGU="} \ No newline at end of file +some-service={"easyhaproxy.http.port":"80","easyhaproxy.http.host":"www.somehost.com.br","easyhaproxy.http.localport":"80","easyhaproxy.http.redirect":"{\"somehost.com.br\":\"https://www.somehost.com.br\",\"somehost.com\":\"https://www.somehost.com.br\",\"www.somehost.com\":\"https://www.somehost.com.br\",\"byjg.ca\":\"https://www.somehost.com.br\",\"www.byjg.ca\":\"https://www.somehost.com.br\"}","easyhaproxy.https.port":"443","easyhaproxy.https.host":"www.somehost.com.br","easyhaproxy.https.localport":"80","easyhaproxy.https.redirect":"{\"somehost.com.br\":\"https://www.somehost.com.br\",\"somehost.com\":\"https://www.somehost.com.br\",\"www.somehost.com\":\"https://www.somehost.com.br\",\"byjg.ca\":\"https://www.somehost.com.br\",\"www.byjg.ca\":\"https://www.somehost.com.br\"}","easyhaproxy.https.sslcert":"U29tZSBQRU0gQ2VydGlmaWNhdGU="} \ No newline at end of file diff --git a/tests/fixtures/services-changed-label b/tests/fixtures/services-changed-label index bb20aec..f4b0b14 100644 --- a/tests/fixtures/services-changed-label +++ b/tests/fixtures/services-changed-label @@ -3,4 +3,4 @@ my-stack_agent={"haproxy.agent.host":"agent.quantum.example.org","haproxy.agent. my-stack_cadvisor={"haproxy.cadvisor.host":"cadvisor.quantum.example.org","haproxy.cadvisor.localport":"8080","haproxy.cadvisor.port":"31337","com.docker.stack.image":"gcr.io/google-containers/cadvisor:v0.34.0","com.docker.stack.namespace":"my-stack","com.planetary-quantum":"monitoring"} my-stack_node-exporter={"haproxy.exp.host":"node-exporter.quantum.example.org","haproxy.exp.localport":"9100","haproxy.exp.port":"31337","com.docker.stack.image":"stefanprodan/swarmprom-node-exporter:v0.16.0","com.docker.stack.namespace":"my-stack","com.planetary-quantum":"monitoring","haproxy.exp.letsencrypt":"yes"} my-stack_reverse-proxy={"com.docker.stack.image":"quay.io/pngmbh/easy-haproxy:tcp-mode","com.docker.stack.namespace":"my-stack","com.planetary-quantum":"monitoring"} -some-service={"haproxy.http.port":"80","haproxy.http.host":"www.somehost.com.br","haproxy.http.localport":"80","haproxy.http.redirect":"somehost.com.br--https://www.somehost.com.br,somehost.com--https://www.somehost.com.br,www.somehost.com--https://www.somehost.com.br,byjg.ca--https://www.somehost.com.br,www.byjg.ca--https://www.somehost.com.br","haproxy.https.port":"443","haproxy.https.host":"www.somehost.com.br","haproxy.https.localport":"80","haproxy.https.redirect":"somehost.com.br--https://www.somehost.com.br,somehost.com--https://www.somehost.com.br,www.somehost.com--https://www.somehost.com.br,byjg.ca--https://www.somehost.com.br,www.byjg.ca--https://www.somehost.com.br","haproxy.https.sslcert":"U29tZSBQRU0gQ2VydGlmaWNhdGU="} \ No newline at end of file +some-service={"haproxy.http.port":"80","haproxy.http.host":"www.somehost.com.br","haproxy.http.localport":"80","haproxy.http.redirect":"{\"somehost.com.br\":\"https://www.somehost.com.br\",\"somehost.com\":\"https://www.somehost.com.br\",\"www.somehost.com\":\"https://www.somehost.com.br\",\"byjg.ca\":\"https://www.somehost.com.br\",\"www.byjg.ca\":\"https://www.somehost.com.br\"}","haproxy.https.port":"443","haproxy.https.host":"www.somehost.com.br","haproxy.https.localport":"80","haproxy.https.redirect":"{\"somehost.com.br\":\"https://www.somehost.com.br\",\"somehost.com\":\"https://www.somehost.com.br\",\"www.somehost.com\":\"https://www.somehost.com.br\",\"byjg.ca\":\"https://www.somehost.com.br\",\"www.byjg.ca\":\"https://www.somehost.com.br\"}","haproxy.https.sslcert":"U29tZSBQRU0gQ2VydGlmaWNhdGU="} \ No newline at end of file diff --git a/tests/fixtures/services-multiple-hosts b/tests/fixtures/services-multiple-hosts new file mode 100644 index 0000000..44bfc19 --- /dev/null +++ b/tests/fixtures/services-multiple-hosts @@ -0,0 +1,3 @@ +db79d3a910f4={"com.docker.compose.config-hash":"5bde40f52451521ad201e70de1291397376a0498a7c955624a609da3b60e7e8e","com.docker.compose.container-number":"1","com.docker.compose.depends_on":"","com.docker.compose.image":"sha256:ea39067705590557dd0cd951664a10970ceefcb725a3c1f43690d6d6d4ed5fce","com.docker.compose.oneoff":"False","com.docker.compose.project":"docker","com.docker.compose.project.config_files":"/workspace/docker-easy-haproxy/examples/docker/docker-compose-multi-containers.yml","com.docker.compose.project.working_dir":"/workspace/docker-easy-haproxy/examples/docker","com.docker.compose.service":"haproxy","com.docker.compose.version":"2.8.0"} +3e63154954b0={"com.docker.compose.config-hash":"4e0cbdd8372c6779863799e5021ed8178f74b55bd8e070abcdffaf87eb7baa36","com.docker.compose.container-number":"1","com.docker.compose.depends_on":"","com.docker.compose.image":"sha256:bea3509d6fdc8d7f9ec95563a5a226dc977ee74fb3e980e0de70e892c2d38dde","com.docker.compose.oneoff":"False","com.docker.compose.project":"docker","com.docker.compose.project.config_files":"/workspace/docker-easy-haproxy/examples/docker/docker-compose-multi-containers.yml","com.docker.compose.project.working_dir":"/workspace/docker-easy-haproxy/examples/docker","com.docker.compose.service":"nginx","com.docker.compose.version":"2.8.0","easyhaproxy.http.host":"hello.com, www.helloworld.com","easyhaproxy.http.localport":"80","easyhaproxy.http.port":"19901","easyhaproxy.http.redirect":"{\"google.helloworld.com\": \"www.google.com\"}"} +eb294c110eb1={"com.docker.compose.config-hash":"4e0cbdd8372c6779863799e5021ed8178f74b55bd8e070abcdffaf87eb7baa36","com.docker.compose.container-number":"2","com.docker.compose.depends_on":"","com.docker.compose.image":"sha256:bea3509d6fdc8d7f9ec95563a5a226dc977ee74fb3e980e0de70e892c2d38dde","com.docker.compose.oneoff":"False","com.docker.compose.project":"docker","com.docker.compose.project.config_files":"/workspace/docker-easy-haproxy/examples/docker/docker-compose-multi-containers.yml","com.docker.compose.project.working_dir":"/workspace/docker-easy-haproxy/examples/docker","com.docker.compose.service":"nginx","com.docker.compose.version":"2.8.0","easyhaproxy.http.host":"hello.com, www.helloworld.com","easyhaproxy.http.localport":"80","easyhaproxy.http.port":"19901","easyhaproxy.http.redirect":"{\"google.helloworld.com\": \"www.google.com\"}"} \ No newline at end of file diff --git a/tests/test_parser.py b/tests/test_parser.py index ccb9b05..efbb359 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -295,5 +295,28 @@ def test_parser_multi_containers(): assert [] == cfg.letsencrypt_hosts +def test_parser_multiple_hosts(): + line_list = load_fixture("services-multiple-hosts") + + result = { + "customerrors": True, + "stats": { + "username": "joe", + "password": "s3cr3t", + "port": "1937" + } + } + + cfg = easymapping.HaproxyConfigGenerator(result, CERTS_FOLDER) + haproxy_config = cfg.generate(line_list) + + assert len(haproxy_config) > 0 + path = os.path.dirname(os.path.realpath(__file__)) + with open(path + "/expected/services-multiple-hosts.txt", 'r') as expected_file: + assert expected_file.read() == haproxy_config + assert [] == cfg.letsencrypt_hosts + + #test_parser_finds_services_raw() #test_parser_tcp() +#test_parser_multiple_hosts()