diff --git a/templates/zookeeper/3/README.md b/templates/zookeeper/3/README.md new file mode 100644 index 0000000..ee2b770 --- /dev/null +++ b/templates/zookeeper/3/README.md @@ -0,0 +1,27 @@ +# Apache Zookeeper (Experimental) + +### Info: + + This template creates, scale in and scale out a multinodes zk (zookeeper) cluster on top of Rancher. The configuration is generated with confd from Rancher metadata. + Cluster size are variable after deployment, and get reconfigured if refresh interval > 0. + + +### Usage: + + Select Apache Zookeeper from catalog. + + Enter the number of nodes, mem and refresh interval for the zk cluster. (set refresh data to 0 to disable dinamic config) + + Change the following zookeeper default parameters, if you need: + +- ZK_DATA_DIR="/opt/zk/data" +- ZK_INIT_LIMIT="10" +- ZK_MAX_CLIENT_CXNS="500" +- ZK_SYNC_LIMIT="5" +- ZK_TICK_TIME="2000" + + Click deploy. + + Zookeeper can now be accessed over the Rancher network. + + Note: When you scale the cluster, zero downtime is expected... diff --git a/templates/zookeeper/3/docker-compose.yml.tpl b/templates/zookeeper/3/docker-compose.yml.tpl new file mode 100644 index 0000000..a6c73dc --- /dev/null +++ b/templates/zookeeper/3/docker-compose.yml.tpl @@ -0,0 +1,55 @@ +version: '2' +services: + zk: + tty: true + image: rawmind/alpine-zk:3.4.9-3 + volumes_from: + - zk-volume + - zk-conf + environment: + - JVMFLAGS=-Xmx${zk_mem}m -Xms${zk_mem}m + - ZK_DATA_DIR=${zk_data_dir} + - ZK_INIT_LIMIT=${zk_init_limit} + - ZK_MAX_CLIENT_CXNS=${zk_max_client_cxns} + - ZK_SYNC_LIMIT=${zk_sync_limit} + - ZK_TICK_TIME=${zk_tick_time} + labels: + io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name} + io.rancher.container.hostname_override: container_name +{{- if ne .Values.host_label ""}} + io.rancher.scheduler.affinity:host_label: ${host_label} +{{- end}} + io.rancher.sidekicks: zk-volume, zk-conf + zk-conf: + labels: + io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name} + io.rancher.container.hostname_override: container_name +{{- if ne .Values.host_label ""}} + io.rancher.scheduler.affinity:host_label: ${host_label} +{{- end}} + io.rancher.container.start_once: true + image: rawmind/rancher-zk:3.4.9 + volumes: + - zkconfig:/opt/tools + zk-volume: + labels: + io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name} + io.rancher.container.hostname_override: container_name +{{- if ne .Values.host_label ""}} + io.rancher.scheduler.affinity:host_label: ${host_label} +{{- end}} + io.rancher.container.start_once: true + environment: + - SERVICE_UID=10002 + - SERVICE_GID=10002 + - SERVICE_VOLUME=${zk_data_dir} + volumes: + - zkdata:${zk_data_dir} + image: rawmind/alpine-volume:0.0.2-1 +volumes: + zkconfig: + driver: ${VOLUME_DRIVER} + per_container: true + zkdata: + driver: ${VOLUME_DRIVER} + per_container: true diff --git a/templates/zookeeper/3/rancher-compose.yml b/templates/zookeeper/3/rancher-compose.yml new file mode 100644 index 0000000..15751d9 --- /dev/null +++ b/templates/zookeeper/3/rancher-compose.yml @@ -0,0 +1,88 @@ +version: '2' +catalog: + name: Zookeeper + version: 3.4.9-rancher2 + description: | + (Experimental) Apache Zookeeper cluster. + minimum_rancher_version: v0.59.0 + maintainer: "Raul Sanchez " + uuid: zk-0 + questions: + - variable: "zk_scale" + description: "Number of zk nodes. Note: Recommended an odd number" + label: "Zk Nodes:" + required: true + default: 3 + type: "int" + - variable: "zk_mem" + description: "Amount of memory to config zk." + label: "Zk Memory (mb):" + required: true + default: 512 + type: "int" + - variable: "zk_init_limit" + description: "Time to allow followers to connect and sync with leader" + label: "Zk init limit (ticks):" + required: true + default: 10 + type: "int" + - variable: "zk_data_dir" + description: "Directory where zookeeper store data" + label: "Zk data dir:" + required: true + default: "/opt/zk/data" + type: "string" + - variable: "zk_max_client_cxns" + description: "Max client concurrent connections" + label: "Zk max client cxns:" + required: true + default: 500 + type: "int" + - variable: "zk_sync_limit" + description: "Time to allow followers to sync with leader" + label: "Zk sync limit (ticks):" + required: true + default: 5 + type: "int" + - variable: "zk_tick_time" + description: "Tick time length" + label: "Zk tick time (ms):" + required: true + default: 2000 + type: "int" + - variable: "zk_interval" + description: "Interval to poll/apply configuration changes. 0 to disable, reconfiguration will be done when you restart zk nodes" + label: "Zk Interval (s):" + required: true + default: 60 + type: "int" + - variable: host_label + label: "Host with Label to put zookeeper on" + description: | + Host label to use as zookeeper 'value' tag. + Example: 'zookeeper=true' + required: false + default: "" + type: "string" + - 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 +services: + zk: + scale: ${zk_scale} + retain_ip: true + health_check: + port: 2181 + interval: 5000 + unhealthy_threshold: 3 + request_line: '' + healthy_threshold: 2 + response_timeout: 5000 diff --git a/templates/zookeeper/config.yml b/templates/zookeeper/config.yml index 84ea903..d6b7d77 100644 --- a/templates/zookeeper/config.yml +++ b/templates/zookeeper/config.yml @@ -1,7 +1,7 @@ name: Apache Zookeeper description: | (Experimental) Zookeeper cluster -version: 3.4.9-rancher1 +version: 3.4.9-rancher2 category: Clustering maintainer: "Raul Sanchez " projectURL: https://github.com/rawmind0/alpine-zk