Automatic docker service announcement with registrator and confd
-
Upload
chungsub-kim -
Category
Software
-
view
502 -
download
0
Transcript of Automatic docker service announcement with registrator and confd
Jan 26, 2015
by @subicura (Chungsub Kim)
Automatic Docker Service Announcement with registrator and confd
before
after
container is awesome!!but
update some(like nginx) setting manually
Static Configuration
how to update a website running in a docker container
with no downtimeautomatically
Dynamic Configuration
confd
registrator
etcd
CoreOS
Manage local application configuration files using templates and data from etcd or consul
A highly-available key value store for shared configuration and service discovery
Service registry bridge for Docker
Minimal, modern operating system.
Clustered by default Optimized for containers
A highly-available key value store
/services/web/web_1 172.17.8.101:49155
valuekey
directory
*watch / TTL
confd
written in Go
etcd / Consul support
template resource config (TOML)
source template
registrator
automatically register/deregisters services
published ports and metadata
Consul/etcd/SkyDNS2
support TTL
<registry-uri-path>/<service-name>/<service-id> = <ip>:<port>
DEMO
nginx.conf.tmpl
{{ range $dir := lsdir "/services" }}upstream backend_{{ base $dir }} { {{ $custdir := printf "/services/%s/*" $dir }}{{ range getvs $custdir }} server {{.}}; {{ end }}}
server { listen 80; server_name {{ base $dir }}.sample.com;
location / { include /etc/nginx/proxy_params; proxy_pass http://backend_{{base $dir}}; }}{{end}}
Link
• http://coreos.com
• https://github.com/kelseyhightower/confd
• https://github.com/progrium/registrator
• https://github.com/subicura/nginx-confd
THANK YOU