Merge pull request #708 from mschneider82/master

Added: template for NSQ cluster
This commit is contained in:
Raúl Sánchez 2017-12-20 18:13:21 +01:00 committed by GitHub
commit 6cc937a45a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 153 additions and 0 deletions

23
templates/nsq/0/README.md Normal file
View File

@ -0,0 +1,23 @@
# Nsq.io
### Info:
This template creates, scale in and scale out a nsqd cluster on top of Rancher. By default there are 3 static nsqlookupd provisioned.
NSQD (TCP/4150, HTTP/4151) and the webinterface nsqadmin (HTTP/4171) can be reached by using the provisioned nsq-lb loadbalancer.
### Service configuration labels:
You can control where nsqd, nsqadmin, nsqlookupd and nsq-lb will be deployed by setting the following host labels:
- nsqd = <true | false>
- nsqlookupd = <true | false>
- nsqadmin = <true | false>
- nsq-lb = <true | false>
### Usage:
Select NSQ from catalog.
Enter the number of nodes for your NSQD cluster and NSQ Admin instances.
Click deploy.

View File

@ -0,0 +1,55 @@
version: '2'
services:
nsqlookupd01:
image: nsqio/nsq:v1.0.0-compat
command: /nsqlookupd
labels:
io.rancher.scheduler.affinity:host_label_soft: nsqlookupd=true
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/nsqlookupd02,io.rancher.stack_service.name=$${stack_name}/nsqlookupd03
nsqlookupd02:
image: nsqio/nsq:v1.0.0-compat
command: /nsqlookupd
labels:
io.rancher.scheduler.affinity:host_label_soft: nsqlookupd=true
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/nsqlookupd01,io.rancher.stack_service.name=$${stack_name}/nsqlookupd03
nsqlookupd03:
image: nsqio/nsq:v1.0.0-compat
command: /nsqlookupd
labels:
io.rancher.scheduler.affinity:host_label_soft: nsqlookupd=true
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/nsqlookupd01,io.rancher.stack_service.name=$${stack_name}/nsqlookupd02
nsqd:
image: nsqio/nsq:v1.0.0-compat
command:
- /bin/sh
- -c
- nsqd --data-path=/data --lookupd-tcp-address=nsqlookupd01:4160 --lookupd-tcp-address=nsqlookupd02:4160 --lookupd-tcp-address=nsqlookupd03:4160 -broadcast-address=$$HOSTNAME
labels:
io.rancher.scheduler.affinity:host_label_soft: nsqd=true
io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.sidekicks: data
io.rancher.container.hostname_override: container_name
volumes_from:
- data
nsqadmin:
image: nsqio/nsq:v1.0.0-compat
command: /nsqadmin --lookupd-http-address=nsqlookupd01:4161 --lookupd-http-address=nsqlookupd02:4161 --lookupd-http-address=nsqlookupd03:4161
labels:
io.rancher.scheduler.affinity:host_label_soft: nsqadmin=true
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
nsq-lb:
image: rancher/lb-service-haproxy:v0.7.9
ports:
- 4150:4150/tcp
- 4151:4151/tcp
- 4171:4171/tcp
labels:
io.rancher.scheduler.global: "true"
io.rancher.scheduler.affinity:host_label: nsq-lb=true
data:
image: busybox
command: /bin/true
volumes:
- /data
labels:
io.rancher.container.start_once: 'true'

View File

@ -0,0 +1,68 @@
version: '2'
catalog:
name: NSQD
version: v1.0.0-compat
questions:
- variable: "NSQD_SCALE"
description: "Number of NSQD nodes."
label: "Nsqd Nodes"
required: true
default: "3"
type: "int"
- variable: "NSQADMIN_SCALE"
description: "Number of NSQ Admin nodes."
label: "Nsqadmin Nodes"
required: true
default: "3"
type: "int"
services:
nsqlookupd01:
retain_ip: true
scale: 1
start_on_create: true
nsqlookupd02:
retain_ip: true
scale: 1
start_on_create: true
nsqlookupd03:
retain_ip: true
scale: 1
start_on_create: true
nsqadmin:
scale: ${NSQADMIN_SCALE}
start_on_create: true
data:
scale: ${NSQD_SCALE}
start_on_create: true
nsq-lb:
start_on_create: true
lb_config:
certs: []
port_rules:
- priority: 1
protocol: tcp
service: nsqd
source_port: 4150
target_port: 4150
- priority: 2
protocol: http
service: nsqd
source_port: 4151
target_port: 4151
- priority: 3
protocol: http
service: nsqadmin
source_port: 4171
target_port: 4171
health_check:
response_timeout: 2000
healthy_threshold: 2
port: 42
unhealthy_threshold: 3
initializing_timeout: 60000
interval: 2000
reinitializing_timeout: 60000
nsqd:
retain_ip: true
scale: ${NSQD_SCALE}
start_on_create: true

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

7
templates/nsq/config.yml Normal file
View File

@ -0,0 +1,7 @@
name: NSQ
description: |
A realtime distributed messaging platform
version: v1.0.0-compat
category: Message queues
maintainer: "Matthias Schneider <ms@wck.biz>"
projectURL: https://nsq.io/