Skip to content

Commit

Permalink
use dnsname over ip for local backend ci's
Browse files Browse the repository at this point in the history
  • Loading branch information
joshhighet committed Dec 4, 2023
1 parent d4e2959 commit c02c989
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,14 @@ def is_circuit_built():
if circ.status == 'BUILT':
return True
return False
```

to hot reload the haproxy configuration without having to re-establish tor circuits with a full rebuild or restart, you can run the below (replacing `multisocks-haproxy-1` if appropriate)

```shell
docker exec \
multisocks-haproxy-1 haproxy \
-f /usr/local/etc/haproxy/haproxy.cfg \
-p /var/run/haproxy.pid \
-sf $(cat /var/run/haproxy.pid)
```
9 changes: 4 additions & 5 deletions haconfig/gen_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ def get_dockernet_hostnames():
network = client.networks.get("net_tor")
net_tor_id = network.attrs["Id"]
containers = client.containers.list()
containers = [
container for container in containers
container_names = [
container.attrs['Name'][1:]
for container in containers
if ("net_tor" in container.attrs["NetworkSettings"]["Networks"])
and (container.attrs["NetworkSettings"]["Networks"]["net_tor"]["NetworkID"] == net_tor_id)
and (container.attrs["Config"]["User"] == "tor")
]
dns = [container.attrs['NetworkSettings']['Networks']["net_tor"]['Aliases'][0]
for container in containers]
return dns
return container_names

if __name__ == "__main__":
cihosts = get_dockernet_hostnames()
Expand Down

0 comments on commit c02c989

Please sign in to comment.