|
1 | 1 | # go-coredns-nomad
|
2 | 2 |
|
3 |
| -coredns with nomad plugin for service discovery |
| 3 | +coredns with nomad plugin for service discovery. This repository will build a docker container |
| 4 | +with coredns and the nomad plugin. |
4 | 5 |
|
5 |
| -Currently in progress, but this is how you build the container. |
| 6 | +## Using the container |
6 | 7 |
|
7 |
| -```sh |
8 |
| -docker build \ |
9 |
| - --tag ghcr.io/djthorpe/go-coredns-nomad:v1.11.1 \ |
10 |
| - --build-arg ARCH=$(arch) \ |
11 |
| - --build-arg PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]') \ |
12 |
| - --build-arg VERSION=v1.11.1 \ |
13 |
| - -f etc/docker/Dockerfile . |
14 |
| -``` |
| 8 | +In order to run this container, and have service discovery |
| 9 | +work on port 1053, you need to pass in the following environment variables: |
15 | 10 |
|
16 |
| -In order to run this container as a non-root user, |
| 11 | + * `NOMAD_ADDR` - the address of the nomad server |
| 12 | + * `NOMAD_TOKEN` - the token to use to query the nomad server |
| 13 | + * `NOMAD_TTL` - the TTL for the DNS records, in seconds |
| 14 | + |
| 15 | +For example: |
17 | 16 |
|
18 | 17 | ```sh
|
19 |
| -docker run --name coredns --rm -p 1053:53 \ |
| 18 | +docker run --name coredns-nomad --rm -p 1053:53 \ |
20 | 19 | --env NOMAD_ADDR=http://nomad:4646/ \
|
21 | 20 | --env NOMAD_TOKEN=XXXXXX \
|
22 | 21 | --env NOMAD_TTL=10 \
|
23 |
| - ghcr.io/djthorpe/go-coredns-nomad:v1.11.1 |
| 22 | + ghcr.io/mutablelogic/coredns-nomad:v1.11.1 |
24 | 23 | ```
|
25 | 24 |
|
26 |
| -When you want to test it using dig, |
| 25 | +When you want to test it using dig, query `<service>.<namespace>.nomad`. For example, |
27 | 26 |
|
28 | 27 | ```sh
|
29 | 28 | dig +tcp -p 1053 @localhost service.default.nomad
|
30 | 29 | ```
|
31 | 30 |
|
| 31 | +## Building the container |
| 32 | + |
| 33 | +You can use the pre-built container from the GitHub Container Registry (for arm64 or amd64 on Linux), |
| 34 | +or you can build it yourself. |
| 35 | + |
| 36 | +```sh |
| 37 | +git clone [email protected]:mutablelogic/go-coredns-nomad.git |
| 38 | +cd go-coredns-nomad |
| 39 | +docker build \ |
| 40 | + --tag ${REGISTRY}/${USERNAME}/coredns-nomad:v1.11.1 \ |
| 41 | + --build-arg ARCH=$(arch) \ |
| 42 | + --build-arg PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]') \ |
| 43 | + --build-arg VERSION=v1.11.1 \ |
| 44 | + -f etc/docker/Dockerfile . |
| 45 | +``` |
0 commit comments