diff --git a/docker/valkey/valkey-base/Dockerfile.j2 b/docker/valkey/valkey-base/Dockerfile.j2 new file mode 100644 index 0000000000..7d4e6da9a0 --- /dev/null +++ b/docker/valkey/valkey-base/Dockerfile.j2 @@ -0,0 +1,17 @@ +FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }} +{% block labels %} +LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" +{% endblock %} + +{% block valkey_base_header %}{% endblock %} + +{% import "macros.j2" as macros with context %} + +{{ macros.configure_user(name='valkey', homedir='/run/valkey') }} + +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 644 /usr/local/bin/kolla_extend_start + +{{ macros.kolla_patch_sources() }} + +{% block valkey_base_footer %}{% endblock %} diff --git a/docker/valkey/valkey-base/extend_start.sh b/docker/valkey/valkey-base/extend_start.sh new file mode 100644 index 0000000000..3a3a321d4e --- /dev/null +++ b/docker/valkey/valkey-base/extend_start.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [[ ! -d "/var/log/kolla/valkey" ]]; then + mkdir -p /var/log/kolla/valkey +fi + +if [[ $(stat -c %a /var/log/kolla/valkey) != "755" ]]; then + chmod 755 /var/log/kolla/valkey +fi diff --git a/docker/valkey/valkey-sentinel/Dockerfile.j2 b/docker/valkey/valkey-sentinel/Dockerfile.j2 new file mode 100644 index 0000000000..9cdfac282f --- /dev/null +++ b/docker/valkey/valkey-sentinel/Dockerfile.j2 @@ -0,0 +1,26 @@ +FROM {{ namespace }}/{{ image_prefix }}valkey-base:{{ tag }} +{% block labels %} +LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" +{% endblock %} + +{% block valkey_sentinel_header %}{% endblock %} + +{% import "macros.j2" as macros with context %} + +{% if base_package_type == 'rpm' %} +{{ macros.enable_extra_repos(['epel']) }} + {% set valkey_sentinel_packages = ['valkey'] %} +{% elif base_package_type == 'deb' %} + {% set valkey_sentinel_packages = ['valkey-sentinel'] %} +{% endif %} +{{ macros.install_packages(valkey_sentinel_packages | customizable("packages")) }} + +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 644 /usr/local/bin/kolla_extend_start + +{{ macros.kolla_patch_sources() }} + +{% block valkey_sentinel_footer %}{% endblock %} +{% block footer %}{% endblock %} + +USER valkey diff --git a/docker/valkey/valkey-sentinel/extend_start.sh b/docker/valkey/valkey-sentinel/extend_start.sh new file mode 100644 index 0000000000..e6af42ef6b --- /dev/null +++ b/docker/valkey/valkey-sentinel/extend_start.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +if [[ ! -d "/var/log/kolla/valkey" ]]; then + mkdir -p /var/log/kolla/valkey +fi + +if [[ $(stat -c %a /var/log/kolla/valkey) != "755" ]]; then + chmod 755 /var/log/kolla/valkey +fi + +# The CONFIG REWRITE command rewrites the valkey.conf +# file the server was started with, applying the minimal +# changes needed to make it reflect the configuration +# currently used by the server, which may be different +# compared to the original one because of the use of +# the CONFIG SET command. +# +# https://valkey.io/commands/config-rewrite/ +# +# Because of above behaviour it's needed to +# hack kolla's CMD. +# +# Without this hack +# /usr/local/bin/kolla_set_configs --check +# is always reporting changed. +# +# Therefore valkey-sentinel is always restarted +# even if configuration is not changed from +# kolla-ansible side. +if [ ! -z "${VALKEY_CONF}" ] && [ ! -z ${VALKEY_GEN_CONF} ]; then + cp ${VALKEY_CONF} ${VALKEY_GEN_CONF} +fi diff --git a/docker/valkey/valkey-server/Dockerfile.j2 b/docker/valkey/valkey-server/Dockerfile.j2 new file mode 100644 index 0000000000..046260d7bf --- /dev/null +++ b/docker/valkey/valkey-server/Dockerfile.j2 @@ -0,0 +1,23 @@ +FROM {{ namespace }}/{{ image_prefix }}valkey-base:{{ tag }} +{% block labels %} +LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" +{% endblock %} + +{% block valkey_server_header %}{% endblock %} + +{% import "macros.j2" as macros with context %} + +{% if base_package_type == 'rpm' %} +{{ macros.enable_extra_repos(['epel']) }} + {% set valkey_server_packages = ['valkey'] %} +{% elif base_package_type == 'deb' %} + {% set valkey_server_packages = ['valkey'] %} +{% endif %} +{{ macros.install_packages(valkey_server_packages | customizable("packages")) }} + +{{ macros.kolla_patch_sources() }} + +{% block valkey_server_footer %}{% endblock %} +{% block footer %}{% endblock %} + +USER valkey diff --git a/kolla/common/users.py b/kolla/common/users.py index 9468396e42..878022e48d 100644 --- a/kolla/common/users.py +++ b/kolla/common/users.py @@ -345,5 +345,9 @@ 'hsmusers-user': { 'uid': 42493, # This is not used, but the group ID is required. 'gid': 42493, - } + }, + 'valkey-user': { + 'uid': 42494, + 'gid': 42494, + }, } diff --git a/kolla/image/unbuildable.py b/kolla/image/unbuildable.py index 9a75bfe611..17a7ea7c6b 100644 --- a/kolla/image/unbuildable.py +++ b/kolla/image/unbuildable.py @@ -28,6 +28,10 @@ "tgtd", # Not supported on CentOS }, + 'centos+stream9': { + "valkey-base" # Not supported on Stream 9 + }, + 'centos+stream10': { "collectd", # No opstools repo for EL10 "redis-base", # No redis repo for EL10 @@ -47,6 +51,10 @@ "tgtd", # Not supported on CentOS }, + 'rocky+9': { + "valkey-base" # Not supported on Rocky 9 + }, + 'rocky+10': { "redis-base", # No Redis in EL10 "telegraf" # Missing opstools repo