confd
confd copied to clipboard
warning: master confd[346010]: WARNING Found no templates
I try to use confd to help me dynamically reload nginx.conf, but when I try to start confd, I encounter this warning: "Found no templates"
Here are my config files:
the template-resource file:
/etc/confd/conf.d/nginx.toml
, the content is:
[template]
src = "/etc/confd/templates/nginx.tmpl"
dest = "/etc/nginx/conf.d/nginx.conf"
keys = ["/service"]
the template file:
etc/confd/templates/nginx.tmpl
, the content is:
server {
listen 80;
location / {
set $service_name "{{getv "/service_name"}}";
set $service_path "{{getv "/service_path"}}";
set $servie_port "{{getv "/service_port"}}";
proxy_pass http://$service_name:$servie_port$service_path;
}
}
the nginx config file:
/etc/nginx/conf.d/nginx.conf
, the content is:
events {
worker_connections 1024;
}
http {
server {
listen 1080;
location / {
set $service_name "default-service";
set $service_path "/default-path";
set $service_port "80";
proxy_pass http://$service_name:$service_port$service_path;
}
}
include /etc/nginx/conf.d/*.conf;
}
my os: ubuntu 20.04 my nginx version: nginx/1.18.0 my confd version: 0.16.0
start command: confd -backend etcd -node http://localhost:2380 -config-file /etc/confd/conf.d/nginx.toml