Fix rabbitmq-3 network definition and add optional host_label

This commit is contained in:
Raul Sanchez 2017-08-01 15:17:58 +02:00
parent 8c284944dc
commit 2236bb2110
4 changed files with 150 additions and 2 deletions

View File

@ -0,0 +1,12 @@
RabbitMQ 3.6 with easy Rancher clustering
===
Provides RabbitMQ image that can scale to a cluster.
The following environment variables are passed to confd in order to set up RabbitMQ's configuration file:
* Partition handling: RabbitMQ's cluster handling setting: default set to autoheal
* Erlang cookie: cookie to allow nodes communication: default set to defaultcookiepleasechange
* Net ticktime: adjusts the frequency of both tick messages and detection of failures: default set to 60
* Confd args: additional confd args along with default --backend rancher --prefix /2015-07-25: default set to --interval 5
*Note*: You can pass an alternate `confd` configuration via the `ALTERNATE_CONF` environment variable.

View File

@ -0,0 +1,54 @@
version: '2'
services:
rabbitmq:
image: webhostingcoopteam/rabbitmq-conf:0.2.1
labels:
io.rancher.container.hostname_override: container_name
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.sidekicks: rabbitmq-base,rabbitmq-datavolume
{{- if ne .Values.host_label ""}}
io.rancher.scheduler.affinity:host_label: ${host_label}
{{- end}}
volumes_from:
- rabbitmq-datavolume
environment:
- RABBITMQ_NET_TICKTIME=${net_ticktime}
- RABBITMQ_CLUSTER_PARTITION_HANDLING=${cluster_partition_handling}
- CONFD_ARGS=${confd_args}
rabbitmq-datavolume:
network_mode: "none"
labels:
io.rancher.container.hostname_override: container_name
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
{{- if ne .Values.host_label ""}}
io.rancher.scheduler.affinity:host_label: ${host_label}
{{- end}}
io.rancher.container.start_once: true
volumes:
- rabbitconf:/etc/rabbitmq
- rancherbin:/opt/rancher/bin
entrypoint: /bin/true
image: rabbitmq:3.6-management-alpine
rabbitmq-base:
network_mode: "container:rabbitmq"
labels:
io.rancher.container.hostname_override: container_name
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
{{- if ne .Values.host_label ""}}
io.rancher.scheduler.affinity:host_label: ${host_label}
{{- end}}
image: rabbitmq:3.6-management-alpine
restart: always
volumes_from:
- rabbitmq-datavolume
entrypoint:
- /opt/rancher/bin/run.sh
environment:
- RABBITMQ_ERLANG_COOKIE=${erlang_cookie}
volumes:
rancherbin:
driver: ${VOLUME_DRIVER}
per_container: true
rabbitconf:
driver: ${VOLUME_DRIVER}
per_container: true

View File

@ -0,0 +1,82 @@
version: '2'
catalog:
name: "Rabbit MQ"
version: "0.2.1"
decription: A reliable, distributed messaging broker
questions:
- variable: "erlang_cookie"
description: "Erlang cookie required for auth"
label: "Erlang cookie:"
required: true
default: "defaultcookie"
type: "string"
- variable: "cluster_partition_handling"
label: "Partition Handling:"
description: "Cluster partition handling mode"
required: true
type: "enum"
default: autoheal
options:
- autoheal
- ignore
- pause_minority
- variable: "net_ticktime"
description: "Rabbitmq net ticktime setting"
label: "Net ticktime:"
required: false
type: "int"
default: 60
- variable: "confd_args"
description: "Confd additional args"
label: "Confd args"
required: false
type: "string"
default: --interval 5
- variable: RABBITMQ_TAG
default: "rabbitmq:3.6.10-management-alpine"
label: "rabbitMQ_version"
required: true
type: enum
options: # List of options if using type of `enum`
- "rabbitmq:3.6.10-management-alpine"
- "rabbitmq:3.6.10-management"
- "rabbitmq:3.6.9-management-alpine"
- "rabbitmq:3.6.9-management"
- "rabbitmq:3.6.8-management-alpine"
- "rabbitmq:3.6.8-management"
- "rabbitmq:3.6-management-alpine"
- "rabbitmq:3.6-management"
- "rabbitmq:management"
- variable: "VOLUME_DRIVER"
description: "The VOLUME driver to associate with this server"
label: "VOLUME Driver"
required: true
default: "local"
type: enum
options: # List of options if using type of `enum`
- local
- rancher-nfs
- rancher-efs
- rancher-ebs
- variable: host_label
label: "Host with Label to put rabbitmq on"
description: |
Host label to use as rabbitmq 'value' tag.
Example: 'rabbitmq=true'
required: false
default: ""
type: "string"
- variable: "initial_data_nodes"
type: "int"
required: true
label: "# of initial data nodes"
description: "Set the initial number of data nodes"
default: 1
services:
rabbitmq:
scale: ${initial_data_nodes}
metadata:
rabbitmq:
config:
node.name: "$${HOSTNAME}"

View File

@ -1,5 +1,5 @@
name: RabbitMQ 3.6 name: RabbitMQ 3.6
description: | description: |
Robust messaging for applications Robust messaging for applications
version: 0.2.0 version: "0.2.1"
category: Message queues category: Message queues