From 1d858d8f554230956f8c6af3332149dee27ce16b Mon Sep 17 00:00:00 2001 From: Martin Evgeniev Date: Mon, 30 May 2016 11:03:20 +0200 Subject: [PATCH] Choose specific host label to deploy the MongoDB cluster.. --- templates/MongoDB/2/README.md | 18 ++++++++++++ templates/MongoDB/2/docker-compose.yml | 38 +++++++++++++++++++++++++ templates/MongoDB/2/rancher-compose.yml | 27 ++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 templates/MongoDB/2/README.md create mode 100644 templates/MongoDB/2/docker-compose.yml create mode 100644 templates/MongoDB/2/rancher-compose.yml diff --git a/templates/MongoDB/2/README.md b/templates/MongoDB/2/README.md new file mode 100644 index 0000000..5d1109f --- /dev/null +++ b/templates/MongoDB/2/README.md @@ -0,0 +1,18 @@ +# MongoDB + + +### Info: + + This template creates MongoDB replica set on top of Rancher. Replica set size starts with 3 MongoDB instances, the replica set has the ability to scale up automatically when adding new instances. + + +### Usage: + + Select MongoDB from catalog. + + Enter the name of the replica set. + + Click deploy. + + MongoDB can now be accessed over the Rancher network. + diff --git a/templates/MongoDB/2/docker-compose.yml b/templates/MongoDB/2/docker-compose.yml new file mode 100644 index 0000000..5156707 --- /dev/null +++ b/templates/MongoDB/2/docker-compose.yml @@ -0,0 +1,38 @@ +mongo-cluster: + restart: always + environment: + MONGO_SERVICE_NAME: mongo-cluster + tty: true + entrypoint: /opt/rancher/bin/entrypoint.sh + command: + - --replSet + - "${replset_name}" + image: mongo:3.2 + labels: + io.rancher.scheduler.affinity: "${host_label}" + io.rancher.container.hostname_override: container_name + io.rancher.sidekicks: mongo-base, mongo-datavolume + volumes_from: + - mongo-datavolume + - mongo-base +mongo-base: + restart: always + net: none + tty: true + labels: + io.rancher.scheduler.affinity: "${host_label}" + io.rancher.container.hostname_override: container_name + io.rancher.container.start_once: true + image: rancher/mongodb-conf:v0.1.0 + stdin_open: true + entrypoint: /bin/true +mongo-datavolume: + net: none + labels: + io.rancher.scheduler.affinity: "${host_label}" + io.rancher.container.hostname_override: container_name + io.rancher.container.start_once: true + volumes: + - /data/db + entrypoint: /bin/true + image: busybox diff --git a/templates/MongoDB/2/rancher-compose.yml b/templates/MongoDB/2/rancher-compose.yml new file mode 100644 index 0000000..9ae88fa --- /dev/null +++ b/templates/MongoDB/2/rancher-compose.yml @@ -0,0 +1,27 @@ +.catalog: + name: "MongoDB" + version: "3.2-rancher1" + description: "MongoDB Replica Set" + uuid: mongodb-1 + minimum_rancher_version: v0.46.0 + questions: + - variable: replset_name + description: "Name of the MongoDB replicaSet" + label: "ReplicaSet Name" + type: "string" + required: true + default: "rs0" + - variable: "host_label" + label: "Host Label to MongoDB Tags" + description: | + Comma delimited list of host label to use as MongoDB 'value' tag. + Example: 'database' + required: false + type: "string" +mongo-cluster: + scale: 3 + retain_ip: true + metadata: + mongo: + yml: + replset.name: "${replset_name}"