Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: Use bundled Valkey instead of Redis server #1205

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ services:
ports:
- $DB_PORT:3306

redis:
image: redis:alpine
container_name: redis
valkey:
image: valkey/valkey:8
container_name: valkey
restart: unless-stopped
ports:
- $REDIS_PORT:6379
Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ RUN mkdir -p ${WEBSERVER_FOLDER}/assets/romm && \
# Install required packages and dependencies
RUN apk add --no-cache \
bash \
libmagic \
mariadb-connector-c \
p7zip \
python3 \
tzdata \
redis \
libmagic \
p7zip
valkey

COPY ./backend /backend

Expand Down
22 changes: 11 additions & 11 deletions docker/init_scripts/init
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ start_bin_nginx() {
fi
}

start_bin_redis-server() {
info_log "starting redis-server"
# Check if /usr/local/etc/redis/redis.conf exists and use it if so
if [[ -f /usr/local/etc/redis/redis.conf ]]; then
redis-server /usr/local/etc/redis/redis.conf &
start_bin_valkey-server() {
info_log "starting valkey-server"
# Check if /usr/local/etc/valkey/valkey.conf exists and use it if so
if [[ -f /usr/local/etc/valkey/valkey.conf ]]; then
valkey-server /usr/local/etc/valkey/valkey.conf &
else
redis-server --dir /redis-data &
valkey-server --dir /redis-data &
fi
REDIS_PID=$!
echo "${REDIS_PID}" >/tmp/redis-server.pid
VALKEY_PID=$!
echo "${VALKEY_PID}" >/tmp/valkey-server.pid
}

# function that runs our independent python scripts and creates corresponding PID files,
Expand Down Expand Up @@ -128,10 +128,10 @@ while true; do
# check for died processes every 5 seconds
sleep 5

# Start redis server if we dont have a corresponding PID file
# and REDIS_HOST is not set (which would mean we're using an external redis)
# Start Valkey server if we dont have a corresponding PID file
# and REDIS_HOST is not set (which would mean we're using an external Redis/Valkey)
if [[ -z ${REDIS_HOST:=""} ]]; then
watchdog_process_pid bin redis-server
watchdog_process_pid bin valkey-server
fi

# Run needed database migrations on startup,
Expand Down
Loading