diff --git a/kubernetes-templates/kafka/0/README.md b/kubernetes-templates/kafka/0/README.md new file mode 100644 index 0000000..1bab12c --- /dev/null +++ b/kubernetes-templates/kafka/0/README.md @@ -0,0 +1,33 @@ +# Apache Kafka (Experimental) + +### Info: + + This template creates, scale in and scale out a multinodes kafka broker cluster on top of k8s. The configuration is generated with confd from k8s. + Cluster size are variable after deployment, and get reconfigured. + + +### Usage: + + Select Apache Kafka from catalog. + + Enter the number of nodes, mem and refresh interval for the kafka cluster. + + Change the following kafka default parameters, if you need: + +- kafka_name="kafka" # kafka k8s service and rc name. +- kafka_namespace="kafka" # kafka k8s namespace +- kafka_scale=3 # kafka scale to deploy. +- kafka_mem=512 # kafka broker memory. +- kafka_log_dir="/opt/kafka/logs" # Kafka log dir. +- kafka_log_retention="168" # kafka log retention. +- kafka_num_partitions="1" # Kafka partitions number +- kafka_delete_topics="false" # kafka delete topics +- kafka_pub_ip= < true | false > # Advertise public ip to zookeeper. +- zk_link="kafka-zk/zk" # zookeeper namespace/service to connect to. + + Click deploy. + + Kafka can now be accessed over the Rancher network. + + Note: When you scale the cluster, zero downtime is not guaranteed..yet.. + diff --git a/kubernetes-templates/kafka/0/rancher-compose.yml b/kubernetes-templates/kafka/0/rancher-compose.yml new file mode 100644 index 0000000..06fa8eb --- /dev/null +++ b/kubernetes-templates/kafka/0/rancher-compose.yml @@ -0,0 +1,95 @@ +.catalog: + name: Kafka + version: 0.10.0.1-k8s + description: | + (Experimental) Apache Kafka cluster. + minimum_rancher_version: v0.59.0 + maintainer: "Raul Sanchez " + uuid: kafka-0 + questions: + - variable: "kafka_name" + description: "Name of kafka rc and service." + label: "K8s rc name:" + required: true + default: "kafka" + type: "string" + - variable: "kafka_namespace" + description: "Name of kafka namespace." + label: "K8s namespace:" + required: true + default: "default" + type: "string" + - variable: "kafka_scale" + description: "Number of brokers nodes. Note: Recommended an odd number" + label: "Broker Nodes:" + required: true + default: 3 + type: "int" + - variable: "kafka_mem" + description: "Amount of memory to config brokers." + label: "Broker Memory (mb):" + required: true + default: 1024 + type: "string" + - variable: "kafka_log_dir" + description: "Broker volume to log data" + label: "Broker log volume:" + required: true + default: "/opt/kafka/logs" + type: "string" + - variable: "kafka_log_retention" + description: "Broker log retention in hours" + label: "Broker log retention (h):" + required: true + default: "168" + type: "int" + - variable: "kafka_num_partitions" + description: "Number of broker partitions" + label: "Broker partitions:" + required: true + default: "1" + type: "int" + - variable: "kafka_delete_topics" + label: "Kafka delete topics:" + description: | + Enable delete topics in kafka. + default: false + required: true + type: enum + options: + - false + - true + - variable: "kafka_interval" + description: "Interval to poll/apply configuration changes. 0 to disable" + label: "Broker Interval (s):" + required: true + default: 60 + type: "int" + - variable: "kafka_pub_ip" + description: "Advertise local and host public ip" + label: "Broker public ip:" + default: false + required: true + type: enum + options: + - false + - true + - variable: "zk_link" + description: | + Choose the Zookeeper service to use. + It's really recommended a dedicated zookeeper service just for Kafka. + label: "Zookeeper stack/service" + default: "default/zookeeper" + required: true + type: "service" +broker: + scale: ${kafka_scale} + retain_ip: true + health_check: + port: 9092 + interval: 5000 + unhealthy_threshold: 3 + request_line: '' + healthy_threshold: 2 + response_timeout: 5000 + diff --git a/kubernetes-templates/kafka/0/zk-rc.yml b/kubernetes-templates/kafka/0/zk-rc.yml new file mode 100644 index 0000000..cd815ea --- /dev/null +++ b/kubernetes-templates/kafka/0/zk-rc.yml @@ -0,0 +1,77 @@ +apiVersion: v1 +kind: ReplicationController +metadata: + name: "${kafka_name}" + namespace: "${kafka_namespace}" + labels: + name: "${kafka_name}" +spec: + replicas: ${kafka_scale} + selector: + name: "${kafka_name}" + template: + metadata: + labels: + name: "${kafka_name}" + spec: + containers: + - name: "broker-conf" + image: "rawmind/k8s-kafka:0.10.0.0-4" + volumeMounts: + - mountPath: "/opt/tools" + name: "broker-conf" + ports: + imagePullPolicy: "IfNotPresent" + - name: "broker-volume" + image: "rawmind/alpine-volume:0.0.2-1" + env: + - name: SERVICE_UID + value: "10003" + - name: SERVICE_GID + value: "10003" + - name: SERVICE_VOLUME + value: "${kafka_log_dir}" + - name: KEEP_ALIVE + value: "1" + volumeMounts: + - mountPath: "${kafka_log_dir}" + name: "broker-data" + ports: + imagePullPolicy: "IfNotPresent" + - name: "broker-service" + image: "rawmind/alpine-kafka:0.10.0.1" + env: + - name: JVMFLAGS + value: "-Xmx${kafka_mem}m -Xms${kafka_mem}m" + - name: CONFD_INTERVAL + value: "${kafka_interval}" + - name: KAFKA_ZK_SERVICE + value: "${zk_link}" + - name: KAFKA_DELETE_TOPICS + value: "${kafka_delete_topics}" + - name: KAFKA_LOG_DIRS + value: "${kafka_log_dir}" + - name: KAFKA_LOG_RETENTION_HOURS + value: "${kafka_log_retention}" + - name: KAFKA_NUM_PARTITIONS + value: "${kafka_num_partitions}" + - name: ADVERTISE_PUB_IP + value: "${kafka_pub_ip}" + - name: POD_NAMESPACE + value: "${kafka_namespace}" + volumeMounts: + - mountPath: "${kafka_log_dir}" + name: "broker-data" + - mountPath: "/opt/tools" + name: "broker-conf" + ports: + - containerPort: 9092 + name: "broker-client" + protocol: "TCP" + imagePullPolicy: "IfNotPresent" + restartPolicy: "Always" + volumes: + - name: "broker-data" + emptyDir: {} + - name: "broker-conf" + emptyDir: {} \ No newline at end of file diff --git a/kubernetes-templates/kafka/0/zk-service.yml b/kubernetes-templates/kafka/0/zk-service.yml new file mode 100644 index 0000000..0a6371a --- /dev/null +++ b/kubernetes-templates/kafka/0/zk-service.yml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: "${kafka_name}" + labels: + name: "${kafka_name}" +spec: + ports: + - port: 9092 + targetPort: 9092 + name: "broker-client" + protocol: "TCP" + selector: + name: "${kafka_name}" + clusterIP: "None" diff --git a/kubernetes-templates/kafka/catalogIcon-kafka.svg b/kubernetes-templates/kafka/catalogIcon-kafka.svg new file mode 100644 index 0000000..e0056cc --- /dev/null +++ b/kubernetes-templates/kafka/catalogIcon-kafka.svg @@ -0,0 +1,28 @@ + + + + + + + diff --git a/kubernetes-templates/kafka/config.yml b/kubernetes-templates/kafka/config.yml new file mode 100644 index 0000000..061b88b --- /dev/null +++ b/kubernetes-templates/kafka/config.yml @@ -0,0 +1,9 @@ +name: Apache Kafka +description: | + (Experimental) Kafka cluster +version: 0.10.0.1-k8s +category: Clustering +maintainer: "Raul Sanchez " +minimum_rancher_version: v0.59.0 +license: +projectURL: https://github.com/rawmind0/alpine-kafka diff --git a/kubernetes-templates/zookeeper/0/README.md b/kubernetes-templates/zookeeper/0/README.md new file mode 100644 index 0000000..30f5a93 --- /dev/null +++ b/kubernetes-templates/zookeeper/0/README.md @@ -0,0 +1,31 @@ +# Apache Zookeeper (Experimental) + +### Info: + + This template creates, scale in and scale out a multinodes zk (zookeeper) cluster on top of k8s. The configuration is generated with confd watching k8s metadata. + Cluster size are variable after deployment, and get reconfigured if you scale. + + The services generates ZKID's (saving them as pod labels) and start the zookeeper cluster. + + +### Usage: + + Select Apache Zookeeper from catalog. + + Change the following zookeeper default parameters, if you need: + +- zk_name="zookeeper" # Name of the k8s rc and service. +- zk_namespace="default" # Name of the k8s namespace +- zk_scale="3" # Number of zk replicas +- zk_mem="512" # Mem to configure zk. +- zk_data_dir="/opt/zk/data" # Zk dataDir param value +- zk_init_limit="10" # zk initLimit param value +- zk_max_client_cxns="500" # zk maxClientCnxns param value +- zk_sync_limit="5" # zk syncLimit param value +- zk_tick_time="2000" # zk tickTime param value + + Click deploy. + + Zookeeper can now be accessed over the Rancher network. + +Testing Feature: When you scale the cluster, zero downtime is expected... diff --git a/kubernetes-templates/zookeeper/0/rancher-compose.yml b/kubernetes-templates/zookeeper/0/rancher-compose.yml new file mode 100644 index 0000000..ca20b63 --- /dev/null +++ b/kubernetes-templates/zookeeper/0/rancher-compose.yml @@ -0,0 +1,73 @@ +.catalog: + name: Zookeeper + version: 3.4.8-k8s1 + description: | + (Experimental) Apache Zookeeper cluster. + minimum_rancher_version: v0.59.0 + maintainer: "Raul Sanchez " + uuid: zk-0 + questions: + - variable: "zk_name" + description: "Name of zookeeper rc and service." + label: "K8s rc name:" + required: true + default: "zookeeper" + type: "string" + - variable: "zk_namespace" + description: "Name of zookeeper namespace." + label: "K8s namespace:" + required: true + default: "default" + type: "string" + - 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" +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/kubernetes-templates/zookeeper/0/zk-rc.yml b/kubernetes-templates/zookeeper/0/zk-rc.yml new file mode 100644 index 0000000..e382d3c --- /dev/null +++ b/kubernetes-templates/zookeeper/0/zk-rc.yml @@ -0,0 +1,80 @@ +apiVersion: v1 +kind: ReplicationController +metadata: + name: "${zk_name}" + namespace: "${zk_namespace}" + labels: + name: "${zk_name}" +spec: + replicas: ${zk_scale} + selector: + name: "${zk_name}" + template: + metadata: + labels: + name: "${zk_name}" + annotations: + spec: + containers: + - name: "zk-conf" + image: "rawmind/k8s-zk:3.4.8-10" + volumeMounts: + - mountPath: "/opt/tools" + name: "zk-conf" + ports: + imagePullPolicy: "IfNotPresent" + - name: "zk-volume" + image: "rawmind/alpine-volume:0.0.2-1" + env: + - name: SERVICE_UID + value: "10002" + - name: SERVICE_GID + value: "10002" + - name: SERVICE_VOLUME + value: "${kafka_log_dir}" + - name: KEEP_ALIVE + value: "1" + volumeMounts: + - mountPath: "${zk_data_dir}" + name: "zk-data" + ports: + imagePullPolicy: "IfNotPresent" + - name: "zk-service" + image: "rawmind/alpine-zk:3.4.8-16" + env: + - name: JVMFLAGS + value: "-Xmx${zk_mem}m -Xms${zk_mem}m" + - name: ZK_DATA_DIR + value: "${zk_data_dir}" + - name: ZK_INIT_LIMIT + value: "${zk_init_limit}" + - name: ZK_MAX_CLIENT_CXNS + value: "${zk_max_client_cxns}" + - name: ZK_SYNC_LIMIT + value: "${zk_sync_limit}" + - name: ZK_TICK_TIME + value: "${zk_tick_time}" + - name: POD_NAMESPACE + value: "${zk_namespace}" + volumeMounts: + - mountPath: "${zk_data_dir}" + name: "zk-data" + - mountPath: "/opt/tools" + name: "zk-conf" + ports: + - containerPort: 2181 + name: "zk-client" + protocol: "TCP" + - containerPort: 2888 + name: "zk-server" + protocol: "TCP" + - containerPort: 3888 + name: "zk-leader" + protocol: "TCP" + imagePullPolicy: "IfNotPresent" + restartPolicy: "Always" + volumes: + - name: "zk-data" + emptyDir: {} + - name: "zk-conf" + emptyDir: {} \ No newline at end of file diff --git a/kubernetes-templates/zookeeper/0/zk-service.yml b/kubernetes-templates/zookeeper/0/zk-service.yml new file mode 100644 index 0000000..438bb3c --- /dev/null +++ b/kubernetes-templates/zookeeper/0/zk-service.yml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + name: "${zk_name}" + namespace: "${zk_namespace}" + labels: + name: "${zk_name}" +spec: + ports: + - port: 2181 + targetPort: 2181 + name: "zk-client" + protocol: "TCP" + - port: 2888 + targetPort: 2888 + name: "zk-server" + protocol: "TCP" + - port: 3888 + targetPort: 3888 + name: "zk-leader" + protocol: "TCP" + selector: + name: "${zk_name}" diff --git a/kubernetes-templates/zookeeper/catalogIcon-zookeeper.png b/kubernetes-templates/zookeeper/catalogIcon-zookeeper.png new file mode 100644 index 0000000..df751f4 Binary files /dev/null and b/kubernetes-templates/zookeeper/catalogIcon-zookeeper.png differ diff --git a/kubernetes-templates/zookeeper/config.yml b/kubernetes-templates/zookeeper/config.yml new file mode 100644 index 0000000..14ff4b8 --- /dev/null +++ b/kubernetes-templates/zookeeper/config.yml @@ -0,0 +1,7 @@ +name: Apache Zookeeper +description: | + (Experimental) Zookeeper cluster +version: 3.4.8-k8s1 +category: Clustering +maintainer: "Raul Sanchez " +projectURL: https://github.com/rawmind0/alpine-zk \ No newline at end of file diff --git a/templates/kafka/1/README.md b/templates/kafka/1/README.md index 8477dbe..df396ad 100644 --- a/templates/kafka/1/README.md +++ b/templates/kafka/1/README.md @@ -14,12 +14,14 @@ Change the following kafka default parameters, if you need: -- KAFKA_LOG_DIRS="/opt/kafka/logs" -- KAFKA_LOG_RETENTION_HOURS="168" -- KAFKA_NUM_PARTITIONS="1" -- ADVERTISE_PUB_IP= < true | false > - - Select zookeeper stack/service to connect to. +- kafka_scale=3 # kafka scale to deploy. +- kafka_mem=512 # kafka broker memory. +- kafka_log_dir="/opt/kafka/logs" # Kafka log dir. +- kafka_log_retention="168" # kafka log retention. +- kafka_num_partitions="1" # Kafka partitions number +- kafka_delete_topics="false" # kafka delete topics +- kafka_pub_ip= < true | false > # Advertise public ip to zookeeper. +- zk_link="kafka-zk/zk" # zookeeper stack/service to connect to. Click deploy. diff --git a/templates/kafka/1/docker-compose.yml b/templates/kafka/1/docker-compose.yml index a775193..8ae9102 100644 --- a/templates/kafka/1/docker-compose.yml +++ b/templates/kafka/1/docker-compose.yml @@ -1,6 +1,6 @@ broker: tty: true - image: rawmind/alpine-kafka:0.10.0.0-2 + image: rawmind/alpine-kafka:0.10.0.1 volumes_from: - broker-volume - broker-conf @@ -8,6 +8,7 @@ broker: - JVMFLAGS=-Xmx${kafka_mem}m -Xms${kafka_mem}m - CONFD_INTERVAL=${kafka_interval} - ZK_SERVICE=${zk_link} + - KAFKA_DELETE_TOPICS=${kafka_delete_topics} - KAFKA_LOG_DIRS=${kafka_log_dir} - KAFKA_LOG_RETENTION_HOURS=${kafka_log_retention} - KAFKA_NUM_PARTITIONS=${kafka_num_partitions} @@ -24,7 +25,9 @@ broker-conf: io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name} io.rancher.container.hostname_override: container_name io.rancher.container.start_once: true - image: rawmind/rancher-kafka:0.10.0.0 + image: rawmind/rancher-kafka:0.10.0.0-3 + volumes: + - /opt/tools broker-volume: net: none labels: @@ -32,12 +35,10 @@ broker-volume: io.rancher.container.hostname_override: container_name io.rancher.container.start_once: true environment: - - SERVICE_USER=kafka - SERVICE_UID=10003 - - SERVICE_GROUP=kafka - SERVICE_GID=10003 - SERVICE_VOLUME=${kafka_log_dir} volumes: - ${kafka_log_dir} volume_driver: local - image: rawmind/alpine-volume:0.0.1-1 + image: rawmind/alpine-volume:0.0.2-1 diff --git a/templates/kafka/1/rancher-compose.yml b/templates/kafka/1/rancher-compose.yml index f97ded0..1844a29 100644 --- a/templates/kafka/1/rancher-compose.yml +++ b/templates/kafka/1/rancher-compose.yml @@ -1,6 +1,6 @@ .catalog: name: Kafka - version: 0.10.0.0-rancher1 + version: 0.10.0.1-rancher1 description: | (Experimental) Apache Kafka cluster. minimum_rancher_version: v0.59.0 @@ -37,6 +37,16 @@ required: true default: "1" type: "int" + - variable: "kafka_delete_topics" + label: "Kafka delete topics:" + description: | + Enable delete topics in kafka. + default: false + required: true + type: enum + options: + - false + - true - variable: "kafka_interval" description: "Interval to poll/apply configuration changes. 0 to disable" label: "Broker Interval (s):" @@ -44,11 +54,14 @@ default: 60 type: "int" - variable: "kafka_pub_ip" - description: "Advertise host ip in zookeeper" - label: "Advertise host ip:" - required: false - default: false - type: "boolean" + description: "Advertise local and host public ip" + label: "Broker public ip:" + default: false + required: true + type: enum + options: + - false + - true - variable: "zk_link" description: | Choose the Zookeeper service to use. diff --git a/templates/kafka/config.yml b/templates/kafka/config.yml index 706e7c0..addaa54 100644 --- a/templates/kafka/config.yml +++ b/templates/kafka/config.yml @@ -1,8 +1,9 @@ name: Apache Kafka description: | (Experimental) Kafka cluster -version: 0.10.0.0-rancher1 +version: 0.10.0.1-rancher1 category: Clustering maintainer: "Raul Sanchez " minimum_rancher_version: v0.59.0 license: +projectURL: https://github.com/rawmind0/alpine-kafka \ No newline at end of file diff --git a/templates/traefik/2/README.md b/templates/traefik/2/README.md new file mode 100644 index 0000000..8f2d637 --- /dev/null +++ b/templates/traefik/2/README.md @@ -0,0 +1,55 @@ +# Traefik active load balancer (Experimental) + +### Info: + + This template deploys traefik active load balancers on top of Rancher. The configuration is generated and updated with confd from Rancher metadata. + It would be deployed in hosts with label traefik_lb=true. + +### Config: + +- host_label = "traefik_lb=true" # Host label where to run traefik service. +- http_port = 8080 # Port exposed to get access to the published services. +- https_port = 8443 # Port exposed to get secured access to the published services. +- admin_port = 8000 # Port exposed to get admin access to the traefik service. +- https_enable = + - false: Enable http enpoints and disable https ones. + - true: Enable http and https endpoints. + - only: Enable https endpoints and redirect http to https. +- acme_enable = false # Enable/Disable acme traefik support. +- acme_email = "test@traefik.io" # acme user email +- acme_ondemand = true # acme ondemand parameter. +- ssl_key # Paste your ssl key. *Required if you enable https +- ssl_crt # Paste your ssl crt. *Required if you enable https +- refresh_interval = 10s # Interval to refresh traefik rules.toml from rancher-metadata. + +### Service configuration labels: + +Traefik labels has to be added in your services, in order to get included in traefik dynamic config. + +- traefik.enable = + - true: the service will be published as *service_name.stack_name.traefik_domain* + - stack: the service will be published as *stack_name.traefik_domain*. WARNING: You could have collisions inside services within your stack + - false: the service will not be published +- traefik.domain = < domain > # Domain names to route rule. Multiple values separated by "," > +- traefik.port = < port > # Port to expose throught traefik +- traefik.acme = < true | false > # Enable/disable ACME traefik feature + +### Usage: + + Select Traefik from catalog. + + Set the params. + + Click deploy. + + Services will be accessed throught hosts ip's whith $host_label: + + - http://${service_name}.${stack_name}.${traefik.domain}:${http_port} + - https://${service_name}.${stack_name}.${traefik.domain}:${https_port} + + or + + - http://${stack_name}.${traefik.domain}:${http_port} + - https://${stack_name}.${traefik.domain}:${https_port} + +Note: To access the services, you need to create A or CNAMES dns entries for every one. diff --git a/templates/traefik/2/docker-compose.yml b/templates/traefik/2/docker-compose.yml new file mode 100644 index 0000000..df21943 --- /dev/null +++ b/templates/traefik/2/docker-compose.yml @@ -0,0 +1,39 @@ +traefik: + ports: + - ${admin_port}:8000/tcp + - ${http_port}:${http_port}/tcp + - ${https_port}:${https_port}/tcp + log_driver: '' + labels: + io.rancher.scheduler.global: 'true' + io.rancher.scheduler.affinity:host_label: ${host_label} + io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name} + io.rancher.sidekicks: traefik-conf + io.rancher.container.hostname_override: container_name + tty: true + log_opt: {} + image: rawmind/alpine-traefik:1.0.2-6 + environment: + - CONF_INTERVAL=${refresh_interval} + - TRAEFIK_HTTP_PORT=${http_port} + - TRAEFIK_HTTPS_PORT=${https_port} + - TRAEFIK_HTTPS_ENABLE=${https_enable} + - TRAEFIK_ACME_ENABLE=${acme_enable} + - TRAEFIK_ACME_EMAIL=${acme_email} + - TRAEFIK_ACME_ONDEMAND=${acme_ondemand} + volumes_from: + - traefik-conf +traefik-conf: + log_driver: '' + labels: + io.rancher.scheduler.global: 'true' + io.rancher.scheduler.affinity:host_label: ${host_label} + io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name} + io.rancher.container.start_once: 'true' + tty: true + log_opt: {} + image: rawmind/rancher-traefik:0.3.4-6 + net: none + volumes: + - /opt/tools + diff --git a/templates/traefik/2/rancher-compose.yml b/templates/traefik/2/rancher-compose.yml new file mode 100644 index 0000000..dfe59e5 --- /dev/null +++ b/templates/traefik/2/rancher-compose.yml @@ -0,0 +1,95 @@ +.catalog: + name: traefik + version: v1.0.2-rancher1 + description: | + (Experimental) Traefik load balancer. + minimum_rancher_version: v0.59.0 + maintainer: "Raul Sanchez " + uuid: traefik-0 + questions: + - variable: "host_label" + description: "Host label where to run traefik service." + label: "Host label:" + required: true + default: "traefik_lb=true" + type: "string" + - variable: "http_port" + description: "Traefik http public port to listen." + label: "Http port:" + required: true + default: 8080 + type: "int" + - variable: "https_port" + description: "Traefik https public port to listen." + label: "Https port:" + required: true + default: 8443 + type: "int" + - variable: "admin_port" + description: "Traefik admin public port to listen." + label: "Admin port:" + required: true + default: 8000 + type: "int" + - variable: "https_enable" + label: "Enable HTTPS:" + description: | + Enable https working mode. If you activate, you need to fill SSL key and SSL crt in order to work. + default: false + required: true + type: enum + options: + - false + - true + - only + - variable: "acme_enable" + description: "Enable acme support on traefik." + label: "Enable ACME:" + required: true + default: false + type: "boolean" + - variable: "acme_email" + description: "ACME user email." + label: "ACME email:" + required: true + default: "test@traefik.io" + type: "string" + - variable: "acme_ondemand" + description: "Enable acme ondemand." + label: "ACME ondemand:" + required: true + default: true + type: "boolean" + - variable: "ssl_key" + description: "SSL key to secure the service. *Required if you enable https" + label: "SSL key" + type: "multiline" + required: false + default: "" + - variable: "ssl_crt" + description: "SSL cert to secure the service. *Required if you enable https" + label: "SSL crt" + type: "multiline" + required: false + default: "" + - variable: "refresh_interval" + description: "Interval to poll/apply configuration changes." + label: "Refresh Interval (s):" + required: true + default: 10 + type: "int" +traefik: + retain_ip: true + health_check: + port: 8000 + interval: 5000 + unhealthy_threshold: 3 + request_line: 'GET /dashboard/# HTTP/1.0' + healthy_threshold: 2 + response_timeout: 5000 + metadata: + traefik: + ssl_key: | + ${ssl_key} + ssl_crt: | + ${ssl_crt} diff --git a/templates/traefik/3/README.md b/templates/traefik/3/README.md new file mode 100644 index 0000000..8f2d637 --- /dev/null +++ b/templates/traefik/3/README.md @@ -0,0 +1,55 @@ +# Traefik active load balancer (Experimental) + +### Info: + + This template deploys traefik active load balancers on top of Rancher. The configuration is generated and updated with confd from Rancher metadata. + It would be deployed in hosts with label traefik_lb=true. + +### Config: + +- host_label = "traefik_lb=true" # Host label where to run traefik service. +- http_port = 8080 # Port exposed to get access to the published services. +- https_port = 8443 # Port exposed to get secured access to the published services. +- admin_port = 8000 # Port exposed to get admin access to the traefik service. +- https_enable = + - false: Enable http enpoints and disable https ones. + - true: Enable http and https endpoints. + - only: Enable https endpoints and redirect http to https. +- acme_enable = false # Enable/Disable acme traefik support. +- acme_email = "test@traefik.io" # acme user email +- acme_ondemand = true # acme ondemand parameter. +- ssl_key # Paste your ssl key. *Required if you enable https +- ssl_crt # Paste your ssl crt. *Required if you enable https +- refresh_interval = 10s # Interval to refresh traefik rules.toml from rancher-metadata. + +### Service configuration labels: + +Traefik labels has to be added in your services, in order to get included in traefik dynamic config. + +- traefik.enable = + - true: the service will be published as *service_name.stack_name.traefik_domain* + - stack: the service will be published as *stack_name.traefik_domain*. WARNING: You could have collisions inside services within your stack + - false: the service will not be published +- traefik.domain = < domain > # Domain names to route rule. Multiple values separated by "," > +- traefik.port = < port > # Port to expose throught traefik +- traefik.acme = < true | false > # Enable/disable ACME traefik feature + +### Usage: + + Select Traefik from catalog. + + Set the params. + + Click deploy. + + Services will be accessed throught hosts ip's whith $host_label: + + - http://${service_name}.${stack_name}.${traefik.domain}:${http_port} + - https://${service_name}.${stack_name}.${traefik.domain}:${https_port} + + or + + - http://${stack_name}.${traefik.domain}:${http_port} + - https://${stack_name}.${traefik.domain}:${https_port} + +Note: To access the services, you need to create A or CNAMES dns entries for every one. diff --git a/templates/traefik/3/docker-compose.yml b/templates/traefik/3/docker-compose.yml new file mode 100644 index 0000000..4c013f2 --- /dev/null +++ b/templates/traefik/3/docker-compose.yml @@ -0,0 +1,38 @@ +traefik: + ports: + - ${admin_port}:8000/tcp + - ${http_port}:${http_port}/tcp + - ${https_port}:${https_port}/tcp + log_driver: '' + labels: + io.rancher.scheduler.global: 'true' + io.rancher.scheduler.affinity:host_label: ${host_label} + io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name} + io.rancher.sidekicks: traefik-conf + io.rancher.container.hostname_override: container_name + tty: true + log_opt: {} + image: rawmind/alpine-traefik:1.0.3 + environment: + - CONF_INTERVAL=${refresh_interval} + - TRAEFIK_HTTP_PORT=${http_port} + - TRAEFIK_HTTPS_PORT=${https_port} + - TRAEFIK_HTTPS_ENABLE=${https_enable} + - TRAEFIK_ACME_ENABLE=${acme_enable} + - TRAEFIK_ACME_EMAIL=${acme_email} + - TRAEFIK_ACME_ONDEMAND=${acme_ondemand} + volumes_from: + - traefik-conf +traefik-conf: + log_driver: '' + labels: + io.rancher.scheduler.global: 'true' + io.rancher.scheduler.affinity:host_label: ${host_label} + io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name} + io.rancher.container.start_once: 'true' + tty: true + log_opt: {} + image: rawmind/rancher-traefik:0.3.4-6 + net: none + volumes: + - /opt/tools diff --git a/templates/traefik/3/rancher-compose.yml b/templates/traefik/3/rancher-compose.yml new file mode 100644 index 0000000..3d2b8c5 --- /dev/null +++ b/templates/traefik/3/rancher-compose.yml @@ -0,0 +1,95 @@ +.catalog: + name: traefik + version: v1.0.3-rancher1 + description: | + (Experimental) Traefik load balancer. + minimum_rancher_version: v0.59.0 + maintainer: "Raul Sanchez " + uuid: traefik-0 + questions: + - variable: "host_label" + description: "Host label where to run traefik service." + label: "Host label:" + required: true + default: "traefik_lb=true" + type: "string" + - variable: "http_port" + description: "Traefik http public port to listen." + label: "Http port:" + required: true + default: 8080 + type: "int" + - variable: "https_port" + description: "Traefik https public port to listen." + label: "Https port:" + required: true + default: 8443 + type: "int" + - variable: "admin_port" + description: "Traefik admin public port to listen." + label: "Admin port:" + required: true + default: 8000 + type: "int" + - variable: "https_enable" + label: "Enable HTTPS:" + description: | + Enable https working mode. If you activate, you need to fill SSL key and SSL crt in order to work. + default: false + required: true + type: enum + options: + - false + - true + - only + - variable: "acme_enable" + description: "Enable acme support on traefik." + label: "Enable ACME:" + required: true + default: false + type: "boolean" + - variable: "acme_email" + description: "ACME user email." + label: "ACME email:" + required: true + default: "test@traefik.io" + type: "string" + - variable: "acme_ondemand" + description: "Enable acme ondemand." + label: "ACME ondemand:" + required: true + default: true + type: "boolean" + - variable: "ssl_key" + description: "SSL key to secure the service. *Required if you enable https" + label: "SSL key" + type: "multiline" + required: false + default: "" + - variable: "ssl_crt" + description: "SSL cert to secure the service. *Required if you enable https" + label: "SSL crt" + type: "multiline" + required: false + default: "" + - variable: "refresh_interval" + description: "Interval to poll/apply configuration changes." + label: "Refresh Interval (s):" + required: true + default: 10 + type: "int" +traefik: + retain_ip: true + health_check: + port: 8000 + interval: 5000 + unhealthy_threshold: 3 + request_line: 'GET /dashboard/# HTTP/1.0' + healthy_threshold: 2 + response_timeout: 5000 + metadata: + traefik: + ssl_key: | + ${ssl_key} + ssl_crt: | + ${ssl_crt} diff --git a/templates/traefik/config.yml b/templates/traefik/config.yml index 726db15..79e8a31 100644 --- a/templates/traefik/config.yml +++ b/templates/traefik/config.yml @@ -1,8 +1,9 @@ name: Traefik description: | (Experimental) Traefik active load balancer -version: v1.0.1-rancher1 +version: v1.0.3-rancher1 category: Load Balancing maintainer: "Raul Sanchez " minimum_rancher_version: v0.59.0 license: +projectURL: https://github.com/rawmind0/alpine-traefik diff --git a/templates/zookeeper/1/README.md b/templates/zookeeper/1/README.md index 7672d64..ee2b770 100644 --- a/templates/zookeeper/1/README.md +++ b/templates/zookeeper/1/README.md @@ -24,4 +24,4 @@ Zookeeper can now be accessed over the Rancher network. - Note: When you scale the cluster, zero downtime is not guaranteed..yet.. + Note: When you scale the cluster, zero downtime is expected... diff --git a/templates/zookeeper/1/docker-compose.yml b/templates/zookeeper/1/docker-compose.yml index 006ca7d..c6ecc9f 100644 --- a/templates/zookeeper/1/docker-compose.yml +++ b/templates/zookeeper/1/docker-compose.yml @@ -1,6 +1,6 @@ zk: tty: true - image: rawmind/alpine-zk:3.4.8-4 + image: rawmind/alpine-zk:3.4.8-16 volumes_from: - zk-volume - zk-conf @@ -21,7 +21,9 @@ zk-conf: io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name} io.rancher.container.hostname_override: container_name io.rancher.container.start_once: true - image: rawmind/rancher-zk:0.3.3 + image: rawmind/rancher-zk:3.4.8-5 + volumes: + - /opt/tools zk-volume: net: none labels: @@ -29,12 +31,10 @@ zk-volume: io.rancher.container.hostname_override: container_name io.rancher.container.start_once: true environment: - - SERVICE_USER=zookeeper - SERVICE_UID=10002 - - SERVICE_GROUP=zookeeper - SERVICE_GID=10002 - SERVICE_VOLUME=${zk_data_dir} volumes: - ${zk_data_dir} volume_driver: local - image: rawmind/alpine-volume:0.0.1-1 + image: rawmind/alpine-volume:0.0.2-1 diff --git a/templates/zookeeper/config.yml b/templates/zookeeper/config.yml index 5d83443..7415da5 100644 --- a/templates/zookeeper/config.yml +++ b/templates/zookeeper/config.yml @@ -4,5 +4,5 @@ description: | version: 3.4.8-rancher1 category: Clustering maintainer: "Raul Sanchez " -minimum_rancher_version: v0.59.0 -license: +projectURL: https://github.com/rawmind0/alpine-zk +license: \ No newline at end of file