Compare commits

...

5 Commits

Author SHA1 Message Date
Josip Mrden
e1fa0fa87d Add initial toolchain build script 2023-04-24 10:32:16 +02:00
Josip Mrden
accefa7b88 Fix version and quote 2023-04-23 14:03:54 +02:00
Josip Mrden
1eb18a6d39 Remove exit 1 2023-04-23 13:57:18 +02:00
Josip Mrden
f8de1f05e7 Move to Jepsen 0.3.0 and fix vars 2023-04-23 13:56:36 +02:00
Marko Budiselic
74bc5237db Upgrade Jepsen setup 2023-04-23 13:43:32 +02:00
2 changed files with 51 additions and 7 deletions

View File

@ -3,6 +3,23 @@
set -Eeuo pipefail
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MEMGRAPH_BINARY_PATH="../../build/memgraph"
# NOTE: On Ubuntu 22.04 0.3.2 uses non-existing docker compose --compatibility flag.
# NOTE: On Ubuntu 22.04 0.3.1 seems to be working.
JEPSEN_VERSION="${JEPSEN_VERSION:-v0.3.0}"
JEPSEN_ACTIVE_NODES_NO=5
CONTROL_LEIN_RUN_ARGS="test-all --node-configs resources/node-config.edn"
CONTROL_LEIN_RUN_STDOUT_LOGS=1
CONTROL_LEIN_RUN_STDERR_LOGS=1
PRINT_CONTEXT() {
echo -e "MEMGRAPH_BINARY_PATH:\t\t $MEMGRAPH_BINARY_PATH"
echo -e "JEPSEN_VERSION:\t\t\t $JEPSEN_VERSION"
echo -e "JEPSEN_ACTIVE_NODES_NO:\t\t $JEPSEN_ACTIVE_NODES_NO"
echo -e "CONTROL_LEIN_RUN_ARGS:\t\t $CONTROL_LEIN_RUN_ARGS"
echo -e "CONTROL_LEIN_RUN_STDOUT_LOGS:\t $CONTROL_LEIN_RUN_STDOUT_LOGS"
echo -e "CONTROL_LEIN_RUN_STDERR_LOGS:\t $CONTROL_LEIN_RUN_STDERR_LOGS"
}
HELP_EXIT() {
echo ""
echo "HELP: $0 help|cluster-up|test [args]"
@ -28,15 +45,10 @@ if ! command -v docker > /dev/null 2>&1 || ! command -v docker-compose > /dev/nu
ERROR "docker and docker-compose have to be installed."
exit 1
fi
MEMGRAPH_BINARY_PATH="../../build/memgraph"
JEPSEN_ACTIVE_NODES_NO=5
CONTROL_LEIN_RUN_ARGS="test-all --node-configs resources/node-config.edn"
CONTROL_LEIN_RUN_STDOUT_LOGS=1
CONTROL_LEIN_RUN_STDERR_LOGS=1
PRINT_CONTEXT
if [ ! -d "$script_dir/jepsen" ]; then
git clone https://github.com/jepsen-io/jepsen.git -b "0.2.1" "$script_dir/jepsen"
git clone https://github.com/jepsen-io/jepsen.git -b "$JEPSEN_VERSION" "$script_dir/jepsen"
fi
if [ "$#" -lt 1 ]; then
@ -110,7 +122,9 @@ case $1 in
docker exec "$jepsen_node_name" rm -rf /opt/memgraph/
docker exec "$jepsen_node_name" mkdir -p /opt/memgraph
docker cp "$binary_path" "$jepsen_node_name":/opt/memgraph/"$binary_name"
# TODO(gitbuda): This doesn't work if the pure binary is linked called memgraph
docker exec "$jepsen_node_name" bash -c "rm -f /opt/memgraph/memgraph && ln -s /opt/memgraph/$binary_name /opt/memgraph/memgraph"
docker exec "$jepsen_node_name" bash -c "touch /opt/memgraph/memgraph.log"
INFO "Copying $binary_name to $jepsen_node_name DONE."
done

View File

@ -0,0 +1,30 @@
FROM debian:10
ARG TOOLCHAIN_VERSION=toolchain-v4
# Stops tzdata interactive configuration.
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y \
ca-certificates wget git
# Do NOT be smart here and clean the cache because the container is used in the
# stateful context.
RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-debian-10-amd64.tar.gz \
-O ${TOOLCHAIN_VERSION}-binaries-debian-10-amd64.tar.gz \
&& tar xzvf ${TOOLCHAIN_VERSION}-binaries-debian-10-amd64.tar.gz -C /opt \
&& rm ${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-debian-10-amd64.tar.gz
RUN git clone https://github.com/memgraph/memgraph.git \
&& ./memgraph/environments/os/debian-10.sh install TOOLCHAIN_RUN_DEPS \
&& ./memgraph/environment/os/debian-10.sh install MEMGRAPH_BUILD_DEPS
RUN cd memgraph \
&& source /opt/toolchain-v4/activate \
&& ./init \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& make -j4 \
&& make -j4 mgconsole
ENTRYPOINT ["sleep", "infinity"]