From 7514b26405fa3614cfa6f14415d078fbf9364d90 Mon Sep 17 00:00:00 2001 From: Vincent Lohse Date: Fri, 25 Oct 2024 11:19:13 +0200 Subject: [PATCH] Added first draft of CI --- .dockerignore | 2 + .github/workflows/build_test_push.yaml | 64 ++++++++++++++++++++++++++ Dockerfile | 14 ++++++ pink/rondis/common.h | 2 +- 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 .github/workflows/build_test_push.yaml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..05d77292 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +rondb-docker +rondb-**/** diff --git a/.github/workflows/build_test_push.yaml b/.github/workflows/build_test_push.yaml new file mode 100644 index 00000000..e48d1f80 --- /dev/null +++ b/.github/workflows/build_test_push.yaml @@ -0,0 +1,64 @@ +name: Run Redis benchmark on Rondis + +on: + # Launch on any push + push: + pull_request: + # Not running on "closed" - that is taken care of by "push" (if merged) + types: [opened, synchronize, reopened] + +jobs: + build-and-run-redis-benchmark: + runs-on: ubuntu-latest + env: + RONDB_TARBALL_URI: https://repo.hops.works/master/rondb-22.10.5-linux-glibc2.28-x86_64.tar.gz + RONDB_PATH: /tmp/rondb + CONTAINER_NAME: rondis + RONDIS_PORT: 6379 + steps: + - name: Run rondb-docker + run: | + git clone -b release-0.7 https://github.com/logicalclocks/rondb-docker.git + cd rondb-docker + ./build_run_docker.sh -d \ + --size small \ + --num-mgm-nodes 1 \ + --node-groups 1 \ + --replication-factor 1 \ + --num-mysql-nodes 1 \ + --num-rest-api-nodes 0 \ + --num-benchmarking-nodes 0 + + - name: Download RonDB + run: | + wget $RONDB_TARBALL_URI -O ./temp_tarball.tar.gz \ + && tar xfz ./temp_tarball.tar.gz -C $RONDB_PATH --strip-components=1 \ + && rm ./temp_tarball.tar.gz + + - name: Build and Run RonDB Service + run: | + docker build -t rondis:latest . + docker run -d \ + --name=$CONTAINER_NAME \ + -v $RONDB_PATH:/tmp/rondb \ + -e RONDB_PATH=/tmp/rondb \ + -p $RONDIS_PORT:$RONDIS_PORT \ + --entrypoint=/bin/bash \ + rondis:latest + + - name: Build Pink + run: docker exec -it $CONTAINER_NAME bash -c "cd pink && make" + + - name: Connect Docker network + run: | + # Get network name that starts with "rondb" + COMPOSE_NETWORK=$(docker network list | grep rondb | awk '{print $2}') + docker network connect $COMPOSE_NETWORK $CONTAINER_NAME + + - name: Run Rondis + run: docker exec -it $CONTAINER_NAME bash -d \ + -c "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/rondb/lib pink/rondis/rondis 6379 mgmd_1:1186 2" + + - name: Run Redis benchmark + run: docker exec -it $CONTAINER_NAME bash \ + -c "redis-benchmark -t set -c 2" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..fc6baa7d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM ubuntu:22.04 + +# Default build threads to 1; max is defined in Docker config (run `nproc` in Docker container) +ARG BUILD_THREADS +ENV THREADS_ARG=${BUILD_THREADS:-1} + +RUN apt-get update && \ + apt-get install -y build-essential checkinstall wget zlib1g-dev \ + redis-server libprotobuf-dev protobuf-compiler + +COPY . . + +# Set default command to bash so the container doesn’t exit immediately +CMD ["/bin/bash"] diff --git a/pink/rondis/common.h b/pink/rondis/common.h index 03dcd487..182303a5 100644 --- a/pink/rondis/common.h +++ b/pink/rondis/common.h @@ -1,7 +1,7 @@ #include #include -#define MAX_CONNECTIONS 4 +#define MAX_CONNECTIONS 2 #define REDIS_DB_NAME "redis"