From 5b7e7c6c95f5351f7b2ceef7657d6b052d3e538e Mon Sep 17 00:00:00 2001 From: Dariusz Antoniuk Date: Fri, 22 Dec 2023 18:38:39 +0000 Subject: [PATCH 1/3] instructions for devpod --- .github/workflows/ci.yml | 4 ++-- README.md | 51 +++++++++++++++++++++++++++++----------- compose-devpod.yaml | 34 +++++++++++++++++++++++++++ compose-host.yaml | 18 ++++++++++++++ compose.yaml | 12 ++++++++++ docker-compose.yaml | 28 ---------------------- 6 files changed, 103 insertions(+), 44 deletions(-) create mode 100644 compose-devpod.yaml create mode 100644 compose-host.yaml create mode 100644 compose.yaml delete mode 100644 docker-compose.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8dddec5..6dc2a34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,8 @@ jobs: - name: Build Ethereum PoS simulator run: | - docker-compose build possim + docker compose build possim - name: Run Ethereum PoS test suite run: | - docker-compose run possim test + docker compose run possim test diff --git a/README.md b/README.md index ee76f58..fd41c91 100644 --- a/README.md +++ b/README.md @@ -42,23 +42,53 @@ How to use ---------- The primary interface for users is the container one, -accessed via `docker-compose` utility. +accessed via `docker compose` utility (docker compose v2, do not confuse with +v2 of the docker-compose spec, which is obsolete). -To get fresh privatenet up and running, invoke: +First, chose how you want to run the project and save your configuration in the +`.env` file: +* if you're using the opus devpod (internal chorus one project) run: ```bash -docker-compose build possim -docker-compose run possim +echo "COMPOSE_FILE=compose-devpod.yaml" > .env +echo "COMPOSE_PROJECT_NAME=${C1_DOCKER_NAMESPACE}-possim" >> .env +echo "POSSIM_DOCKER_NETWORK=${C1_DOCKER_NETWORK}" >> .env +echo "POSSIM_BINDMOUNT_PATH=$(host-path-outside-of-docker.sh .)" >> .env +echo "POSSIM_HOSTNAME=${C1_DOCKER_NAMESPACE}-possim.devel" >> .env +``` +* otherwise for linux host networking configuration run: +```bash +echo "COMPOSE_FILE=compose-host.yaml" > .env +echo "POSSIM_HOSTNAME=127.0.0.1" >> .env +``` + +Once you've set up your env you can get the privatenet up and running using: + +```bash +docker compose build possim +docker compose run --use-aliases possim +``` + +Once running, you can connect using: + +```bash +source .env +curl -v http://$POSSIM_HOSTNAME:15050 ``` -Run with overridden config: +To run with overridden config: ```bash -docker-compose run possim CONFIG=/opt/privatenet/pbs_config.yaml +docker compose run --use-aliases possim CONFIG=/opt/privatenet/pbs_config.yaml ``` See [configuration.yaml](./eth_possim/resources/configuration.yaml) for the default values. +How to test +----------- +```bash +docker compose run possim test +``` How it works inside the container ---------------------------------- @@ -67,11 +97,4 @@ the components. Then, `tilt up` command starts the blockchain. -And finally, `make` file binds generation and tilt start together. - - -How to test ------------ -```bash -docker-compose run possim test -``` +And finally, `make` file binds generation and tilt start together. \ No newline at end of file diff --git a/compose-devpod.yaml b/compose-devpod.yaml new file mode 100644 index 0000000..29ad5f5 --- /dev/null +++ b/compose-devpod.yaml @@ -0,0 +1,34 @@ +# this compose file is written and invoked using the guidelines defined here: +# https://github.com/ChorusOne/hopper-build-container/blob/main/docker.md +# so that the project can be run in all docker-outside-of-docker environments +# (devpod, github ci, cloud build, etc) +networks: + default: + external: true + name: ${POSSIM_DOCKER_NETWORK:-${C1_DOCKER_NETWORK}} + +services: + possim: + extends: + file: compose.yaml + service: possim + networks: + default: + aliases: + # use an alias with a .devel tld to avoid DNS resolution + # normally we'd just use the `container-name.` hostname, but the container_name + # is ignored when running using docker compose run command + - ${POSSIM_HOSTNAME} + expose: + # execution wsrpc + - "18546" + # execution rpc + - "18544" + # beacon rest + - "15050" + # beacon teku + - "15051" + # beacon lighthouse + - "15151" + # mev relay + - "38000" \ No newline at end of file diff --git a/compose-host.yaml b/compose-host.yaml new file mode 100644 index 0000000..2740ae2 --- /dev/null +++ b/compose-host.yaml @@ -0,0 +1,18 @@ +services: + possim: + extends: + file: compose.yaml + service: possim + ports: + # execution wsrpc + - "18546:18546" + # execution rpc + - "18544:18544" + # beacon rest + - "15050:15050" + # beacon teku + - "15051:15051" + # beacon lighthouse + - "15151:15151" + # mev relay + - "38000:38000" \ No newline at end of file diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..adce6c6 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,12 @@ +services: + possim: + build: . + volumes: + - ${POSSIM_BINDMOUNT_PATH:-.}/eth_possim:/opt/privatenet/eth_possim:ro + - ${POSSIM_BINDMOUNT_PATH:-.}/Tiltfile:/opt/privatenet/Tiltfile:ro + - ${POSSIM_BINDMOUNT_PATH:-.}/Makefile:/opt/privatenet/Makefile:ro + - ${POSSIM_BINDMOUNT_PATH:-.}/.data:/opt/privatenet/.data:rw + - ${POSSIM_BINDMOUNT_PATH:-.}/tests:/opt/privatenet/tests + - ${POSSIM_BINDMOUNT_PATH:-.}/requirements-dev.txt:/opt/privatenet/requirements-dev.txt + - ${POSSIM_BINDMOUNT_PATH:-.}/pbs_config.yaml:/opt/privatenet/pbs_config.yaml + command: freshrun \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index 0f7e43b..0000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,28 +0,0 @@ -version: "3.9" - -services: - - possim: - build: . - volumes: - - ./eth_possim:/opt/privatenet/eth_possim:ro - - ./Tiltfile:/opt/privatenet/Tiltfile:ro - - ./Makefile:/opt/privatenet/Makefile:ro - - ./.data:/opt/privatenet/.data:rw - - ./tests:/opt/privatenet/tests - - ./requirements-dev.txt:/opt/privatenet/requirements-dev.txt - - ./pbs_config.yaml:/opt/privatenet/pbs_config.yaml - ports: - # execution wsrpc - - "18546:18546" - # execution rpc - - "18544:18544" - # beacon rest - - "15050:15050" - # beacon teku - - "15051:15051" - # beacon lighthouse - - "15151:15151" - # mev relay - - "38000:38000" - command: freshrun From 714c7517a89a22ea571bf5d5410b840cd06f9892 Mon Sep 17 00:00:00 2001 From: Dariusz Antoniuk Date: Tue, 26 Dec 2023 16:58:40 +0000 Subject: [PATCH 2/3] remove containers after run by default --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fd41c91..eee068f 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Once you've set up your env you can get the privatenet up and running using: ```bash docker compose build possim -docker compose run --use-aliases possim +docker compose run --use-aliases --rm possim ``` Once running, you can connect using: @@ -79,7 +79,7 @@ curl -v http://$POSSIM_HOSTNAME:15050 To run with overridden config: ```bash -docker compose run --use-aliases possim CONFIG=/opt/privatenet/pbs_config.yaml +docker compose run --use-aliases --rm possim CONFIG=/opt/privatenet/pbs_config.yaml ``` See [configuration.yaml](./eth_possim/resources/configuration.yaml) for the default values. @@ -87,7 +87,7 @@ See [configuration.yaml](./eth_possim/resources/configuration.yaml) for the defa How to test ----------- ```bash -docker compose run possim test +docker compose run --rm possim test ``` How it works inside the container From 35b2352f838566fff88d6ef3c0f1ddade0bcdd5f Mon Sep 17 00:00:00 2001 From: Dariusz Antoniuk Date: Wed, 27 Dec 2023 11:54:34 +0000 Subject: [PATCH 3/3] simplify default possim hostname --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eee068f..2c81cca 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ echo "COMPOSE_FILE=compose-devpod.yaml" > .env echo "COMPOSE_PROJECT_NAME=${C1_DOCKER_NAMESPACE}-possim" >> .env echo "POSSIM_DOCKER_NETWORK=${C1_DOCKER_NETWORK}" >> .env echo "POSSIM_BINDMOUNT_PATH=$(host-path-outside-of-docker.sh .)" >> .env -echo "POSSIM_HOSTNAME=${C1_DOCKER_NAMESPACE}-possim.devel" >> .env +echo "POSSIM_HOSTNAME=possim.devel" >> .env ``` * otherwise for linux host networking configuration run: ```bash