From c476bb65f408372fbd746e723cbd194ec05448b9 Mon Sep 17 00:00:00 2001 From: Adrian Nagy Date: Fri, 31 May 2024 15:35:24 +0200 Subject: [PATCH 1/8] feat(docker): include the testing framework scenarios in the image --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f0efb83125..4152c9db8e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ RUN rustup default 1.77 && rustup component add rustfmt WORKDIR /openmina COPY . . RUN cargo build --release --package=cli --bin=openmina +RUN cargo build --release --features scenario-generators --bin openmina-node-testing FROM openmina/mina-snark-worker-prover:${MINA_SNARK_WORKER_TAG} as prover @@ -13,5 +14,6 @@ FROM debian:buster RUN apt-get update && apt-get install -y libjemalloc2 libssl1.1 libpq5 curl jq procps && apt-get clean COPY --from=build /openmina/cli/bin/snark-worker /usr/local/bin/ COPY --from=build /openmina/target/release/openmina /usr/local/bin/ +COPY --from=build /openmina/target/release/openmina-node-testing /usr/local/bin/ COPY --from=prover /usr/local/bin/mina /usr/local/bin -ENTRYPOINT [ "openmina" ] +ENTRYPOINT [ "openmina" ] \ No newline at end of file From ae590f9104db24b240be25656e6f7e58a814ffe1 Mon Sep 17 00:00:00 2001 From: Adrian Nagy Date: Fri, 31 May 2024 15:46:07 +0200 Subject: [PATCH 2/8] chore: Update readme + producer demo readme --- README.md | 23 ++++++- docs/producer-demo.md | 141 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 161 insertions(+), 3 deletions(-) create mode 100644 docs/producer-demo.md diff --git a/README.md b/README.md index 08f4d9ba12..aa2f7a3a72 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,9 @@ In the future, we plan to implement: * SnarkyJS support for Rust node, thanks to which you will be able to directly inject simple transactions, such as transferring Mina funds from one account to another. * The ability to record/replay all blocks +## Producer demo + +See the detailed [guide](docs/producer-demo.md). ## How to launch (with docker compose): @@ -59,15 +62,29 @@ Ubuntu or Debian-based Linux distribution with the following packages installed: - `git` - `libssl-dev` - `pkg-config` +- `protobuf-compiler` +- `build-essential` -Example: +Example (debian-based): ``` sh # Either using "sudo" or as the "root" user -sudo apt install curl git libssl-dev pkg-config protobuf-compiler +sudo apt install curl git libssl-dev pkg-config protobuf-compiler build-essential +``` + +Example (macOS): + +If you have not yet installed homebrew: + +```sh +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +``` + +``` sh +brew install curl git openssl pkg-config protobuf gcc make ``` -**Steps (for Debian-based Linux distros):** +**Steps (for Debian-based Linux distros and macOS):** Open up the command line and enter the following: diff --git a/docs/producer-demo.md b/docs/producer-demo.md new file mode 100644 index 0000000000..2218a0a784 --- /dev/null +++ b/docs/producer-demo.md @@ -0,0 +1,141 @@ +# Producer Demo Launch Guide with Docker + +## Table of Contents +1. [Prerequisites](#prerequisites) + - [Docker Installation on Debian-based Linux](#docker-installation-on-debian-based-linux) + - [Docker Installation on Windows](#docker-installation-on-windows) + - [Docker Installation on macOS](#docker-installation-on-macos) +2. [Running the Producer Demo](#running-the-producer-demo) + - [Running on Debian-based Linux](#running-on-debian-based-linux) + - [Running on Windows](#running-on-windows) + - [Running on macOS](#running-on-macos) + +## Prerequisites + +### Docker Installation on Debian-based Linux + +1. **Set up Docker's apt repository:** + + ```bash + # Add Docker's official GPG key: + sudo apt-get update + sudo apt-get install ca-certificates curl + sudo install -m 0755 -d /etc/apt/keyrings + sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc + sudo chmod a+r /etc/apt/keyrings/docker.asc + + # Add the repository to Apt sources: + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + sudo apt-get update + ``` + +2. **Install the Docker packages:** + + ```bash + sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + ``` + +3. **Add your user to the `docker` group:** + + ```bash + sudo usermod -aG docker $USER + newgrp docker + ``` + +4. **Verify the installation:** + + ```bash + docker run hello-world + ``` + +### Docker Installation on Windows + +1. **Download Docker Desktop for Windows from the [Docker Website](https://www.docker.com/products/docker-desktop/).** + +2. **Run the installer and follow the instructions.** + +3. **After installation, Docker will start automatically. Verify that Docker Desktop is running by checking the Docker icon in your system tray.** + +### Docker Installation on macOS + +1. **Download Docker Desktop for Mac from the [Docker Website](https://www.docker.com/products/docker-desktop/).** + +2. **Open the downloaded `.dmg` file and drag Docker to the Applications folder.** + +3. **Open Docker from the Applications folder and follow the installation steps.** + +4. **Open up a terminal window by using the shortcut Command + Space and type in terminal** + +5. **Verify the installation by running the following command in your terminal:** + ```sh + docker --version + ``` + +## Running the Producer Demo + +### Running on Debian-based Linux + +1. **Clone this repository:** + ```bash + git clone https://github.com/openmina/openmina.git --branch chore/guide-producer-demo + ``` + +2. **Navigate to the repository:** + + ```bash + cd openmina + ``` + +3. **Run the following command to start the demo:** + ```sh + sudo docker-compose -f docker-compose.local.producers.yml up + ``` + +4. **Open you browser and visit http://localhost:8070** + +### Running on Windows + +1. **Open the command prompt by pressing the windows button on your keyboard and type in command prompt** + +2. **Clone this repository:** + ```bash + git clone https://github.com/openmina/openmina.git --branch chore/guide-producer-demo + ``` + +3. **Navigate to the repository:** + + ```bash + cd openmina + ``` + +4. **Run the following command to start the demo:** + ```sh + sudo docker-compose -f docker-compose.local.producers.yml up + ``` + +5. **Open you browser and visit http://localhost:8070** + +### Running on macOS + +1. **Open a terminal by pressing command + space on your keyboard and type in terminal** + +2. **Clone this repository:** + ```bash + git clone https://github.com/openmina/openmina.git --branch chore/guide-producer-demo + ``` + +3. **Navigate to the repository:** + + ```bash + cd openmina + ``` + +4. **Run the following command to start the demo:** + ```sh + sudo docker-compose -f docker-compose.local.producers.yml up + ``` + +5. **Open you browser and visit http://localhost:8070** From ce027f9d4df51e33f4cddd86fd32783b8f1691e7 Mon Sep 17 00:00:00 2001 From: Adrian Nagy Date: Fri, 31 May 2024 15:47:16 +0200 Subject: [PATCH 3/8] feat: Producer demo compose --- docker-compose.local.producers.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 docker-compose.local.producers.yml diff --git a/docker-compose.local.producers.yml b/docker-compose.local.producers.yml new file mode 100644 index 0000000000..b74cf05efe --- /dev/null +++ b/docker-compose.local.producers.yml @@ -0,0 +1,15 @@ +services: + local-producer-cluster: + container_name: local-producer-cluster + image: adrnagy/openmina:tutorial # TODO: change + entrypoint: ["openmina-node-testing", "scenarios-generate", "--name", "simulation-small-forever-real-time"] + ports: + - 11010:11010 + - 11012:11012 + - 11014:11014 + + frontend: + container_name: frontend + image: adrnagy/openmina-fe:tutorial # TODO: change + ports: + - "8070:80" From ad78aa2e65d9bc1a3ce76378c64b26d70b1c9a7d Mon Sep 17 00:00:00 2001 From: Adrian Nagy Date: Fri, 31 May 2024 15:53:19 +0200 Subject: [PATCH 4/8] fix(docs): no sudo needed --- docs/producer-demo.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/producer-demo.md b/docs/producer-demo.md index 2218a0a784..e508f22eec 100644 --- a/docs/producer-demo.md +++ b/docs/producer-demo.md @@ -91,7 +91,7 @@ 3. **Run the following command to start the demo:** ```sh - sudo docker-compose -f docker-compose.local.producers.yml up + docker compose -f docker-compose.local.producers.yml up ``` 4. **Open you browser and visit http://localhost:8070** @@ -113,7 +113,7 @@ 4. **Run the following command to start the demo:** ```sh - sudo docker-compose -f docker-compose.local.producers.yml up + docker compose -f docker-compose.local.producers.yml up ``` 5. **Open you browser and visit http://localhost:8070** @@ -135,7 +135,7 @@ 4. **Run the following command to start the demo:** ```sh - sudo docker-compose -f docker-compose.local.producers.yml up + docker compose -f docker-compose.local.producers.yml up ``` 5. **Open you browser and visit http://localhost:8070** From 617a60e99ddd3e470a86c5a73e3b216acc9a430f Mon Sep 17 00:00:00 2001 From: Adrian Nagy Date: Fri, 31 May 2024 16:23:39 +0200 Subject: [PATCH 5/8] build images on hosts --- docker-compose.local.producers.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docker-compose.local.producers.yml b/docker-compose.local.producers.yml index b74cf05efe..6a03bfe635 100644 --- a/docker-compose.local.producers.yml +++ b/docker-compose.local.producers.yml @@ -1,7 +1,9 @@ services: local-producer-cluster: container_name: local-producer-cluster - image: adrnagy/openmina:tutorial # TODO: change + build: + context: . + dockerfile: Dockerfile entrypoint: ["openmina-node-testing", "scenarios-generate", "--name", "simulation-small-forever-real-time"] ports: - 11010:11010 @@ -10,6 +12,10 @@ services: frontend: container_name: frontend - image: adrnagy/openmina-fe:tutorial # TODO: change + build: + context: . + dockerfile: Dockerfile_FE + args: + BUILD_CONFIGURATION: block_producers ports: - - "8070:80" + - "8070:80" \ No newline at end of file From 65bf9f59494c787d954f1eced21d617fe959bfbf Mon Sep 17 00:00:00 2001 From: Adrian Nagy Date: Fri, 31 May 2024 18:36:06 +0200 Subject: [PATCH 6/8] chore: add --build option to compose --- docs/producer-demo.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/producer-demo.md b/docs/producer-demo.md index e508f22eec..627b431654 100644 --- a/docs/producer-demo.md +++ b/docs/producer-demo.md @@ -91,7 +91,7 @@ 3. **Run the following command to start the demo:** ```sh - docker compose -f docker-compose.local.producers.yml up + docker compose -f docker-compose.local.producers.yml up --build ``` 4. **Open you browser and visit http://localhost:8070** @@ -113,7 +113,7 @@ 4. **Run the following command to start the demo:** ```sh - docker compose -f docker-compose.local.producers.yml up + docker compose -f docker-compose.local.producers.yml up --build ``` 5. **Open you browser and visit http://localhost:8070** @@ -135,7 +135,7 @@ 4. **Run the following command to start the demo:** ```sh - docker compose -f docker-compose.local.producers.yml up + docker compose -f docker-compose.local.producers.yml up --build ``` 5. **Open you browser and visit http://localhost:8070** From 8766c8fcbd478e76de2327560ca163ef12fcb9ba Mon Sep 17 00:00:00 2001 From: Adrian Nagy Date: Fri, 31 May 2024 19:03:44 +0200 Subject: [PATCH 7/8] docs(producer-demo): Add short description --- docs/producer-demo.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/producer-demo.md b/docs/producer-demo.md index 627b431654..b6ef335507 100644 --- a/docs/producer-demo.md +++ b/docs/producer-demo.md @@ -1,5 +1,7 @@ # Producer Demo Launch Guide with Docker +This demo showcases the block production capabilities of OpenMina nodes within a private network. It launches three OpenMina nodes on your local machine, operating in a private network environment. For the purpose of this demonstration, block proofs are disabled. This setup allows you to observe block production immediately, without the need to wait for your account to be included in the staking ledger on testnets. + ## Table of Contents 1. [Prerequisites](#prerequisites) - [Docker Installation on Debian-based Linux](#docker-installation-on-debian-based-linux) From ea210d17c26c4ca0dec60f24e6d4f3a07e9436b2 Mon Sep 17 00:00:00 2001 From: Adrian Nagy Date: Fri, 31 May 2024 19:04:44 +0200 Subject: [PATCH 8/8] docs(producer-demo): Remove branch from clone (will work after release) --- docs/producer-demo.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/producer-demo.md b/docs/producer-demo.md index b6ef335507..61cbd0d0e9 100644 --- a/docs/producer-demo.md +++ b/docs/producer-demo.md @@ -82,7 +82,7 @@ This demo showcases the block production capabilities of OpenMina nodes within a 1. **Clone this repository:** ```bash - git clone https://github.com/openmina/openmina.git --branch chore/guide-producer-demo + git clone https://github.com/openmina/openmina.git ``` 2. **Navigate to the repository:** @@ -104,7 +104,7 @@ This demo showcases the block production capabilities of OpenMina nodes within a 2. **Clone this repository:** ```bash - git clone https://github.com/openmina/openmina.git --branch chore/guide-producer-demo + git clone https://github.com/openmina/openmina.git ``` 3. **Navigate to the repository:** @@ -126,7 +126,7 @@ This demo showcases the block production capabilities of OpenMina nodes within a 2. **Clone this repository:** ```bash - git clone https://github.com/openmina/openmina.git --branch chore/guide-producer-demo + git clone https://github.com/openmina/openmina.git ``` 3. **Navigate to the repository:**