Skip to content

Commit ada1ed6

Browse files
Initial commit for standalone OSS RedisGraph deployment (#4)
* [wip] Wip on RedisGraph infra as code deployment ( using r5.8xlarge for DB and c5.2xlarge for client ) * Initial commit for standalone OSS RedisGraph deployment
1 parent 9f18ccd commit ada1ed6

13 files changed

+479
-1
lines changed

install_deps.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
sudo apt install -y awscli zip jq
2+
sudo apt install -y zip
33

44
# Ensure terraform is available
55
TF_EXE_FILE_NAME=${TF_EXE_FILE_NAME:-$(which terraform)}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
# exit immediately on error
4+
set -e
5+
6+
wget https://s3.amazonaws.com/benchmarks.redislabs/redisgraph/redisgraph-benchmark-go/unstable/redisgraph-benchmark-go_linux_amd64
7+
chmod +x redisgraph-benchmark-go_linux_amd64
8+
sudo mv redisgraph-benchmark-go_linux_amd64 /usr/local/bin/redisgraph-benchmark-go

scripts/debian_install_redisgraph.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# exit immediately on error
4+
set -e
5+
COMMIT=${COMMIT:-""}
6+
7+
# How many benchmark threads - match num of cores, or default to 8
8+
JOBS=${JOBS:-$(grep -c ^processor /proc/cpuinfo 2>/dev/null || echo 8)}
9+
10+
# sudo apt update -y
11+
sudo apt install git -y
12+
sudo apt install build-essential cmake m4 automake peg libtool autoconf -y
13+
14+
rm -rf RedisGraph
15+
16+
if [[ "$COMMIT" == "" ]]; then
17+
echo "Using current HEAD"
18+
git clone --recurse-submodules -j8 https://github.com/RedisGraph/RedisGraph.git --depth 1
19+
cd RedisGraph
20+
fi
21+
if [[ "$COMMIT" != "" ]]; then
22+
echo "Using commit ${COMMIT}"
23+
git clone --recurse-submodules -j8 https://github.com/RedisGraph/RedisGraph.git
24+
cd RedisGraph
25+
git checkout ${COMMIT}
26+
fi
27+
28+
# first build graphblas
29+
make -C src ../deps/GraphBLAS/build/libgraphblas.a JOBS=${JOBS}
30+
# then build other deps and redisgraph
31+
make -j ${JOBS}
32+
33+
# clean
34+
cd ..
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
# exit immediately on error
4+
set -e
5+
HOSTNAME=${HOSTNAME:-"127.0.0.1"}
6+
PORT=${PORT:-6379}
7+
TLS_PORT=${TLS_PORT:-6080}
8+
CLIENTS=${CLIENTS:-50}
9+
REQUESTS=${REQUESTS:-100000}
10+
11+
# workaround for terraform env variables passing
12+
for ARGUMENT in "$@"; do
13+
KEY=$(echo $ARGUMENT | cut -f1 -d=)
14+
VALUE=$(echo $ARGUMENT | cut -f2 -d=)
15+
case "$KEY" in
16+
HOSTNAME) HOSTNAME=${VALUE} ;;
17+
PORT) PORT=${VALUE} ;;
18+
*) ;;
19+
esac
20+
done
21+
22+
OUTPUT_NAME_SUFIX=${OUTPUT_NAME_SUFIX:-"benchmark-results"}
23+
24+
# Ensure redisgraph-benchmark-go is available
25+
EXE_FILE_NAME=${EXE_FILE_NAME:-$(which redisgraph-benchmark-go)}
26+
27+
if [[ -z "${EXE_FILE_NAME}" ]]; then
28+
echo "redisgraph-benchmark-go not available. It is not specified explicitly and not found in \$PATH"
29+
exit 1
30+
fi
31+
32+
FILENAME=${OUTPUT_NAME_SUFIX}.json
33+
echo "Running test: $TEST_NAME"
34+
echo " Saving results to file: ${FILENAME}"
35+
36+
${EXE_FILE_NAME} \
37+
-p ${PORT} \
38+
-h ${HOSTNAME} \
39+
-c ${CLIENTS} \
40+
-n ${REQUESTS} \
41+
-query "CREATE(n)" \
42+
-json-out-file ${FILENAME}
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
# exit immediately on error
4+
set -e
5+
set -x
6+
PORT=${PORT:-6379}
7+
TLS_PORT=${TLS_PORT:-6080}
8+
APPENDONLY=${APPENDONLY:-"no"}
9+
SAVE=${SAVE:-'""'}
10+
DAEMONIZE=${DAEMONIZE:-"yes"}
11+
PROTECTED_MODE=${PROTECTED_MODE:-"no"}
12+
MODULEPATH=${MODULEPATH:-"/home/ubuntu/RedisGraph/src/redisgraph.so"}
13+
14+
# Ensure redis-server is available
15+
EXE_FILE_NAME=${EXE_FILE_NAME:-$(which redis-server)}
16+
17+
if [[ -z "${EXE_FILE_NAME}" ]]; then
18+
echo "redis-server not available. It is not specified explicitly and not found in \$PATH"
19+
exit 1
20+
fi
21+
22+
${EXE_FILE_NAME} \
23+
--port ${PORT} \
24+
--protected-mode ${PROTECTED_MODE} \
25+
--save ${SAVE} \
26+
--daemonize ${DAEMONIZE} \
27+
--appendonly ${APPENDONLY} \
28+
--loadmodule ${MODULEPATH}
29+
30+
echo "Printing redis info"
31+
redis-cli -p ${PORT} info
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# oss-redisgraph-standalone-r5
2+
3+
Deploy Multi-VM benchmark sceneario, including 1 client and 1 DB machine.
4+
- Cloud provider: AWS
5+
- OS: Ubuntu 18.04
6+
- Client machine: c5.large
7+
- Benchmark machine: c5.xlarge
8+
9+
-------
10+
11+
#### Tested scenarios
12+
13+
- TBD
14+
15+
#### Deployment
16+
17+
##### Required env variables
18+
19+
The terraform and ansible scripts expect the following env variables to be filled:
20+
```
21+
export EC2_REGION={ ## INSERT REGION ## }
22+
export EC2_ACCESS_KEY={ ## INSERT EC2 ACCESS KEY ## }
23+
export EC2_SECRET_KEY={ ## INSERT EC2 SECRET KEY ## }
24+
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
25+
```
26+
27+
##### Required pub/private keys
28+
29+
The terraform script expects the following public private keys to be present on ~/.ssh/ dir:
30+
```
31+
~/.ssh/perf-cto-joint-tasks.pem
32+
~/.ssh/perf-cto-joint-tasks.pub
33+
```
34+
35+
##### Deployment steps
36+
within project repo
37+
38+
```bash
39+
cd RedisGraph/tests/benchmarks/aws/tf-oss-redisgraph-standalone-r5
40+
terraform plan
41+
terraform apply
42+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
resource "aws_instance" "client" {
3+
count = "${var.client_instance_count}"
4+
ami = "${var.instance_ami}"
5+
instance_type = "${var.client_instance_type}"
6+
subnet_id = data.terraform_remote_state.shared_resources.outputs.subnet_public_id
7+
vpc_security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"]
8+
key_name = "${var.key_name}"
9+
10+
root_block_device {
11+
volume_size = "${var.instance_volume_size}"
12+
volume_type = "${var.instance_volume_type}"
13+
encrypted = "${var.instance_volume_encrypted}"
14+
delete_on_termination = true
15+
}
16+
17+
volume_tags = {
18+
Name = "ebs_block_device-${var.setup_name}-CLIENT-${count.index + 1}"
19+
setup = "${var.setup_name}"
20+
triggering_env = "${var.triggering_env}"
21+
github_actor = "${var.github_actor}"
22+
github_org = "${var.github_org}"
23+
github_repo = "${var.github_repo}"
24+
github_sha = "${var.github_sha}"
25+
}
26+
27+
tags = {
28+
Name = "${var.setup_name}-CLIENT-${count.index + 1}"
29+
setup = "${var.setup_name}"
30+
triggering_env = "${var.triggering_env}"
31+
github_actor = "${var.github_actor}"
32+
github_org = "${var.github_org}"
33+
github_repo = "${var.github_repo}"
34+
github_sha = "${var.github_sha}"
35+
}
36+
37+
################################################################################
38+
# This will ensure we wait here until the instance is ready to receive the ssh connection
39+
################################################################################
40+
provisioner "remote-exec" {
41+
script = "./../scripts/wait_for_instance.sh"
42+
connection {
43+
host = "${self.public_ip}" # The `self` variable is like `this` in many programming languages
44+
type = "ssh" # in this case, `self` is the resource (the server).
45+
user = "${var.ssh_user}"
46+
private_key = "${file(var.private_key)}"
47+
#need to increase timeout to larger then 5m for metal instances
48+
timeout = "15m"
49+
agent = "false"
50+
}
51+
}
52+
53+
################################################################################
54+
# Deployment related
55+
################################################################################
56+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
################################################################################
3+
# This is the bucket holding this specific setup tfstate
4+
################################################################################
5+
terraform {
6+
backend "s3" {
7+
bucket = "performance-cto-group"
8+
region = "us-east-1"
9+
}
10+
}
11+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
resource "aws_instance" "server" {
3+
count = "${var.server_instance_count}"
4+
ami = "${var.instance_ami}"
5+
instance_type = "${var.server_instance_type}"
6+
subnet_id = data.terraform_remote_state.shared_resources.outputs.subnet_public_id
7+
vpc_security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"]
8+
key_name = "${var.key_name}"
9+
10+
root_block_device {
11+
volume_size = "${var.instance_volume_size}"
12+
volume_type = "${var.instance_volume_type}"
13+
encrypted = "${var.instance_volume_encrypted}"
14+
delete_on_termination = true
15+
}
16+
17+
volume_tags = {
18+
Name = "ebs_block_device-${var.setup_name}-DB-${count.index + 1}"
19+
setup = "${var.setup_name}"
20+
triggering_env = "${var.triggering_env}"
21+
github_actor = "${var.github_actor}"
22+
github_org = "${var.github_org}"
23+
github_repo = "${var.github_repo}"
24+
github_sha = "${var.github_sha}"
25+
}
26+
27+
tags = {
28+
Name = "${var.setup_name}-DB-${count.index + 1}"
29+
setup = "${var.setup_name}"
30+
triggering_env = "${var.triggering_env}"
31+
github_actor = "${var.github_actor}"
32+
github_org = "${var.github_org}"
33+
github_repo = "${var.github_repo}"
34+
github_sha = "${var.github_sha}"
35+
}
36+
37+
################################################################################
38+
# This will ensure we wait here until the instance is ready to receive the ssh connection
39+
################################################################################
40+
provisioner "remote-exec" {
41+
script = "./../scripts/wait_for_instance.sh"
42+
connection {
43+
host = "${self.public_ip}" # The `self` variable is like `this` in many programming languages
44+
type = "ssh" # in this case, `self` is the resource (the server).
45+
user = "${var.ssh_user}"
46+
private_key = "${file(var.private_key)}"
47+
#need to increase timeout to larger then 5m for metal instances
48+
timeout = "15m"
49+
agent = "false"
50+
}
51+
}
52+
53+
################################################################################
54+
# Deployment related
55+
################################################################################
56+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
output "server_public_ip" {
2+
value = ["${aws_instance.server[0].public_ip}"]
3+
}
4+
5+
output "server_private_ip" {
6+
value = ["${aws_instance.server[0].private_ip}"]
7+
}
8+
9+
output "client_public_ip" {
10+
value = ["${aws_instance.client[0].public_ip}"]
11+
}
12+
13+
output "client_private_ip" {
14+
value = ["${aws_instance.client[0].private_ip}"]
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# provider
2+
provider "aws" {
3+
region = "${var.region}"
4+
}
5+
6+
################################################################################
7+
# This is the shared resources bucket key -- you will need it across environments like security rules,etc...
8+
# !! do not change this !!
9+
################################################################################
10+
data "terraform_remote_state" "shared_resources" {
11+
backend = "s3"
12+
config = {
13+
bucket = "performance-cto-group"
14+
key = "benchmarks/infrastructure/shared_resources.tfstate"
15+
region = "us-east-1"
16+
}
17+
}

0 commit comments

Comments
 (0)