package
1.1.1
Repository: https://github.com/obolnetwork/charon.git
Documentation: pkg.go.dev

# README

Charon Compose

Run, test, and debug a developer-focussed insecure local charon cluster using docker compose

Compose is a tool that generates docker-compose.yml files such that different charon clusters can be created and run.

The aim is for developers to be able to debug features and check functionality of clusters on their local machines.

The compose command should be executed in sequential steps:

  1. compose new: Creates a new config.json that defines what will be composed.
  2. compose define: Creates a docker-compose.yml that executes charon create dkg if keygen==dkg.
  3. compose lock: Creates a docker-compose.yml that executes charon create cluster or charon dkg.
  4. compose run: Creates a docker-compose.yml that executes charon run.

The compose command also includes some convenience functions.

  • compose clean: Cleans the compose directory of existing files.
  • compose auto: Runs compose define && compose lock && compose run.

Note that compose automatically runs docker compose up at the end of each command. This can be disabled via --up=false.

The compose new step configures the target cluster and key generation process. See compose new --help for supported flags.

Usage Examples

Install the compose binary:

# From inside the charon repo
go install github.com/obolnetwork/charon/testutil/compose/compose

# If `which compose` fails, then fix your environment: `export PATH=$PATH:$(go env GOPATH)/bin`. Or see https://go.dev/doc/gopath_code

# Alternatives:
# go install ./...
# cd testutil/compose/compose && go install .
# cd testutil/compose/compose && go build -o /tmp/compose/compose

Create a charon compose workspace folder:

cd /tmp
mkdir charon-compose
cd charon-compose

Create the default cluster:

compose clean && compose new && compose define && compose lock && compose run

Monitor the cluster via grafana and jaeger:

open http://localhost:3000/d/charon_overview_dashboard/charon-overview  # Open Grafana simnet dashboard
open http://localhost:16686                                             # Open Jaeger dashboard

Creating a DKG based cluster that uses locally built binary:

compose new --keygen=dkg --build-local
compose auto

Creating a cluster splitting existing keys for a public testnet:

# Prep the keys to split
# Each keystore-{foo}.json requires a keystore-{foo}.txt file containing the password.
mkdir mykeys
cp path/to/existing/keys/keystore-*.json mykeys/
cp path/to/passwords/keystore-*.txt mykeys/

compose new --split-keys-dir=mykeys --beacon-node=$BEACON_URL
compose auto

# Packages

Command compose provides a tool to run, test, debug local charon clusters using docker compose.
No description provided by the author
No description provided by the author

# Functions

Auto runs all three steps (define,lock,run) sequentially with support for detecting alerts.
BuildLocal builds an `obolnetwork/charon:local` docker container from source.
Clean deletes all compose directory files and artifacts.
Define defines a compose cluster; including both keygen and running definitions.
LoadConfig returns the config loaded from disk.
Lock creates a docker-compose.yml from a charon-compose.yml for generating keys and a cluster lock file.
New creates a new compose config file from flags.
NewDefaultConfig returns a new default config.
NewRunnerFunc returns a function that wraps and runs a run function.
Run creates a docker-compose.yml from config.json to run the cluster.
WriteConfig writes the config as yaml to disk.
WriteDockerCompose generates the docker-compose.yml template and writes it to disk.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
Config defines a local compose cluster; including both keygen and running a cluster.
TmplData is the docker-compose.yml template data.
TmplNode represents a charon TmplNode service in a docker-compose.yml.
TmplVC represents a validator client service in a docker-compose.yml.

# Type aliases

KeyGen defines a key generation process.
RunFunc defines a function that generates docker-compose.yml from config and returns the template data.
VCType defines a validator client type.