Skip to content

Commit afdb466

Browse files
committed
fix(config): update redis-config image
1 parent bac2945 commit afdb466

File tree

2 files changed

+237
-0
lines changed

2 files changed

+237
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
version: '2'
2+
3+
services:
4+
redis:
5+
image: ${REDIS_VERSION}
6+
environment:
7+
REDIS_PASSWORD: '${REDIS_PASSWORD}'
8+
stdin_open: true
9+
tty: true
10+
labels:
11+
{{- if ne .Values.REDIS_SERVER_HOST_LABEL ""}}
12+
io.rancher.scheduler.affinity:host_label: ${REDIS_SERVER_HOST_LABEL}
13+
{{- end}}
14+
io.rancher.container.pull_image: always
15+
io.rancher.sidekicks: redis-config{{- if ne .Values.REDIS_VOLUME_PATH ""}}, redis-data{{- end}}
16+
io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
17+
io.rancher.container.hostname_override: container_name
18+
volumes_from:
19+
- redis-config
20+
{{- if ne .Values.REDIS_VOLUME_PATH ""}}
21+
- redis-data
22+
{{- end}}
23+
entrypoint: /opt/redis/scripts/server-entrypoint.sh
24+
command:
25+
- "redis-server"
26+
- "/usr/local/etc/redis/redis.conf"
27+
28+
sentinel:
29+
image: ${REDIS_VERSION}
30+
environment:
31+
REDIS_PASSWORD: '${REDIS_PASSWORD}'
32+
SENTINEL_QUORUM: '${SENTINEL_QUORUM}'
33+
SENTINEL_DOWN_AFTER: '${SENTINEL_DOWN_AFTER}'
34+
SENTINEL_FAILOVER: '${SENTINEL_FAILOVER}'
35+
stdin_open: true
36+
tty: true
37+
labels:
38+
io.rancher.container.pull_image: always
39+
{{- if ne .Values.REDIS_SENTINEL_HOST_LABEL ""}}
40+
io.rancher.scheduler.affinity:host_label: ${REDIS_SENTINEL_HOST_LABEL}
41+
{{- end}}
42+
io.rancher.sidekicks: sentinel-config{{- if ne .Values.SENTINEL_VOLUME_PATH ""}}, sentinel-data{{- end}}
43+
io.rancher.container.hostname_override: container_name
44+
volumes_from:
45+
- sentinel-config
46+
{{- if ne .Values.SENTINEL_VOLUME_PATH ""}}
47+
- sentinel-data
48+
{{- end}}
49+
entrypoint: /opt/redis/scripts/sentinel-entrypoint.sh
50+
command:
51+
- "redis-server"
52+
- "/usr/local/etc/redis/sentinel.conf"
53+
- "--sentinel"
54+
55+
redis-lb:
56+
image: rancher/lb-service-haproxy:v0.7.9
57+
ports:
58+
- ${REDIS_HAPROXY_PORT}:6379/tcp
59+
labels:
60+
{{- if ne .Values.REDIS_SENTINEL_HOST_LABEL ""}}
61+
io.rancher.scheduler.affinity:host_label: ${REDIS_SENTINEL_HOST_LABEL}
62+
{{- end}}
63+
io.rancher.container.agent.role: environmentAdmin
64+
io.rancher.container.create_agent: 'true'
65+
66+
redis-config:
67+
image: lgatica/redis-config:1.0.0
68+
environment:
69+
REDIS_PASSWORD: '${REDIS_PASSWORD}'
70+
stdin_open: true
71+
tty: true
72+
volumes:
73+
- /usr/local/etc/redis
74+
- /opt/redis/scripts
75+
labels:
76+
{{- if ne .Values.REDIS_SERVER_HOST_LABEL ""}}
77+
io.rancher.scheduler.affinity:host_label: ${REDIS_SERVER_HOST_LABEL}
78+
{{- end}}
79+
io.rancher.container.pull_image: always
80+
io.rancher.container.hostname_override: container_name
81+
io.rancher.container.start_once: 'true'
82+
entrypoint: /bin/true
83+
84+
sentinel-config:
85+
image: lgatica/redis-config:1.0.0
86+
environment:
87+
REDIS_PASSWORD: '${REDIS_PASSWORD}'
88+
stdin_open: true
89+
tty: true
90+
volumes:
91+
- /usr/local/etc/redis
92+
- /opt/redis/scripts
93+
labels:
94+
{{- if ne .Values.REDIS_SENTINEL_HOST_LABEL ""}}
95+
io.rancher.scheduler.affinity:host_label: ${REDIS_SENTINEL_HOST_LABEL}
96+
{{- end}}
97+
io.rancher.container.pull_image: always
98+
io.rancher.container.hostname_override: container_name
99+
io.rancher.container.start_once: 'true'
100+
entrypoint: /bin/true
101+
102+
{{- if .Values.REDIS_VOLUME_PATH}}
103+
redis-data:
104+
image: busybox
105+
labels:
106+
{{- if ne .Values.REDIS_SERVER_HOST_LABEL ""}}
107+
io.rancher.scheduler.affinity:host_label: ${REDIS_SERVER_HOST_LABEL}
108+
{{- end}}
109+
io.rancher.container.hostname_override: container_name
110+
io.rancher.container.start_once: 'true'
111+
volumes:
112+
- {{.Values.REDIS_VOLUME_PATH}}:/data
113+
entrypoint: /bin/true
114+
{{- end}}
115+
116+
{{- if .Values.SENTINEL_VOLUME_PATH}}
117+
sentinel-data:
118+
image: busybox
119+
labels:
120+
{{- if ne .Values.REDIS_SENTINEL_HOST_LABEL ""}}
121+
io.rancher.scheduler.affinity:host_label: ${REDIS_SENTINEL_HOST_LABEL}
122+
{{- end}}
123+
io.rancher.container.hostname_override: container_name
124+
io.rancher.container.start_once: 'true'
125+
volumes:
126+
- {{.Values.SENTINEL_VOLUME_PATH}}:/data
127+
entrypoint: /bin/true
128+
{{- end}}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
.catalog:
3+
name: "Redis Cluster"
4+
version: "v1.0.1"
5+
description: |
6+
Redis Sentinel Cluster
7+
questions:
8+
- variable: REDIS_VERSION
9+
label: "Redis version"
10+
type: enum
11+
options:
12+
- redis:4.0.2-alpine
13+
- redis:3.2.11-alpine
14+
default: redis:4.0.2-alpine
15+
required: true
16+
- variable: REDIS_PASSWORD
17+
label: "Redis auth password"
18+
type: password
19+
required: true
20+
- variable: REDIS_NODES
21+
label: Number of redis nodes
22+
description: Number of Redis server nodes to launch.
23+
type: int
24+
default: 1
25+
required: true
26+
- variable: REDIS_HAPROXY_PORT
27+
label: "Redis port"
28+
type: int
29+
default: 6379
30+
required: true
31+
- variable: REDIS_SERVER_HOST_LABEL
32+
label: "Host label for redis server node (Optional)"
33+
type: string
34+
required: false
35+
- variable: REDIS_SENTINEL_HOST_LABEL
36+
label: "Host label for sentinel and lb (Optional)"
37+
type: string
38+
required: false
39+
- variable: SENTINEL_QUORUM
40+
label: Sentinel quorum
41+
description: |
42+
The number of Sentinel processes that need to detect an error condition in order for a master to be flagged as ODOWN
43+
type: int
44+
default: 2
45+
required: true
46+
- variable: SENTINEL_DOWN_AFTER
47+
label: Sentinel down-after-milliseconds
48+
description: |
49+
The time in milliseconds an instance should not be reachable for a Sentinel starting to think it is down.
50+
type: int
51+
default: 1000
52+
required: true
53+
- variable: SENTINEL_FAILOVER
54+
label: Sentinel failover-timeout
55+
description: The time to failover the same master again.
56+
type: int
57+
default: 1000
58+
required: true
59+
- variable: REDIS_VOLUME_PATH
60+
label: Volume Name of server nodes (Optional)
61+
description: To store the redis data.
62+
type: string
63+
required: false
64+
- variable: SENTINEL_VOLUME_PATH
65+
label: Volume Name of sentinel nodes (Optional)
66+
description: To store the sentinel data.
67+
type: string
68+
required: false
69+
70+
version: '2'
71+
services:
72+
sentinel:
73+
scale: 1
74+
retain_ip: true
75+
redis-lb:
76+
scale: 1
77+
retain_ip: true
78+
lb_config:
79+
certs: []
80+
config: |-
81+
backend redis
82+
option tcplog
83+
option tcp-check
84+
tcp-check send AUTH\ ${REDIS_PASSWORD}\r\n
85+
tcp-check expect string +OK
86+
tcp-check send PING\r\n
87+
tcp-check expect string +PONG
88+
tcp-check send info\ replication\r\n
89+
tcp-check expect string role:master
90+
tcp-check send QUIT\r\n
91+
tcp-check expect string +OK
92+
port_rules:
93+
- priority: 1
94+
protocol: tcp
95+
service: redis
96+
source_port: ${REDIS_HAPROXY_PORT}
97+
target_port: 6379
98+
health_check:
99+
healthy_threshold: 2
100+
response_timeout: 2000
101+
port: 42
102+
unhealthy_threshold: 3
103+
initializing_timeout: 60000
104+
interval: 2000
105+
strategy: recreate
106+
reinitializing_timeout: 60000
107+
redis:
108+
scale: ${REDIS_NODES}
109+
retain_ip: true

0 commit comments

Comments
 (0)