Skip to content

Commit 239d81c

Browse files
committed
first commit
0 parents  commit 239d81c

File tree

7 files changed

+236
-0
lines changed

7 files changed

+236
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Redis Sentinel Cluster Rancher
2+
3+
Rancher template for Redis Sentinel Cluster
4+
5+
## Install
6+
7+
In Rancher's UI, go to **Admin/Settings** and add a new custom catalog:
8+
9+
| Name | URL | Branch |
10+
| --------------- | ----------------------------------------------------- | ------ |
11+
| MongoDB Sharded | https://github.com/lgaticaq/redis-cluster-rancher.git | master |
12+
13+
## Templates
14+
15+
* **redis**: Redis Sentinel Cluster for production environment

renovate.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["config:base", ":docker"]
3+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
version: '2'
2+
3+
services:
4+
master:
5+
image: redis:${REDIS_VERSION}-alpine
6+
environment:
7+
REDIS_PASSWORD: '${REDIS_PASSWORD}'
8+
stdin_open: true
9+
volumes:
10+
- redis-master:/data
11+
tty: true
12+
command:
13+
- redis-server
14+
- --appendonly
15+
- 'yes'
16+
- --masterauth
17+
- '${REDIS_PASSWORD}'
18+
- --requirepass
19+
- '${REDIS_PASSWORD}'
20+
labels:
21+
io.rancher.container.pull_image: always
22+
io.rancher.scheduler.affinity:host_label: '${REDIS_MASTER_HOST_LABEL}'
23+
io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
24+
25+
slave:
26+
image: redis:${REDIS_VERSION}-alpine
27+
environment:
28+
REDIS_PASSWORD: '${REDIS_PASSWORD}'
29+
stdin_open: true
30+
volumes:
31+
- redis-slave:/data
32+
tty: true
33+
command:
34+
- redis-server
35+
- --appendonly
36+
- 'yes'
37+
- --slaveof
38+
- master
39+
- '6379'
40+
- --masterauth
41+
- '${REDIS_PASSWORD}'
42+
- --requirepass
43+
- '${REDIS_PASSWORD}'
44+
labels:
45+
io.rancher.container.pull_image: always
46+
io.rancher.scheduler.affinity:host_label: '${REDIS_SLAVE_HOST_LABEL}'
47+
io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
48+
49+
sentinel:
50+
image: lgatica/redis-sentinel:${REDIS_VERSION}
51+
environment:
52+
REDIS_PASSWORD: '${REDIS_PASSWORD}'
53+
stdin_open: true
54+
tty: true
55+
links:
56+
- master:master
57+
ports:
58+
- '${REDIS_SENTINEL_PORT}':26379/tcp
59+
labels:
60+
io.rancher.container.pull_image: always
61+
io.rancher.scheduler.affinity:host_label: '${REDIS_SENTINEL_HOST_LABEL}'
62+
io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
63+
64+
haproxy:
65+
image: rancher/lb-service-haproxy:v0.7.9
66+
ports:
67+
- '${REDIS_HAPROXY_PORT}':6379/tcp
68+
labels:
69+
io.rancher.scheduler.affinity:host_label: '${REDIS_SENTINEL_HOST_LABEL}'
70+
io.rancher.container.agent.role: environmentAdmin
71+
io.rancher.container.create_agent: 'true'
72+
73+
volumes:
74+
redis-master:
75+
external: true
76+
driver: rancher-ebs
77+
driver_opts:
78+
size: '${VOLUME_DRIVER_SIZE}'
79+
volumeType: '${VOLUME_DRIVER_TYPE}'
80+
ec2_az: '${VOLUME_DRIVER_AZ}'
81+
iops: '${VOLUME_DRIVER_IOPS}'
82+
83+
redis-slave:
84+
external: true
85+
driver: rancher-ebs
86+
driver_opts:
87+
size: '${VOLUME_DRIVER_SIZE}'
88+
volumeType: '${VOLUME_DRIVER_TYPE}'
89+
ec2_az: '${VOLUME_DRIVER_AZ}'
90+
iops: '${VOLUME_DRIVER_IOPS}'
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
.catalog:
2+
name: "Redis Cluster"
3+
version: "v1.0.0"
4+
description: |
5+
Redis Sentinel Cluster
6+
questions:
7+
- variable: REDIS_VERSION
8+
type: enum
9+
options:
10+
- "4.0"
11+
- "3.2"
12+
required: true
13+
label: "REdis version"
14+
- variable: REDIS_PASSWORD
15+
type: password
16+
required: true
17+
label: "Redis auth password"
18+
- variable: REDIS_HAPROXY_PORT
19+
type: int
20+
required: true
21+
default: 6379
22+
label: "Redis port"
23+
- variable: REDIS_SENTINEL_PORT
24+
type: int
25+
required: true
26+
default: 26379
27+
label: "Sentinel port"
28+
- variable: REDIS_MASTER_HOST_LABEL
29+
type: string
30+
required: true
31+
default: "redis=master"
32+
label: "Host label for master node"
33+
- variable: REDIS_SLAVE_HOST_LABEL
34+
type: string
35+
required: true
36+
default: "redis=slave"
37+
label: "Host label for slave node"
38+
- variable: REDIS_SENTINEL_HOST_LABEL
39+
type: string
40+
required: true
41+
default: "redis=sentinel"
42+
label: "Host label for sentinel and lb nodes"
43+
- variable: VOLUME_DRIVER_SIZE
44+
type: int
45+
required: true
46+
default: 10
47+
label: "Size of the EBS volume"
48+
- variable: VOLUME_DRIVER_TYPE
49+
type: string
50+
required: true
51+
default: "gp2"
52+
label: "Type of volume"
53+
- variable: VOLUME_DRIVER_AZ
54+
type: string
55+
required: true
56+
default: "us-east-1a"
57+
label: "The specific availability zone to create containers and EBS volume"
58+
- variable: VOLUME_DRIVER_IOPS
59+
type: int
60+
required: true
61+
default: 3000
62+
label: "IOPS option"
63+
64+
version: '2'
65+
services:
66+
slave:
67+
scale: 1
68+
start_on_create: true
69+
sentinel:
70+
scale: 1
71+
start_on_create: true
72+
haproxy:
73+
scale: 1
74+
start_on_create: true
75+
lb_config:
76+
certs: []
77+
config: "default\n\tmode tcp\n\ttimeout connect 3s\n\ttimeout server 6s\n\t\
78+
timeout client 6s\n\nbackend 6379_\n\toption tcplog\n\toption tcp-check\n\t\
79+
tcp-check send AUTH\\ ${REDIS_PASSWORD}\\r\\n\n\ttcp-check\
80+
\ expect string +OK\n\ttcp-check send PING\\r\\n\n\ttcp-check expect string\
81+
\ +PONG\n\ttcp-check send info\\ replication\\r\\n\n\ttcp-check expect string\
82+
\ role:master\n\ttcp-check send QUIT\\r\\n\n\ttcp-check expect string +OK"
83+
port_rules:
84+
- priority: 1
85+
protocol: tcp
86+
service: master
87+
source_port: 6379
88+
target_port: 6379
89+
- priority: 2
90+
protocol: tcp
91+
service: slave
92+
source_port: 6379
93+
target_port: 6379
94+
health_check:
95+
healthy_threshold: 2
96+
response_timeout: 2000
97+
port: 42
98+
unhealthy_threshold: 3
99+
initializing_timeout: 60000
100+
interval: 2000
101+
reinitializing_timeout: 60000
102+
master:
103+
scale: 1
104+
start_on_create: true
Lines changed: 3 additions & 0 deletions
Loading

templates/redis/config.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Redis Cluster
2+
description: |
3+
Redis Sentinel Cluster
4+
version: v1.0.0
5+
category: Databases
6+
maintainer: Leonardo Gatica <lgatica@protonmail.com>
7+
projectURL: http://github.com/lgaticaq/redis-cluster-rancher
8+
labels:
9+
io.rancher.orchestration.supported: 'cattle,swarm'

0 commit comments

Comments
 (0)