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 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/docker-compose.local.producers.yml b/docker-compose.local.producers.yml new file mode 100644 index 0000000000..6a03bfe635 --- /dev/null +++ b/docker-compose.local.producers.yml @@ -0,0 +1,21 @@ +services: + local-producer-cluster: + container_name: local-producer-cluster + build: + context: . + dockerfile: Dockerfile + entrypoint: ["openmina-node-testing", "scenarios-generate", "--name", "simulation-small-forever-real-time"] + ports: + - 11010:11010 + - 11012:11012 + - 11014:11014 + + frontend: + container_name: frontend + build: + context: . + dockerfile: Dockerfile_FE + args: + BUILD_CONFIGURATION: block_producers + ports: + - "8070:80" \ No newline at end of file diff --git a/docs/producer-demo.md b/docs/producer-demo.md new file mode 100644 index 0000000000..61cbd0d0e9 --- /dev/null +++ b/docs/producer-demo.md @@ -0,0 +1,143 @@ +# 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) + - [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 + ``` + +2. **Navigate to the repository:** + + ```bash + cd openmina + ``` + +3. **Run the following command to start the demo:** + ```sh + docker compose -f docker-compose.local.producers.yml up --build + ``` + +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 + ``` + +3. **Navigate to the repository:** + + ```bash + cd openmina + ``` + +4. **Run the following command to start the demo:** + ```sh + docker compose -f docker-compose.local.producers.yml up --build + ``` + +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 + ``` + +3. **Navigate to the repository:** + + ```bash + cd openmina + ``` + +4. **Run the following command to start the demo:** + ```sh + docker compose -f docker-compose.local.producers.yml up --build + ``` + +5. **Open you browser and visit http://localhost:8070**