Add Redis Sentinel

Introduce base container for redis

Rebase the existing redis container on the new base container

Provide a container for redis-sentinel to create a highly available cluster

Change-Id: I683f02930a870c01dbc71c84060a65c72a8e568e
This commit is contained in:
Mathias Ewald 2017-07-21 11:04:43 +00:00
parent 8cfdd01ec2
commit 4f903087e6
5 changed files with 44 additions and 3 deletions

View File

@ -0,0 +1,13 @@
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block redis_base_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{{ macros.configure_user(name='redis', homedir='/run/redis') }}
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 755 /usr/local/bin/kolla_extend_start
{% block redis_base_footer %}{% endblock %}

View File

@ -0,0 +1,9 @@
#!/bin/bash
if [[ ! -d "/var/log/kolla/redis" ]]; then
mkdir -p /var/log/kolla/redis
fi
if [[ $(stat -c %a /var/log/kolla/redis) != "755" ]]; then
chmod 755 /var/log/kolla/redis
fi

View File

@ -0,0 +1,18 @@
FROM {{ namespace }}/{{ image_prefix }}redis-base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block redis_sentinel_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set redis_sentinel_packages = ['redis'] %}
{% elif base_distro in ['debian', 'ubuntu'] %}
{% set redis_sentinel_packages = ['redis-sentinel'] %}
{% endif %}
{{ macros.install_packages(redis_sentinel_packages | customizable("packages")) }}
{% block redis_sentinel_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER redis

View File

@ -1,12 +1,10 @@
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }} FROM {{ namespace }}/{{ image_prefix }}redis-base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block redis_header %}{% endblock %} {% block redis_header %}{% endblock %}
{% import "macros.j2" as macros with context %} {% import "macros.j2" as macros with context %}
{{ macros.configure_user(name='redis', homedir='/run/redis') }}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %} {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set redis_packages = ['redis'] %} {% set redis_packages = ['redis'] %}
{% elif base_distro in ['debian', 'ubuntu'] %} {% elif base_distro in ['debian', 'ubuntu'] %}

View File

@ -0,0 +1,3 @@
---
features:
- Add a redis-sentinel image to deploy highly available redis clusters