...
1# Consul in Boulder
2We use Consul in development mode (flag: `-dev`), which configures Consul as an
3in-memory server and client with persistence disabled for ease of use.
4
5## Configuring the Service Registry
6
7- Open `./test/consul/config.hcl`
8- Add a `services` stanza for each IP address and (optional) port combination
9 you wish to have returned as an DNS record.
10 ([docs](https://www.consul.io/docs/discovery/services)).
11
12 ```hcl
13 services {
14 id = "foo-purger-a"
15 name = "foo-purger"
16 address = "10.77.77.77"
17 port = 1338
18 }
19
20 services {
21 id = "foo-purger-b"
22 name = "foo-purger"
23 address = "10.88.88.88"
24 port = 1338
25 }
26 ```
27- For RFC 2782 (SRV RR) lookups to work ensure you that you add a tag for the
28 supported protocol (usually `"tcp"` and or `"udp"`) to the `tags` field.
29 Consul implemented the the `Proto` field as a tag filter for SRV RR lookups.
30 For more information see the
31 [docs](https://www.consul.io/docs/discovery/dns#rfc-2782-lookup).
32
33 ```hcl
34 services {
35 id = "foo-purger-a"
36 name = "foo-purger"
37 address = "10.77.77.77"
38 port = 1338
39 tags = ["udp", "tcp"]
40 }
41 ...
42 ```
43- Services are **not** live-reloaded. You will need to cycle the container for
44 every Service Registry change.
45
46## Accessing the web UI
47
48### Linux
49
50Consul should be accessible at http://10.55.55.10:8500.
51
52### Mac
53
54Docker desktop on macOS doesn't expose the bridge network adapter so you'll need
55to add the following port lines (temporarily) to `docker-compose.yml`:
56
57```yaml
58 bconsul:
59 ports:
60 - 8500:8500 # forwards 127.0.0.1:8500 -> 10.55.55.10:8500
61```
62
63For testing DNS resolution locally using `dig` you'll need to add the following:
64```yaml
65 bconsul:
66 ports:
67 - 53:53/udp # forwards 127.0.0.1:53 -> 10.55.55.10:53
68```
69
70The next time you bring the container up you should be able to access the web UI
71at http://127.0.0.1:8500.
View as plain text