Upgrade to mongo 3.4 and added volume driver choice

This commit is contained in:
Josh Cox 2017-07-25 13:46:18 -05:00
parent ef67c597a0
commit feb0eac179
4 changed files with 113 additions and 1 deletions

View File

@ -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.

View File

@ -0,0 +1,42 @@
version: '2'
services:
mongo-cluster:
restart: always
environment:
MONGO_SERVICE_NAME: mongo-cluster
CATTLE_SCRIPT_DEBUG: ${debug}
entrypoint: /opt/rancher/bin/entrypoint.sh
command:
- --replSet
- "${replset_name}"
image: mongo:3.4
labels:
io.rancher.scheduler.affinity:host_label: ${host_label}
io.rancher.container.hostname_override: container_name
io.rancher.sidekicks: mongo-base, mongo-datavolume
volumes_from:
- mongo-datavolume
- mongo-base
ports:
- 27017:27017/tcp
mongo-base:
restart: always
labels:
io.rancher.scheduler.affinity:host_label: ${host_label}
io.rancher.container.hostname_override: container_name
io.rancher.container.start_once: true
image: rancher/mongodb-conf:v0.1.1
stdin_open: true
entrypoint: /bin/true
mongo-datavolume:
labels:
io.rancher.scheduler.affinity:host_label: ${host_label}
io.rancher.container.hostname_override: container_name
io.rancher.container.start_once: true
volumes:
- mongodata:/data/db
entrypoint: /bin/true
image: busybox
volumes:
mongodata:
driver: ${VOLUME_DRIVER}

View File

@ -0,0 +1,52 @@
version: '2'
catalog:
name: "MongoDB"
version: "3.4-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: |
Host label to use as MongoDB 'value' tag.
Example: 'database'
required: false
type: "string"
- variable: debug
description: "Enable Debug log for Mongo containers"
label: "Debug"
type: "string"
required: false
default: ""
- variable: "VOLUME_DRIVER"
description: "The VOLUME driver to associate with this server"
label: "VOLUME Driver"
required: true
default: "local"
type: enum
options:
- local
- rancher-nfs
- rancher-efs
- rancher-ebs
- variable: mongo_scale
description: "How many containers the MongoDB will scale to?"
label: "mongo scale"
type: "int"
required: true
default: "3"
services:
mongo-cluster:
scale: ${mongo_scale}
retain_ip: true
metadata:
mongo:
yml:
replset.name: "${replset_name}"

View File

@ -1,5 +1,5 @@
name: MongoDB
description: |
MongoDB Replica Set.
version: 3.2-rancher2
version: "3.4-rancher1"
category: Databases