Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data center name in Config file #23

Closed
misterbisson opened this issue Sep 1, 2016 · 1 comment
Closed

Add data center name in Config file #23

misterbisson opened this issue Sep 1, 2016 · 1 comment

Comments

@misterbisson
Copy link
Contributor

Consul's has built-in support for operation in multiple data centers. These data centers can be named.

The data center name can be set in the consul.json with the addition of a "datacenter": "<name>" key, *or with the addition of a -datacenter command line argument.

The Triton data center name can be found using mdata-get:

/native/usr/sbin/mdata-get sdc:datacenter_name

The name can be injected in the config file at preStart using a mechanism similar to how the advertise IP is set:

if [ -f "/native/usr/sbin/mdata-get" ]; then
  DATACENTER_NAME=$(/native/usr/sbin/mdata-get sdc:datacenter_name)
fi
sed -i "s/DATACENTER_NAME/${DATACENTER_NAME:-dc1}/" /etc/consul/consul.json
@jwreagor
Copy link
Contributor

Interesting, I like the usage of metadata. I can add this into the mix after #43 is merged.

tjcelaya added a commit to tjcelaya/autopilotpattern-consul that referenced this issue Dec 7, 2017
jwreagor pushed a commit that referenced this issue Dec 15, 2017
* Resolve #23 by adding `CONSUL_DATACENTER_NAME` env

* Mention the environment variable in the `README.md`

* Triton datacenter auto detection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants