We are trying to use rancher-ebs driver with persistent ebs volumes and as long as I run at scale:1 all is good. We want to run at scale: 3. Also, if I eliminate the persistent ebs storage then all is good. What we are looking for is some way of creating storage volumes with dynamic names based on the scale id:
volumes:
mongo-prod:
…
Which could create with a 1 for scale 1 and 2 for scale 2.
“docker-compose.yml”
version: ‘2’
volumes:
mongo-prod:
driver: rancher-ebs
driver_opts:
name: mongo-prod
size: 1024
volumeType: gp2
services:
mongo-datavolume:
image: busybox
entrypoint:
- /bin/true
network_mode: none
volumes:
- mongo-prod:/data/db
labels:
io.rancher.scheduler.affinity:host_label: ‘’
io.rancher.container.start_once: ‘true’
io.rancher.container.hostname_override: container_name
mongo-cluster:
image: mongo:3.2
environment:
CATTLE_SCRIPT_DEBUG: ‘’
MONGO_SERVICE_NAME: mongo-cluster
entrypoint:
- /opt/rancher/bin/entrypoint.sh
volumes_from:
- mongo-datavolume
- mongo-base
command:
- --replSet
- or1-prod
labels:
io.rancher.scheduler.affinity:host_label: ‘’
io.rancher.sidekicks: mongo-base,mongo-datavolume
io.rancher.container.hostname_override: container_name
mongo-base:
image: rancher/mongodb-conf:v0.1.1
stdin_open: true
entrypoint:
- /bin/true
network_mode: none
labels:
io.rancher.scheduler.affinity:host_label: ‘’
io.rancher.container.start_once: ‘true’
io.rancher.container.hostname_override: container_name
or1-prod-mongo:
image: rancher/lb-service-haproxy:v0.6.4
ports:
- 27017:27017/tcp
labels:
io.rancher.container.agent.role: environmentAdmin
io.rancher.container.create_agent: ‘true’
“rancher-compose.yml”
version: ‘2’
services:
mongo-datavolume:
metadata:
mongo: &id001
yml:
replset.name: or1-prod
retain_ip: true
scale: 3
start_on_create: true
mongo-cluster:
metadata:
mongo: *id001
retain_ip: true
scale: 3
start_on_create: true
mongo-base:
metadata:
mongo: *id001
retain_ip: true
scale: 3
start_on_create: true
or1-prod-mongo:
scale: 2
start_on_create: true
lb_config:
certs:
port_rules:
- priority: 1
protocol: tcp
service: mongo-cluster
source_port: 27017
target_port: 27017
health_check:
response_timeout: 2000
healthy_threshold: 2
port: 42
unhealthy_threshold: 3
initializing_timeout: 60000
interval: 2000
reinitializing_timeout: 60000
Which dynamically creates at scale 3: