Consul-template: [doc] Recommend approach for multiple environments

Created on 28 Aug 2015  路  6Comments  路  Source: hashicorp/consul-template

I'm in the process of migrating to Consul and I was wondering what was the correct approach for this scenario:

  • a single consul cluster
  • multiple environments (prod, dev etc)

The possible ways:

  • should services rely heavily on tags to differentiate them ? prod.myservice.service.consul (which would lead to filtering with byTag )
  • use the datacenter concept so you can specifically query in consul-template ? `{{services "@prod"}}
  • rely on the node name and split on it, assuming a node name myservice-prod-i4252

I know DCs are not replicated out of the box but I'm assuming it should not matter in that case.

Any insight would be welcomed, thanks in advance.

Most helpful comment

All 6 comments

Hey @scalp42

Thank you for opening an issue. I think this is a really great question, but I think the mailing list is a much better place to facilitate this discussion and get the community involved since it's not an entirely Consul Template-specific question :smile:. Would you mind posting on the mailing list please? I can provide my personal recommendation there, but I think it would also help if you heard the strategies that other organizations are using with the multi-environment approach.

The Consul mailing list is a Google group at https://groups.google.com/forum/#!forum/consul-tool. Again, I am sorry to push you there, but I think that's a much better place to have this discussion :smile:.

Fair enough, I will @sethvargo :smiley:

Hi @scalp42 . I have the same use case. Would you mind to tell me what's your solution ?

I also have multiple environments (prod, dev etc), with a single consul cluster, how to distinguish different environments ? (Such as different environments have different database host, port, password, and so on.)

@abcfy2 We ended up using tags to differentiate multiple environments, was the least painful solution for us 馃槃

Thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ShimiTaNaka picture ShimiTaNaka  路  4Comments

bitsofinfo picture bitsofinfo  路  5Comments

santhoshp87 picture santhoshp87  路  4Comments

digitalronin picture digitalronin  路  3Comments

waterdudu picture waterdudu  路  5Comments