Skip to content
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
17 changes: 15 additions & 2 deletions data-loading/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use Redis so we can redis-cli.
FROM redis:6
FROM redis:latest

# Configuration
ARG ROOT=/home/nru
Expand All @@ -8,13 +8,20 @@ ARG DATA=/data
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install wget python3-venv python3-pip
RUN apt-get -y install git gcc

# Create nru user
RUN mkdir -p ${ROOT}
RUN useradd nru -d ${ROOT}
RUN chown nru ${ROOT}
WORKDIR ${ROOT}

# We need to install rdb-cli, which we need to -- lolsob -- compile from source. So let's do that.
RUN git clone https://github.com/redis/librdb.git
WORKDIR ${ROOT}/librdb
RUN make install
WORKDIR ${ROOT}

# Set up a volume for data.
VOLUME ${DATA}
RUN mkdir -p ${DATA}
Expand All @@ -32,5 +39,11 @@ ENV PATH="${VIRTUAL_ENV}/bin:$PATH"
COPY --chown=nru requirements.txt ${ROOT}
RUN pip3 install -r requirements.txt

# Copy scripts.
COPY --chown=nru rdb-to-resp.sh ${ROOT}

# Make sure rdb-cli has been set up.
# RUN rdb-cli

# Entrypoint should be bash.
ENTRYPOINT /bin/bash
ENTRYPOINT ["/bin/bash"]
16 changes: 16 additions & 0 deletions data-loading/rdb-to-resp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
#
# A Bash script to convert an RDB file into a stream of RESP commands.
# Uses https://github.com/redis/librdb?tab=readme-ov-file#rdb-cli-usage
#
# bash rdb-to-resp.sh RDB_FILENAME [REDIS_VERSION]
set -euo pipefail

# Check the number of arguments
if [ "$#" -lt 1 ]; then
echo "Usage: $0 <RDB_FILENAME>" >&2
exit 1
fi
REDIS_VERSION="${2:-6.2}" # Default to a Redis version of 6.2

rdb-cli "$1" resp --target-redis-ver "${REDIS_VERSION}"
3 changes: 1 addition & 2 deletions data-loading/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
rdbtools
python-lzf