diff --git a/templates/consul-registrator/0/README.md b/templates/consul-registrator/0/README.md new file mode 100644 index 0000000..27a61df --- /dev/null +++ b/templates/consul-registrator/0/README.md @@ -0,0 +1,26 @@ +# Consul-Registrator + +### Info: + +This templates creates a global service that deploys a Consul agent that is bound to the host's networking. +This allows all Rancher hosts to join an existing Consul cluster. + +Additionally, Registrator is deployed to automatically discover and register containers that are deployed on the host as Consul service entries. +This allows for automatic service registration in Consul as Rancher schedule containers in the cluster. + + The variables used in this template include: + +- Hostname or IP address for the Consul cluster to join + +The templates uses the official Consul & Registrator images + +- [consul](https://hub.docker.com/r/_/consul/). +- [registrator](https://hub.docker.com/r/gliderlabs/registrator/). + +### Usage: + + Select Consul from catalog. + + Enter the hostname/DNS name/IP address of the Consul server to join + + Click deploy. diff --git a/templates/consul-registrator/0/docker-compose.yml b/templates/consul-registrator/0/docker-compose.yml new file mode 100644 index 0000000..fb32520 --- /dev/null +++ b/templates/consul-registrator/0/docker-compose.yml @@ -0,0 +1,62 @@ +consul-registrator: + log_driver: '' + labels: + io.rancher.sidekicks: consul,consul-data + io.rancher.scheduler.global: 'true' + io.rancher.container.pull_image: always + io.rancher.container.hostname_override: container_name + tty: true + restart: always + command: + - consul://localhost:8500 + log_opt: {} + image: gliderlabs/registrator:v7 + links: + - consul + volumes: + - /var/run/docker.sock:/tmp/docker.sock + stdin_open: true + net: host +consul: + ports: + - 8300:8300/tcp + - 8301:8301/tcp + - 8301:8301/udp + - 8302:8302/tcp + - 8302:8302/udp + - 8400:8400/tcp + - 8500:8500/tcp + - 8600:8600/tcp + - 8600:8600/udp + log_driver: '' + labels: + io.rancher.container.pull_image: always + io.rancher.scheduler.global: 'true' + io.rancher.container.hostname_override: container_name + io.rancher.container.dns: true + tty: true + net: host + restart: always + command: + - agent + - -retry-join + - ${consul_server} + - -recursor=169.254.169.250 + - -client=0.0.0.0 + environment: + CONSUL_LOCAL_CONFIG: "{\"leave_on_terminate\": true}" + CONSUL_BIND_INTERFACE: eth0 + volumes_form: + - consul-data + log_opt: {} + image: consul:v0.6.4 + stdin_open: true +consul-data: + image: consul:v0.6.4 + labels: + io.rancher.container.hostname_override: container_name + io.rancher.scheduler.global: 'true' + io.rancher.container.start_once: true + volumes: + - /consul/data + entrypoint: /bin/true diff --git a/templates/consul-registrator/0/rancher-compose.yml b/templates/consul-registrator/0/rancher-compose.yml new file mode 100644 index 0000000..e43f35c --- /dev/null +++ b/templates/consul-registrator/0/rancher-compose.yml @@ -0,0 +1,10 @@ +.catalog: + name: "Consul-Registrator" + description: "Consul Agent with Registrator Auto Configuration" + version: "0.6-rancher1" + uuid: consul-registrator-0 + questions: + - variable: consul_server + label: "Consul Server Hostname/IP" + type: "string" + required: true diff --git a/templates/consul-registrator/catalogIcon-consul.png b/templates/consul-registrator/catalogIcon-consul.png new file mode 100644 index 0000000..395b46f Binary files /dev/null and b/templates/consul-registrator/catalogIcon-consul.png differ diff --git a/templates/consul-registrator/config.yml b/templates/consul-registrator/config.yml new file mode 100644 index 0000000..eec4fac --- /dev/null +++ b/templates/consul-registrator/config.yml @@ -0,0 +1,5 @@ +name: Consul-Registrator +description: | + Consul agent with Registrator for Service Auto Configuration +version: 0.6-rancher1 +category: Clustering