Skip to content

Commit

Permalink
Changes in the Static object
Browse files Browse the repository at this point in the history
  • Loading branch information
byjg committed Sep 2, 2022
1 parent 3a3d520 commit 8592242
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/static.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@ easymapping:
- domain:8181
```
Then map this file to `/etc/haproxy/easyconfig.yml` in your EasyHAProxy container as:
Then map this file to `/etc/haproxy/static/config.yml` in your EasyHAProxy container as:

```bash
docker run -d \
--name easy-haproxy-container \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /my/config.yml:/etc/haproxy/easyconfig.yml
-v /my/static/:/etc/haproxy/static/ \
-e EASYHAPROXY_DISCOVER="static" \
# + Environment Variables \
-p 80:80 \
-p 443:443 \
-p 1936:1936 \
--network easyhaproxy
--network easyhaproxy \
byjg/easy-haproxy
```

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/static/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
haproxy:
image: byjg/easy-haproxy
volumes:
- ./config.yml:/etc/haproxy/easyconfig.yml
- ./conf/:/etc/haproxy/static/
- ./host1.local.pem:/certs/haproxy/host1.local.pem
- /var/run/docker.sock:/var/run/docker.sock
environment:
Expand Down
2 changes: 1 addition & 1 deletion src/functions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def run_bash(source, command, log_output=True, return_result=True):


class Consts:
easyhaproxy_config = "/etc/haproxy/easyconfig.yml"
easyhaproxy_config = "/etc/haproxy/static/config.yml"
haproxy_config = "/etc/haproxy/haproxy.cfg"
certs_letsencrypt = "/certs/letsencrypt"
certs_haproxy = "/certs/haproxy"
Expand Down
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def start():
processor_obj.save_config(Consts.haproxy_config)
processor_obj.save_certs(Consts.certs_haproxy)
letsencrypt_certs_found = processor_obj.get_letsencrypt_hosts()
Functions.log(Functions.EASYHAPROXY_LOG, Functions.DEBUG, 'Found hosts: %s' % ", ".join(processor_obj.get_hosts())) # Needs to after save_config
Functions.log(Functions.EASYHAPROXY_LOG, Functions.DEBUG, 'Found hosts: %s' % ", ".join(processor_obj.get_hosts())) # Needs to run after save_config
Functions.log(Functions.EASYHAPROXY_LOG, Functions.TRACE, 'Object Found: %s' % (processor_obj.get_parsed_object()))

old_haproxy = None
Expand Down
4 changes: 3 additions & 1 deletion src/processor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def read():


class ProcessorInterface:
static_file = "/etc/haproxy/easyconfig.yml"
static_file = Consts.easyhaproxy_config

def __init__(self, filename = None):
self.filename = filename
Expand Down Expand Up @@ -109,6 +109,8 @@ def get_parsed_object(self):
def get_hosts(self):
hosts = []
for object in self.get_parsed_object():
if "hosts" not in object:
continue
for host in object["hosts"].keys():
hosts.append("%s:%s" % (host, object["port"]))
return hosts
Expand Down

0 comments on commit 8592242

Please sign in to comment.