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

Add CI #5

Merged
merged 40 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7514b26
Added first draft of CI
olapiv Oct 25, 2024
3b000d7
Adding debugging statements
olapiv Oct 25, 2024
c0f4ad5
Don't fail
olapiv Oct 25, 2024
568bc96
Adjusted debug statements
olapiv Oct 25, 2024
5c5b61f
Creating directory first
olapiv Oct 25, 2024
eae68d1
Don't change dir
olapiv Oct 25, 2024
84e9a8f
Change dir in same command
olapiv Oct 25, 2024
476d5a6
Debug statements
olapiv Oct 25, 2024
6305762
Using -f Dockerfile flag
olapiv Oct 25, 2024
7146647
Removed Dockerfile arg
olapiv Oct 25, 2024
8b37afe
Move back to previous dir
olapiv Oct 25, 2024
ed0b319
Fixed pwd
olapiv Oct 25, 2024
26d6c83
clone into proper dir
olapiv Oct 25, 2024
640cc3f
Fixed ls
olapiv Oct 25, 2024
8b9aea8
sleep before build
olapiv Oct 25, 2024
72800e4
Split up GH steps
olapiv Oct 25, 2024
5b06d7e
Debug statements
olapiv Oct 25, 2024
a900b40
Create Rondis image first
olapiv Oct 25, 2024
3673743
Debug statement
olapiv Oct 25, 2024
4a61582
New step
olapiv Oct 25, 2024
fa27542
Actually check out the repo
olapiv Oct 25, 2024
a645071
Add pipe to step
olapiv Oct 25, 2024
fc33801
Removed -t flag
olapiv Oct 25, 2024
2ffb0c1
Replaced bash with tail
olapiv Oct 25, 2024
e14d49b
Clean first and added WORKDIR
olapiv Oct 25, 2024
712c636
Removed debug statement
olapiv Oct 25, 2024
2e7d56c
Remove Dockerfile dependencies
olapiv Oct 27, 2024
f344ea1
Run d-compose later; use build.sh script; fixed LD_LIBRARY_PATH export
olapiv Oct 27, 2024
9484d7b
Execute Redis SQL scripts
olapiv Oct 27, 2024
1844886
Download git
olapiv Oct 27, 2024
d561547
Exit on errors
olapiv Oct 27, 2024
4f15adf
Run rondb-docker first again
olapiv Oct 27, 2024
0e0e7b6
Fixed running SQL files on MySQLd
olapiv Oct 27, 2024
31b7618
Run detached
olapiv Oct 27, 2024
97b17c9
No newline
olapiv Oct 27, 2024
f05187e
Only run for PR to main/master
olapiv Oct 27, 2024
b1d2677
Also use Dockerfile in devcontainer
olapiv Oct 27, 2024
6e6bae4
Remove debugs
olapiv Oct 27, 2024
956dd18
Also test GET
olapiv Oct 27, 2024
1be4565
Less print statements
olapiv Oct 28, 2024
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
12 changes: 8 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"name": "Pink builder",
"image": "ubuntu:22.04",
"build": {
"context": "..",
"dockerfile": "../Dockerfile"
},
"workspaceMount": "source=${localWorkspaceFolder},target=/usr/src/app,type=bind",
"workspaceFolder": "/usr/src/app",
"features": {
"ghcr.io/devcontainers/features/common-utils:2.5.1": {},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
Expand All @@ -26,10 +31,9 @@
}
}
},
"postCreateCommand": "sudo apt-get update && sudo apt-get install -y build-essential redis-server libprotobuf-dev protobuf-compiler",
"containerEnv": {
"RONDB_PATH": "/workspaces/pink/rondb-22.10.5-linux-glibc2.28-arm64_v8"
"RONDB_PATH": "/usr/src/app/rondb-22.10.5-linux-glibc2.28-arm64_v8"
// Do this manually:
// export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/workspaces/pink/rondb-22.10.5-linux-glibc2.28-arm64_v8/lib
// export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/src/app/rondb-22.10.5-linux-glibc2.28-arm64_v8/lib
}
}
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rondb-docker
rondb-**/**
86 changes: 86 additions & 0 deletions .github/workflows/build_test_push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Run Redis benchmark on Rondis

on:
pull_request:
# Launch on PRs *towards* these branches
branches:
- main
- master
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
IMAGE_NAME: rondis:latest
CONTAINER_NAME: rondis
RONDIS_PORT: 6379
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run rondb-docker
env:
RONDB_DOCKER_DIR: /tmp/rondb-docker
run: |
path_now=$(pwd)
git clone -b release-0.7 https://github.com/logicalclocks/rondb-docker.git $RONDB_DOCKER_DIR
cd $RONDB_DOCKER_DIR && ./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
cd $path_now

- name: Build Rondis image
run: docker build -t $IMAGE_NAME .

- name: Download RonDB
run: |
wget $RONDB_TARBALL_URI -O /tmp/temp_tarball.tar.gz
mkdir -p $RONDB_PATH
tar xfz /tmp/temp_tarball.tar.gz -C $RONDB_PATH --strip-components=1

- name: Create Rondis environment
env:
DOCKER_WORK_DIR: /usr/src/app
run: |
docker run -d \
--name=$CONTAINER_NAME \
-v $RONDB_PATH:$RONDB_PATH \
-v $(pwd):$DOCKER_WORK_DIR \
-e RONDB_PATH=$RONDB_PATH \
-w $DOCKER_WORK_DIR \
-p $RONDIS_PORT:$RONDIS_PORT \
$IMAGE_NAME \
tail -f /dev/null

- name: Build Pink
run: docker exec -i $CONTAINER_NAME bash -c "cd pink && ./build.sh"

- name: Run SQL scripts
run: |
docker exec -i mysqld_1 bash -c "mysql -uroot -e 'CREATE DATABASE redis;'"
for sql_file in pink/rondis/sql/*.sql; do
cat "$sql_file" | docker exec -i mysqld_1 mysql -uroot
done

- 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 -i $CONTAINER_NAME bash -c \
"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/rondb/lib && pink/rondis/rondis 6379 mgmd_1:1186 2 &"

- name: Run Redis benchmark
run: docker exec -i $CONTAINER_NAME bash -c "redis-benchmark -t get,set -c 2"
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ubuntu:22.04

RUN apt-get update && \
apt-get install -y build-essential redis-server libprotobuf-dev \
protobuf-compiler git

CMD ["/bin/bash"]
2 changes: 2 additions & 0 deletions pink/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e

PINK_PATH=$PWD

# We depend on slash
Expand Down
2 changes: 1 addition & 1 deletion pink/rondis/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ int execute_no_commit(NdbTransaction *trans, int &ret_code, bool allow_fail)

int execute_commit(Ndb *ndb, NdbTransaction *trans, int &ret_code)
{
printf("Execute transaction\n");
// printf("Execute transaction\n");
if (trans->execute(NdbTransaction::Commit) != 0)
{
ret_code = trans->getNdbError().code;
Expand Down
2 changes: 1 addition & 1 deletion pink/rondis/common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <ndbapi/NdbApi.hpp>
#include <ndbapi/Ndb.hpp>

#define MAX_CONNECTIONS 4
#define MAX_CONNECTIONS 2

#define REDIS_DB_NAME "redis"

Expand Down
7 changes: 6 additions & 1 deletion pink/rondis/rondb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ int rondb_redis_handler(const pink::RedisCmdArgsType &argv,
}
else
{
printf("Unsupported command\n");
printf("Unsupported command: ");
for (const auto &arg : argv)
{
printf("%s ", arg.c_str());
}
printf("\n");
return -1;
}
}
Expand Down
14 changes: 8 additions & 6 deletions pink/rondis/rondis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ RondisConn::RondisConn(

int RondisConn::DealMessage(const RedisCmdArgsType &argv, std::string *response)
{
printf("Received Redis message: ");
for (int i = 0; i < argv.size(); i++)
{
printf("%s ", argv[i].c_str());
}
printf("\n");
/*
printf("Received Redis message: ");
for (int i = 0; i < argv.size(); i++)
{
printf("%s ", argv[i].c_str());
}
printf("\n");
*/
return rondb_redis_handler(argv, response, _worker_id);
}

Expand Down
4 changes: 3 additions & 1 deletion pink/rondis/string/db_interactions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,11 @@ int get_simple_key_row(std::string *response,
response->append(buf);
response->append((const char *)&key_row->value_start[2], key_row->tot_value_len);
response->append("\r\n");
printf("Respond with tot_value_len: %u, string: %s\n",
/*
printf("Respond with tot_value_len: %u, string: %s\n",
key_row->tot_value_len,
(const char *)&key_row->value_start[2], key_row->tot_value_len);
*/
ndb->closeTransaction(trans);
return 0;
}
Expand Down