Skip to content

Commit

Permalink
Update templates interation example doc
Browse files Browse the repository at this point in the history
  • Loading branch information
kelseyhightower committed Feb 17, 2014
1 parent 3cc4d08 commit 32c8f39
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions docs/templates-interation-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ curl http://127.0.0.1:4001/v2/keys/myapp/upstream/app1 -XPUT -d value="10.0.1.10
keys = [
"myapp/upstream",
]
owner = "kelseyhightower"
owner = "nginx"
mode = "0644"
src = "nginx.tmpl"
dest = "/tmp/nginx.conf"
src = "myapp-nginx.tmpl"
dest = "/etc/nginx/conf.d/myapp.conf"
check_cmd = "/usr/sbin/nginx -t -c {{ .src }}"
reload_cmd = "/usr/sbin/service nginx reload"
```

## Create a source template
Expand All @@ -48,3 +50,35 @@ server {
}
}
```

## Run confd

```
confd -onetime
2014-02-16T21:36:46-08:00 confd[2180]: INFO Target config /tmp/nginx.conf out of sync
2014-02-16T21:36:46-08:00 confd[2180]: INFO Target config /tmp/nginx.conf has been updated
```

Output

```
upstream myapp {
server 10.0.1.100:80;
server 10.0.1.101:80;
}
server {
server_name www.example.com;
location / {
proxy_pass http://myapp;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```

0 comments on commit 32c8f39

Please sign in to comment.