From c50cd771771146a377774e8f93cb89f1c5dd40a4 Mon Sep 17 00:00:00 2001 From: Gopal Nambiar Date: Tue, 10 Oct 2023 17:34:07 -0700 Subject: [PATCH] Added Dockerfiles and readme update --- Docker/Dockerfile | 35 +++++++++++++++++++++++++++++++ Docker/Dockerfile_mac | 32 ++++++++++++++++++++++++++++ README.md | 49 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 Docker/Dockerfile create mode 100644 Docker/Dockerfile_mac diff --git a/Docker/Dockerfile b/Docker/Dockerfile new file mode 100644 index 000000000..5b45b3f26 --- /dev/null +++ b/Docker/Dockerfile @@ -0,0 +1,35 @@ +FROM ubuntu:20.04 + +ARG DEBIAN_FRONTEND=noninteractive + +# Update package lists and install required dependencies +RUN apt-get update && apt-get install -y \ + apt-transport-https \ + curl \ + gnupg \ + protobuf-compiler \ + rapidjson-dev \ + build-essential \ + openjdk-11-jdk \ + zip \ + unzip \ + clang-format + +# Install Bazel +RUN curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg \ + && mv bazel.gpg /etc/apt/trusted.gpg.d/ \ + && echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list \ + && curl https://bazel.build/bazel-release.pub.gpg | apt-key add - \ + && apt-get update && apt-get install -y bazel=5.0.0 \ + && rm /etc/apt/sources.list.d/bazel.list + +# Set the working directory +WORKDIR /app + +# Copy your project files to the container +COPY . /app + +# Build the project with Bazel +RUN bazel --version +RUN bazel build @com_github_bazelbuild_buildtools//buildifier:buildifier +RUN bazel build service/tools/kv/api_tools/kv_service_tools diff --git a/Docker/Dockerfile_mac b/Docker/Dockerfile_mac new file mode 100644 index 000000000..eb47e0ce9 --- /dev/null +++ b/Docker/Dockerfile_mac @@ -0,0 +1,32 @@ +# Use a base image for ARM64 architecture +FROM arm64v8/ubuntu:20.04 + +ARG DEBIAN_FRONTEND=noninteractive + +# Update package lists and install required dependencies +RUN apt-get update && apt-get install -y \ + apt-transport-https \ + curl \ + gnupg \ + protobuf-compiler \ + rapidjson-dev \ + build-essential \ + openjdk-11-jdk \ + zip \ + unzip \ + clang-format + +# Install Bazelisk +RUN curl -Lo /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-arm64 \ + && chmod +x /usr/local/bin/bazel + +# Set the working directory +WORKDIR /app + +# Copy your project files to the container +COPY . /app + +# Build the project with Bazel +RUN bazel --version +RUN bazel build @com_github_bazelbuild_buildtools//buildifier:buildifier +RUN bazel build service/tools/kv/api_tools/kv_service_tools diff --git a/README.md b/README.md index 312632dce..4946c53fd 100644 --- a/README.md +++ b/README.md @@ -97,3 +97,52 @@ You will see the following result if successful: ## Deployment Script We also provide access to a [deployment script](https://github.com/resilientdb/resilientdb/tree/master/scripts/deploy) that allows deployment on distinct machines. + +## Deploy via Docker + +1. **Install Docker** + Before getting started, make sure you have Docker installed on your system. If you don't have Docker already, you can download and install it from the official [Docker website](https://www.docker.com/products/docker-desktop/). + +2. **Pull the Latest ResilientDB Image** + Choose the appropriate [ResilientDB image](https://hub.docker.com/repository/docker/expolab/resdb/general) for your machine's architecture: + + - For amd architecture, run: + ```shell + docker pull expolab/resdb:amd64 + ``` + + - For Apple Silicon (M1/M2) architecture, run: + ```shell + docker pull expolab/resdb:arm64 + ``` + +3. **Run a Container with the Pulled Image** + Launch a Docker container using the ResilientDB image you just pulled: + + - For amd architecture, run: + ```shell + docker run -it expolab/resdb:amd64 bash + ``` + + - For Apple Silicon (M1/M2) architecture, run: + ```shell + docker run -it expolab/resdb:arm64 bash + ``` + +4. **Start the kv_service within the Container** + Once you're inside the container, start the `kv_service` by running the following command: + ```shell + ./service/tools/kv/server_tools/start_kv_service.sh + ``` +5. **Test with Set and Get Commands** + Verify the functionality of the service by performing set and get operations: + + - Set a test value: + ```shell + bazel-bin/service/tools/kv/api_tools/kv_service_tools service/tools/config/interface/service.config set test + ``` + + - Retrieve the test value: + ``` + bazel-bin/service/tools/kv/api_tools/kv_service_tools service/tools/config/interface/service.config get test + ``` \ No newline at end of file