Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement compose to debug local docker-compose clusters #568

Closed
corverroos opened this issue May 20, 2022 · 1 comment
Closed

Implement compose to debug local docker-compose clusters #568

corverroos opened this issue May 20, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@corverroos
Copy link
Contributor

Problem to be solved

Since charon-docker-compose has been repurposed to be more customer/user facing, advanced features has been removed from it. It therefore cannot do things like "run locally built binary", "DKG using docker compose", or "mock validators", or "simnet".

As charon core developers, we need a way to test all the features of charon locally using docker-compose.

Proposed solution

  • Write a go program called compose
  • It is the successor of the "old" charon-docker-compose for developers.
  • The aim is to be able to test charon locally using docker-compose.
  • It is different from the "new" charon-docker-compose in that it supports "advanced" features like build locally binary, split keys, docker-compose DKG, mock validators, etc.
  • It is aimed at Charon core developers, not external customers or users.
  • The "old" charon-docker-compose used a makefile to configure the cluster (make create-cluster, make split-keys, make disable-simnet, etc)
  • This is fine, but since I want to write this tool in Golang, we can improve on the UX a lot.
  • I propose to serve a simple web UI form to configure the cluster
  • The tool would serve this ( via compose define)
  • On submission, the tool will create a compose.yml file which contains the cluster definition and all the other stuff in the webui form.
  • The tool will also be configurable by direct manipulation of the compose.yml
  • The tool will live in the charon repo at package testutil/compose

Example flow:

  • compose define : populate form and submit, creates compose.yml which contains the cluster definition and other config.
  • compose lock && docker-compose up: creates docker-compose.yml for key generation and then creates keys and cluster lock
  • compose run && docker-compose up : creates docker-compose.yml for running the cluster and runs it.
@corverroos
Copy link
Contributor Author

Example web ui
image

@corverroos corverroos self-assigned this May 20, 2022
@corverroos corverroos added the enhancement New feature or request label May 20, 2022
obol-bulldozer bot pushed a commit that referenced this issue May 20, 2022
Implements the first iteration of the `compose define` command. It just uses default configuration for now and outputs the `compose.yml` file. Adding webui can be done later.

category: feature 
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 21, 2022
Adds the first version of the lock command that creates a docker-compose file to run `charon create cluster` to generate keys and cluster lock file.

category: feature
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 21, 2022
Implements the `compose run` command that generates a docker-compose.yml for running a cluster.

category: feature
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 21, 2022
Adds support for DKG key generation to compose lock command.

category: feature
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 23, 2022
Aligns the `define` step with the other two steps (`lock` and `run`) by also creating a `docker-compose.yml` file as output.
This also ensures we test `charon create dkg` with compose. Just do noop for other keygens in this step.

category: refactor
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 23, 2022
Add automatically calling of docker-compose up after each command. Adding support for chaining commands: `compose define && compose lock && compose run`

category: feature
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 23, 2022
Extracts `clean` into its own command. Add `Step` to config and verify that config is incorrect state for each step.

category: refactor 
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 23, 2022
Adds prometheus/grafana/jaeger monitoring to `compose run` command. The static assets are embedded into the `compose` binary and written to disk on `compose define`. 

Also rename `NodeOnly` to `Bootnode`.

category: feature
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 23, 2022
Renames `charon-compose.yml` to `config.json` in order to differentiate and distinguish it from `docker-compose.yml`. 

category: refactor
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 23, 2022
Adds support for locally built binaries via `compose define --build-local`. Thereby adding support for changing the source code inside the container. This is required for proper debugging. 

Note this requires the `CHARON_REPO` env var to be set. Developers are advised to put this in their bash profile.

category: feature 
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 23, 2022
Adds a readme to compose

category: docs
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 23, 2022
Adds support for real VCs. 

category: feature
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 24, 2022
Refactors compose:
 - Decouple `new` from `define`: `new` only creates config.json file, `define` is now identical to `lock` and `run`; it only creates docker-compose files.
 - This adds support for using existing config files, and generating clusters from them
 - Add convenience function `compose auto` that runs `compose define && compose lock && compose run`, since this will be the most common use-case.
 
 Result:
 ```
 compose new --keygen==dkg && compose auto
 ``` 

category: refactor 
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 24, 2022
Make `compose clean` safe, by checking if config.json is present (and double check that no go files are present).

Note: I deleted my whole charon repo by running `compose clean` in the wrong folder  🤦 

Also pull latest docker image in define step.

category: bug 
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 24, 2022
Adds `split-keys-dir` and `beacon-node` flags to compose config to support splitting keys and connecting to real beacon node.

category: feature
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 24, 2022
Add splitting public testnet keys to readme.

category: docs
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 25, 2022
Adds the ability to enable different feature sets to compose.

Also fix issue with teku vc config.

category: feature
ticket: #568
obol-bulldozer bot pushed a commit that referenced this issue May 26, 2022
Fixes DKG flow in compose.

category: bug
ticket: #568
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant