From f09ffa9056baec600097374b9ba0a25546e90883 Mon Sep 17 00:00:00 2001 From: Dariusz Antoniuk Date: Fri, 22 Dec 2023 18:38:39 +0000 Subject: [PATCH] instructions for devpod --- README.md | 49 +++++++++++++++++++++++++++++++++------------ compose-devpod.yaml | 34 +++++++++++++++++++++++++++++++ compose-host.yaml | 18 +++++++++++++++++ compose.yaml | 12 +++++++++++ docker-compose.yaml | 28 -------------------------- 5 files changed, 100 insertions(+), 41 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/README.md b/README.md index ee76f58..dccd00e 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 +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 possim +docker-compose run --use-aliases possim ``` -Run with overridden config: +Once running, you can connect using: ```bash -docker-compose run possim CONFIG=/opt/privatenet/pbs_config.yaml +source .env +curl -v http://$POSSIM_HOSTNAME:15050 +``` + +To run with overridden config: + +```bash +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