Replace redis with valkey

This commit is contained in:
Daniel Berteaud 2024-04-11 22:56:10 +02:00
parent d34520c6a2
commit 39608e58d7
7 changed files with 51 additions and 69 deletions

View File

@ -81,12 +81,6 @@ job "base_images" {
image = "danielberteaud/pgbouncer:24.4-1"
}
}
task "pgcat" {
driver = "docker"
config {
image = "danielberteaud/pgcat:1.1.1-1"
}
}
task "php82" {
driver = "docker"
config {
@ -117,6 +111,12 @@ job "base_images" {
image = "danielberteaud/sqlite:24.4-1"
}
}
task "valkey" {
driver = "docker"
config {
image = "danielberteaud/valkey:24.4-1"
}
}
task "wait_for" {
driver = "docker"
config {

View File

@ -9,7 +9,7 @@ ARG JMX_EXPORTER_VERSION=0.19.0
ENV MINIT_LOG_DIR=none \
LANG=fr_FR.utf8 \
TZ=Europe/Paris \
JVM_XMX_RATIO=0.3
JVM_XMX_RATIO=0.25
ADD https://git.lapiole.org/nomad/base_tools.git#master /
RUN set -euxo pipefail &&\

View File

@ -63,7 +63,20 @@ if [ -n "${TMPDIR}" ]; then
JAVA_OPTS="$JAVA_OPTS -Djava.io.tmpdir=${TMPDIR}"
fi
JAVA_OPTS="${JAVA_OPTS} -Xshare:off -Djava.awt.headless=true -Dfile.encoding=UTF8"
JAVA_OPTS="${JAVA_OPTS:-} -Djava.awt.headless=true -Dfile.encoding=UTF8"
# Disable class sharing (as only one JVM is running within a container)
JAVA_OPTS="${JAVA_OPTS} -Xshare:off"
# Enable container detection suport from JVM
JAVA_OPTS="${JAVA_OPTS} -XX:+UseContainerSupport"
# Enable Native memory tracking
JAVA_OPTS="${JAVA_OPTS} -XX:NativeMemoryTracking=summary"
# Force container to stop on OOM
JAVA_OPTS="${JAVA_OPTS} -XX:+ExitOnOutOfMemoryError"
if [ -z "${JVM_XMX}" ]; then
export JVM_XMX=$(printf "%.0f" $(echo $(get_max_mem)*${JVM_XMX_RATIO} | bc))m
@ -123,7 +136,7 @@ if [ -n "${NO_PROXY}" ]; then
done
# Remove leading |
JAVA_NO_PROXY=$(echo -n ${JAVA_NO_PROXY} | sed -E 's/^\|//')
JAVA_OPTS="${JAVA_OPTS} -Dhttp.nonProxyHosts='${JAVA_NO_PROXY}'"
JAVA_OPTS="${JAVA_OPTS} -Dhttp.nonProxyHosts=${JAVA_NO_PROXY}"
fi
echo "JAVA_OPTS=${JAVA_OPTS}"

View File

@ -1,34 +0,0 @@
FROM rust:alpine AS builder
ARG PGCAT_VERSION=1.1.1
RUN set -euxo pipefail &&\
apk --no-cache upgrade &&\
apk --no-cache add \
git \
musl-dev \
build-base \
&&\
cd /tmp &&\
git clone --branch=v${PGCAT_VERSION} --depth=1 https://github.com/postgresml/pgcat.git &&\
cd pgcat &&\
cargo build --release
FROM danielberteaud/alpine:24.4-1
MAINTAINER Daniel Berteaud <dbd@ehtrace.com>
ENV PGCAT_CONF_DIR=/etc/pgcat \
LANG=fr_FR.utf8 \
TZ=Europe/Paris \
RUST_LOG=info
RUN set -euxo pipefail &&\
addgroup -g 6432 pgcat &&\
adduser --system --ingroup pgcat --disabled-password --uid 6432 --home /tmp --shell /sbin/nologin pgcat
COPY --from=builder /tmp/pgcat/target/release/pgcat /usr/local/bin/pgcat
COPY --from=builder /tmp/pgcat/pgcat.toml /etc/pgcat/pgcat.toml
USER pgcat
WORKDIR ${PGCAT_CONF_DIR}
CMD ["pgcat"]

View File

@ -207,25 +207,6 @@ function build_pgbouncer {
fi
IMAGE_PGBOUNCER_AVAILABLE=1
}
function build_pgcat {
if [ "${IMAGE_PGCAT_AVAILABLE:-0}" = "1" ]; then
echo "Image danielberteaud/pgcat:1.1.1-1 already available"
return
fi
# Image pgcat depends on alpine
build_alpine
if ! docker manifest inspect danielberteaud/pgcat:1.1.1-1 > /dev/null 2>&1; then
echo "Building pgcat:1.1.1-1"
export BUILDKIT_PROGRESS=plain
docker build -t danielberteaud/pgcat:1.1.1-1 -t danielberteaud/pgcat:latest output/images/pgcat &&\
docker push danielberteaud/pgcat:1.1.1-1 &&\
docker push danielberteaud/pgcat:latest &&\
echo "danielberteaud/pgcat:1.1.1-1 pushed to remote repo"
else
echo "Image danielberteaud/pgcat:1.1.1-1 already available"
fi
IMAGE_PGCAT_AVAILABLE=1
}
function build_php82 {
if [ "${IMAGE_PHP82_AVAILABLE:-0}" = "1" ]; then
echo "Image danielberteaud/php:82.24.4-1 already available"
@ -325,6 +306,23 @@ function build_sqlite {
fi
IMAGE_SQLITE_AVAILABLE=1
}
function build_valkey {
if [ "${IMAGE_VALKEY_AVAILABLE:-0}" = "1" ]; then
echo "Image danielberteaud/valkey:24.4-1 already available"
return
fi
if ! docker manifest inspect danielberteaud/valkey:24.4-1 > /dev/null 2>&1; then
echo "Building valkey:24.4-1"
export BUILDKIT_PROGRESS=plain
docker build -t danielberteaud/valkey:24.4-1 -t danielberteaud/valkey:latest output/images/valkey &&\
docker push danielberteaud/valkey:24.4-1 &&\
docker push danielberteaud/valkey:latest &&\
echo "danielberteaud/valkey:24.4-1 pushed to remote repo"
else
echo "Image danielberteaud/valkey:24.4-1 already available"
fi
IMAGE_VALKEY_AVAILABLE=1
}
function build_wait_for {
if [ "${IMAGE_WAIT_FOR_AVAILABLE:-0}" = "1" ]; then
echo "Image danielberteaud/wait-for:24.4-1 already available"
@ -372,12 +370,12 @@ build_mariadb
build_mariadb_client
build_mongo50
build_pgbouncer
build_pgcat
build_php82
build_php83
build_postgres15
build_postgres16
build_sqlite
build_valkey
build_wait_for
build_wkhtmltopdf

View File

@ -1,9 +1,9 @@
[[- /* vim: syntax=hcl
This is a generic, small and reusable redis task
This is a generic, small and reusable valkey task
It provides no data persistance */ -]]
# Local redis instance
task "redis" {
# Local valkey instance
task "valkey" {
driver = "docker"
user = 6379
@ -13,10 +13,10 @@
}
config {
image = "redis:alpine"
image = "[[ .docker.base_images.valkey.image ]]"
readonly_rootfs = true
force_pull = true
args = ["/local/redis.conf"]
args = ["/local/valkey.conf"]
}
template {
@ -27,7 +27,7 @@ databases 1
save ""
appendonly no
_EOT
destination = "local/redis.conf"
destination = "local/valkey.conf"
}
resources {

View File

@ -376,3 +376,8 @@ docker:
depends_on:
- alpine
# valkey (redis fork)
valkey:
image: valkey:24.4-1
tags:
- valkey:latest