consul-join
can help figure out which IPs to use to join consul agents
to servers. It respects two ENV variables related to joining.
Simple join with one IP:
JOINIP=10.0.0.1 consul-join
# will exec: consul agent -join=10.0.0.1
Join by looking up registered A records:
JOINDNS=example.com consul-join
# assuming example.com has 2 A records of 10.0.0.1 and 10.0.0.2, then
# will exec: consul agent -join=10.0.0.1 -join=10.0.0.2
Passes all following arguments to consul
:
consul-join -config-dir=/config
# will exec: consul agent -config-dir=/config
Also supports -server
and will respect the BOOTSTRAP_EXPECT
ENV
varaible (which it defaults to 3 if missing).
JOINDNS=example.com consul-join -server
# will exec: consul agent -join=10.0.0.1 -join=10.0.0.2 -bootstrap-expect=3 -server
We are considering adding a JOINURL
and a related consul-join-server
to provide a simple alternative to DNS for keeping track of consul
server ips (similar to discovery.etcd.io).