Questions tagged [consul-template]

Consul template renders Go templates based on data queried from HashiCorp Consul.

Consul template is a simple, yet powerful tool. When initiated, it reads one or more template files and queries Consul for all data needed to render them. Typically, you run consul-template as a daemon which will fetch the initial values and then continue to watch for updates, re-rendering the template whenever there are relevant changes in the cluster.

The tag should be used for tool specific questions like daemon setup or usage of provided template functions. More general Go template questions should be tagged with instead.

75 questions
0
votes
2 answers

Writing to Vault secret with consul-template

Im struggling to understand from the doc on how to write to Vault KV using consul-template. I enabled KV with vault secrets enable -path=secret -version=2 kv I have the following template, vault { ssl { ca_cert = "tls/ca.pem" } retry { …
nixgadget
  • 6,983
  • 16
  • 70
  • 103
0
votes
1 answer

Is it possible to render fully-qualified domain name (instead of IP address) of node using Consul Template?

I am trying to template config for an application using Consul Template. I would like the address of a node, discoverable using Consul, to be of the form metrics-server (or metrics-server.example.com which I could then parse). The below code is…
Blair Nangle
  • 1,221
  • 12
  • 18
0
votes
1 answer

Consul-Template Unexpected response code: 504

I am using Consul-Template to render a properties with the data gathered from Consul. The files are being rendered successfully but afterwards Consul-Template fails over and over again until it crashes: 2017/08/16 10:43:04.900637 [WARN] (view)…
apines
  • 1,254
  • 14
  • 36
0
votes
1 answer

Execute nginx exe in folder with -s reload args Consul template Windows

I am using Consul Template V0.19.0 for windows, for rendering nginx loadbalancing config.It is working as expected. Now I want the consul template, to execute the nginx exe in a folder with args (-s reload) as below:- Case 1: template { source =…
NANDAKUMAR THANGAVELU
  • 611
  • 3
  • 15
  • 34
0
votes
1 answer

Consul template is not restarting nginx windows

I am using consul template v0.19.0 for windows, for rendering nginx config. The nginx config Is rendering fine by the consul template but It is not restarting the nginx. This is the command I am using. Consul- template -consul-address="xx" -…
NANDAKUMAR THANGAVELU
  • 611
  • 3
  • 15
  • 34
0
votes
1 answer

Fetch a value from KV store, but its not a Key:Value pair in the template

All, Is it possible to convert my server.cert.template file in to server.cert using consul template and consul KV. In my Consul am defining a KV pair as follows: SERVER_SSL_CERT = 4r4ffqh;fhq2fhwhhqwpihpvhqv'in3v3rvnrqpnrvnnvvqn And my…
rashcuva
  • 65
  • 2
  • 10
0
votes
1 answer

Unable to load balance using Docker, Consul and nginx

What I want to achive is load balancing using this stack: Docker, Docker Compose, Registrator, Consul, Consul Template, NGINX and, finally, a tiny service that prints out "Hello world" in browser. So, at this moment I have a docker-compose.yml file.…
Jacobian
  • 10,122
  • 29
  • 128
  • 221
0
votes
2 answers

Make ExecStartPost command to run in background

I have a systemd service for my spring boot application connected to consul server, behind haproxy. consul provides consul-template to automatically update the service location in haproxy configuration file via consul-template…
divinedragon
  • 5,105
  • 13
  • 50
  • 97
0
votes
1 answer

HTTP API Call to create consul watch & consul exec

Currently I am using consul watch & consul exec commands to create watches as well as to run some bash commands. I would like to use http api calls instead of commands to automate my system. Is there http equivalents to do this work ? Any help…
inari6
  • 401
  • 1
  • 9
  • 19
0
votes
1 answer

Concept of remote controling several consul stacks securely

Introduction I am running multiple, i call them consul-stacks. They do always look like: - 1 consul server - 9 consul nodes Each node offers some services - just a classic web-stack and more (not interesting for this question). Gossip is used to…
Eugen Mayer
  • 8,942
  • 4
  • 33
  • 57
0
votes
1 answer

how to deploy applications on docker swarm and expose that ip address to A record

I have successfully setup the docker swarm cluster with nginx. on my ec2 instances. using this tutorial https://botleg.com/stories/load-balancing-with-docker-swarm/ I am using like this Manager 1 node 1 node 2 I am using consol with registrator for…
vimal prakash
  • 1,503
  • 1
  • 22
  • 38
0
votes
1 answer

Consul for Docker container discovery: how to get latest container in Consul-Template?

I'm building out a Docker host where I'd like to do a no-downtime upgrade of a running container. For now, assume I'm only running one container. I build a new image and launch a container from it with docker run -P ..., so that it is assigned…
Maxim Zaslavsky
  • 17,787
  • 30
  • 107
  • 173
-1
votes
1 answer

Using shell script to parse lines from a consul template file

As you can see the in the template file below , I have few variables declared (like MYSQL_ACCOUNT_PASSWORD , MYSQL_ACCOUNT_USERNAME etc) between "if" and "end" and I am looking forward to write a shell script to get all the variables in such file.…
santhu
  • 57
  • 2
  • 9
-1
votes
1 answer

build a dynamic string from vault KV values

I'm trying to create something similar to this: {{with secret "secret/data"}} {{range $k, $v := .Data}} {{if eq $k "db-primary"}} {{with $secret := secret "mysql-$v/creds/primary"}} …
Eli
  • 4,329
  • 6
  • 53
  • 78
-2
votes
2 answers

How to get key from map

I'm working on go template. Having some map in . I know how to get the value, as long as I know the key. "Map value: {{ printf "%s" .key1 }}" How to get key name from inside the template? I would expect maybe something like "Map key: {{ printf "%s"…
BartBiczBoży
  • 2,512
  • 2
  • 24
  • 33
1 2 3 4
5