Skip to content

Commit

Permalink
Added Dockerfiles and readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
gopuman committed Oct 11, 2023
1 parent 34501e8 commit c50cd77
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions Docker/Dockerfile_mac
Original file line number Diff line number Diff line change
@@ -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
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

0 comments on commit c50cd77

Please sign in to comment.