Skip to content

Commit

Permalink
Merge pull request #9 from ChorusOne/devpod
Browse files Browse the repository at this point in the history
Instructions and config changes for running in a devpod
  • Loading branch information
QAston authored Dec 27, 2023
2 parents 6682aeb + 35b2352 commit c42a4f6
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
51 changes: 37 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=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 --rm 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 --rm 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 --rm possim test
```

How it works inside the container
----------------------------------
Expand All @@ -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.
34 changes: 34 additions & 0 deletions compose-devpod.yaml
Original file line number Diff line number Diff line change
@@ -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"
18 changes: 18 additions & 0 deletions compose-host.yaml
Original file line number Diff line number Diff line change
@@ -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"
12 changes: 12 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 0 additions & 28 deletions docker-compose.yaml

This file was deleted.

0 comments on commit c42a4f6

Please sign in to comment.