|
1 | 1 | version: '2' |
2 | 2 |
|
3 | 3 | services: |
4 | | - master: |
5 | | - image: redis:${REDIS_VERSION}-alpine |
| 4 | + redis-server: |
| 5 | + image: ${REDIS_VERSION} |
6 | 6 | environment: |
7 | 7 | REDIS_PASSWORD: '${REDIS_PASSWORD}' |
8 | 8 | stdin_open: true |
9 | | - volumes: |
10 | | - - redis-master:/data |
11 | 9 | tty: true |
12 | | - command: |
13 | | - - redis-server |
14 | | - - --appendonly |
15 | | - - 'yes' |
16 | | - - --masterauth |
17 | | - - '${REDIS_PASSWORD}' |
18 | | - - --requirepass |
19 | | - - '${REDIS_PASSWORD}' |
20 | 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.start_once: 'true' |
21 | 15 | io.rancher.container.pull_image: always |
22 | | - io.rancher.scheduler.affinity:host_label: '${REDIS_MASTER_HOST_LABEL}' |
| 16 | + io.rancher.sidekicks: redis-server-config |
23 | 17 | 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 |
| 18 | + io.rancher.container.hostname_override: container_name |
| 19 | + volumes_from: |
| 20 | + - redis-server-config |
| 21 | + entrypoint: /opt/redis/scripts/server-entrypoint.sh |
33 | 22 | 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} |
| 23 | + - "redis-server" |
| 24 | + - "/usr/local/etc/redis/redis.conf" |
48 | 25 |
|
49 | | - sentinel: |
50 | | - image: lgatica/redis-sentinel:${REDIS_VERSION} |
| 26 | + redis-sentinel: |
| 27 | + image: ${REDIS_VERSION} |
51 | 28 | environment: |
52 | 29 | REDIS_PASSWORD: '${REDIS_PASSWORD}' |
| 30 | + SENTINEL_QUORUM: '${SENTINEL_QUORUM}' |
| 31 | + SENTINEL_DOWN_AFTER: '${SENTINEL_DOWN_AFTER}' |
| 32 | + SENTINEL_FAILOVER: '${SENTINEL_FAILOVER}' |
53 | 33 | stdin_open: true |
54 | 34 | tty: true |
55 | | - links: |
56 | | - - master:master |
57 | | - ports: |
58 | | - - '${REDIS_SENTINEL_PORT}':26379/tcp |
59 | 35 | labels: |
60 | 36 | 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} |
| 37 | + {{- if ne .Values.REDIS_SENTINEL_HOST_LABEL ""}} |
| 38 | + io.rancher.scheduler.affinity:host_label: ${REDIS_SENTINEL_HOST_LABEL} |
| 39 | + {{- end}} |
| 40 | + io.rancher.sidekicks: redis-sentinel-config |
| 41 | + io.rancher.container.hostname_override: container_name |
| 42 | + volumes_from: |
| 43 | + - redis-sentinel-config |
| 44 | + entrypoint: /opt/redis/scripts/sentinel-entrypoint.sh |
| 45 | + command: |
| 46 | + - "redis-server" |
| 47 | + - "/usr/local/etc/redis/sentinel.conf" |
| 48 | + - "--sentinel" |
63 | 49 |
|
64 | 50 | haproxy: |
65 | 51 | image: rancher/lb-service-haproxy:v0.7.9 |
66 | 52 | ports: |
67 | | - - '${REDIS_HAPROXY_PORT}':6379/tcp |
| 53 | + - ${REDIS_HAPROXY_PORT}:6379/tcp |
68 | 54 | labels: |
69 | | - io.rancher.scheduler.affinity:host_label: '${REDIS_SENTINEL_HOST_LABEL}' |
| 55 | + {{- if ne .Values.REDIS_SENTINEL_HOST_LABEL ""}} |
| 56 | + io.rancher.scheduler.affinity:host_label: ${REDIS_SENTINEL_HOST_LABEL} |
| 57 | + {{- end}} |
70 | 58 | io.rancher.container.agent.role: environmentAdmin |
71 | 59 | io.rancher.container.create_agent: 'true' |
72 | 60 |
|
| 61 | + redis-server-config: |
| 62 | + image: lgatica/redis-config |
| 63 | + environment: |
| 64 | + REDIS_PASSWORD: '${REDIS_PASSWORD}' |
| 65 | + stdin_open: true |
| 66 | + tty: true |
| 67 | + volumes: |
| 68 | + - /usr/local/etc/redis |
| 69 | + - /opt/redis/scripts |
| 70 | + - redis-server:/data |
| 71 | + labels: |
| 72 | + io.rancher.container.pull_image: always |
| 73 | + io.rancher.container.hostname_override: container_name |
| 74 | + redis-sentinel-config: |
| 75 | + image: lgatica/redis-config |
| 76 | + environment: |
| 77 | + REDIS_PASSWORD: '${REDIS_PASSWORD}' |
| 78 | + stdin_open: true |
| 79 | + tty: true |
| 80 | + volumes: |
| 81 | + - /usr/local/etc/redis |
| 82 | + - /opt/redis/scripts |
| 83 | + - redis-sentinel:/data |
| 84 | + labels: |
| 85 | + io.rancher.container.pull_image: always |
| 86 | + io.rancher.container.hostname_override: container_name |
| 87 | + |
| 88 | +{{- if or (.Values.REDIS_VOLUME_NAME) (.Values.SENTINEL_VOLUME_NAME)}} |
73 | 89 | volumes: |
74 | | - redis-master: |
75 | | - external: true |
| 90 | + {{- if .Values.REDIS_VOLUME_NAME}} |
| 91 | + {{.Values.REDIS_VOLUME_NAME}}: |
76 | 92 | per_container: true |
77 | | - driver: '${VOLUME_DRIVER}' |
78 | | - driver_opts: |
79 | | - size: '${VOLUME_DRIVER_SIZE}' |
80 | | - volumeType: '${VOLUME_DRIVER_TYPE}' |
81 | | - ec2_az: '${VOLUME_DRIVER_AZ}' |
82 | | - iops: '${VOLUME_DRIVER_IOPS}' |
| 93 | + {{- if .Values.STORAGE_DRIVER}} |
| 94 | + driver: {{.Values.STORAGE_DRIVER}} |
| 95 | + {{- end}} |
| 96 | + {{- end}} |
83 | 97 |
|
84 | | - redis-slave: |
85 | | - external: true |
| 98 | + {{- if .Values.SENTINEL_VOLUME_NAME}} |
| 99 | + {{.Values.SENTINEL_VOLUME_NAME}}: |
86 | 100 | per_container: true |
87 | | - driver: '${VOLUME_DRIVER}' |
88 | | - driver_opts: |
89 | | - size: '${VOLUME_DRIVER_SIZE}' |
90 | | - volumeType: '${VOLUME_DRIVER_TYPE}' |
91 | | - ec2_az: '${VOLUME_DRIVER_AZ}' |
92 | | - iops: '${VOLUME_DRIVER_IOPS}' |
| 101 | + {{- if .Values.STORAGE_DRIVER}} |
| 102 | + driver: {{.Values.STORAGE_DRIVER}} |
| 103 | + {{- end}} |
| 104 | + {{- end}} |
| 105 | +{{- end }} |
0 commit comments