-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Problem with Canary deployment #8137
Comments
Hello! Thanks for the question! How does your front-end currently 'find' the backend? Is it a DNS query to Consul? Are you querying Consul based on tags? You could potentially modify your frontend to query Consul based on 'v1' or 'v2' tags for the backend service. For example, Additionally, if you are using Consul Connect (service mesh), you could do this with Connect's Layer 7 Management capabilities. Take a look at this Consul Connect demo environment that shows a read-only UI with example Service Routers, Splitters and Resolvers built out in various environments. |
On the Nomad side, you can pass env vars that specify the version of the backend you should target using the env stanza
You can get a little bit fancier by populating these dynamically using data retrieved from Consul with dynamic environment variables which utilize Consul Template. |
Thanks for the quick reply, I'll have a look tomorrow. |
I had been using a simple solution until now.
|
The problem with env vars is that i can't change the value only for the canary frontend. |
You may find this NGINX integration example using the Nomad template stanza from the HashiCorp Learn site helpful: The example job file from the Learn site explicitly writes out the NGINX load balancer config based on IP addresses and Ports for the demo-webapp service retrieved from Consul:
To expand beyond that learn guide, here is some example syntax you can modify in order to have the template stanza pull IP address and port info for different versions of the backend service, as specified by tags in Consul:
It is also possible to specify the tag you want more explicitly, using this syntax from Consul-template:
Example:
For completeness, I also want to mention that you also don't have to write directly to the NGINX config. You may want to instead use the Nomad template stanza to populate environment variables then consume them however you wish (as opposed to writing directly to the NGINX config):
|
Thanks, I used consuldns tags to get it working ! |
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. |
Hi,
I'm working on the production deployment of my app and blue green deployment seems to be perfect to expect a 0 downtime.
The thing is that my app is a group of two tasks :
I've added canary_tags to my tasks to add a new traefik route and I can access the two different frontend versions in parallel.
The problem is the connection to the backend. My new frontend make calls to the old backend and vice versa.
How can i isolate the couples frontend/backend ? Or can I specify some canary env vars (to configure the backend url)?
If I only add a task for the app, everything would have been fine.
FYI: Nomad 0.10.5, Consul 1.7.2 and Traefik 2.2
The text was updated successfully, but these errors were encountered: