2
votes

Suppose I've got services A and B. Both of them are deployed to test server and connected to Consul.

When I start service A on my local machine it will read data from consul and interact with service B deployed on test server. How can I make service A to interact with service B on the local machine if it's also running?

I thought to run local Consul instance and proxy missing requests (configuration and service discovery) to test server consul but I didn't find any info about it.

How can / should I configure my local environment with Consul?

2

2 Answers

0
votes

Steps for configuring consul on local environment :

  1. install consul on local https://www.consul.io/downloads.html
  2. consul agent -dev - command used to run consul on local
  3. You can use git2consul tool for reading the config from the local git repository, like
git2consul --config <path to git2consul file>

https://github.com/breser/git2consul

0
votes

If you want to avoid the usage of service B running in the test environment you should make your local service B to register whit a different name into the consul server like C and also change you local service A to consume it.

This way you would have registered into consul two instances of service A, one instance of service B and one instance of service C and.