Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions book/src/framework/components/chainlink/nodeset.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This component requires some Blockchain to be deployed, add this to config

Then configure NodeSet
```toml
[nodeset]
[[nodesets]]
# unique NodeSet name
name = "don"
# amount of Chainlink nodes to spin up
Expand All @@ -55,17 +55,17 @@ Then configure NodeSet
# P2P API port range start, each new node get port incremented (host machine)
p2p_port_range_start = 12000

[nodeset.db]
[nodesets.db]
# PostgreSQL image version and tag
image = "postgres:12.0"
# Pulls the image every time if set to 'true', used like that in CI. Can be set to 'false' to speed up local runs
pull_image = false
# PostgreSQL volume name
volume_name = ""

[[nodeset.node_specs]]
[[nodesets.node_specs]]

[nodeset.node_specs.node]
[nodesets.node_specs.node]
# custom ports that plugins may need to expose and map to the host machine
custom_ports = [14000, 14001]
# A list of paths to capability binaries
Expand Down Expand Up @@ -96,16 +96,16 @@ Then configure NodeSet
"""

# Outputs are the results of deploying a component that can be used by another component
[nodeset.out]
[nodesets.out]
# If 'use_cache' equals 'true' we skip component setup when we run the test and return the outputs
use_cache = true

# Describes deployed or external Chainlink nodes
[[nodeset.out.cl_nodes]]
[[nodesets.out.cl_nodes]]
use_cache = true

# Describes deployed or external Chainlink node
[nodeset.out.cl_nodes.node]
[nodesets.out.cl_nodes.node]
# API user name
api_auth_user = '[email protected]'
# API password
Expand All @@ -115,15 +115,15 @@ Then configure NodeSet
p2p_url = "http://127.0.0.1:32996"
url = "http://127.0.0.1:33096"
# Describes PostgreSQL instance
[nodeset.out.cl_nodes.postgresql]
[nodesets.out.cl_nodes.postgresql]
# PostgreSQL connection string
# in case of using external database can be overriden
url = "postgresql://chainlink:[email protected]:33094/chainlink?sslmode=disable"

# Can have more than one node, fields are the same, see above ^^
[[nodeset.out.cl_nodes]]
[nodeset.out.cl_nodes.node]
[nodeset.out.cl_nodes.postgresql]
[[nodesets.out.cl_nodes]]
[nodesets.out.cl_nodes.node]
[nodesets.out.cl_nodes.postgresql]
...
```

Expand All @@ -141,7 +141,7 @@ import (

type Config struct {
BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"`
NodeSet *ns.Input `toml:"nodeset" validate:"required"`
NodeSets []*ns.Input `toml:"nodesets" validate:"required"`
}

func TestMe(t *testing.T) {
Expand Down
12 changes: 6 additions & 6 deletions book/src/framework/components/external.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@ For example, to integrate with remote `k8s` environment you can use `CTF_CONFIGS
http_url = "http://127.0.0.1:8545"
ws_url = "ws://127.0.0.1:8545"

[nodeset]
[[nodesets]]

[[nodeset.node_specs]]
[[nodesets.node_specs]]
...

[nodeset.out]
[nodesets.out]
use_cache = true

[[nodeset.out.cl_nodes]]
[[nodesets.out.cl_nodes]]
use_cache = true

[nodeset.out.cl_nodes.node]
[nodesets.out.cl_nodes.node]
# set up your user/password for API authorization
api_auth_user = '[email protected]'
api_auth_password = 'fj293fbBnlQ!f9vNs'
# set up each node URLs
p2p_url = "http://127.0.0.1:12000"
url = "http://127.0.0.1:10000"

[nodeset.out.cl_nodes.postgresql]
[nodesets.out.cl_nodes.postgresql]
# set up a database URL so tests can connect to your database if needed
url = "postgresql://chainlink:[email protected]:13000/db_0?sslmode=disable"

Expand Down
14 changes: 7 additions & 7 deletions book/src/framework/components/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ Defaults are:
- [NodeSet](../components/chainlink/nodeset.md) (Delve debugger): `40000..400XX` (if you are using debug image)
- Shared `PostgreSQL` volume is called `postgresql_data`
```
[nodeset]
[[nodesets]]
# HTTP API port range start, each new node get port incremented (host machine)
http_port_range_start = 10000
# P2P API port range start, each new node get port incremented (host machine)
p2p_port_range_start = 12000
```
- [PostgreSQL](../components/chainlink/nodeset.md): `13000` (we do not allow to have multiple databases for now, for simplicity)
```
[nodeset.node_specs.db]
[nodesets.node_specs.db]
# PostgreSQL volume name
volume_name = "a"
# PostgreSQL port (host machine)
Expand All @@ -34,7 +34,7 @@ When you run `ctf d rm` database volume will be **removed**.

One node set is enough for any kind of testing, if you need more nodes consider extending your existing node set:
```
[nodeset]
[[nodesets]]
nodes = 10
```
</div>
Expand All @@ -43,17 +43,17 @@ One node set is enough for any kind of testing, if you need more nodes consider

You can also define a custom set of ports for any node.
```toml
[nodeset]
[[nodesets]]
name = "don"
nodes = 5
override_mode = "each"

[nodeset.db]
[nodesets.db]
image = "postgres:12.0"

[[nodeset.node_specs]]
[[nodesets.node_specs]]

[nodeset.node_specs.node]
[nodesets.node_specs.node]
# here we defined 2 new ports to listen and mapped them to our host machine
# syntax is "host:docker"
custom_ports = ["14000:15000"]
Expand Down
8 changes: 4 additions & 4 deletions book/src/framework/nodeset_capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ Create a configuration file `smoke.toml`
type = "anvil"
docker_cmd_params = ["-b", "1"]

[nodeset]
[[nodesets]]
name = "don"
nodes = 5
override_mode = "all"

[nodeset.db]
[nodesets.db]
image = "postgres:12.0"

[[nodeset.node_specs]]
[[nodesets.node_specs]]

[nodeset.node_specs.node]
[nodesets.node_specs.node]
# path to your capability binaries
capabilities = ["./kvstore"]
# default capabilities directory
Expand Down
24 changes: 12 additions & 12 deletions book/src/framework/nodeset_compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,45 @@ Create a configuration file `smoke.toml`
type = "anvil"
docker_cmd_params = ["-b", "1"]

[nodeset]
[[nodesets]]
name = "don"
nodes = 5
override_mode = "each"

[nodeset.db]
[nodesets.db]
image = "postgres:12.0"

[[nodeset.node_specs]]
[[nodesets.node_specs]]

[nodeset.node_specs.node]
[nodesets.node_specs.node]
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
user_config_overrides = " [Log]\n level = 'info'\n "
user_secrets_overrides = ""

[[nodeset.node_specs]]
[[nodesets.node_specs]]

[nodeset.node_specs.node]
[nodesets.node_specs.node]
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
user_config_overrides = " [Log]\n level = 'info'\n "
user_secrets_overrides = ""

[[nodeset.node_specs]]
[[nodesets.node_specs]]

[nodeset.node_specs.node]
[nodesets.node_specs.node]
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
user_config_overrides = " [Log]\n level = 'info'\n "
user_secrets_overrides = ""

[[nodeset.node_specs]]
[[nodesets.node_specs]]

[nodeset.node_specs.node]
[nodesets.node_specs.node]
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
user_config_overrides = " [Log]\n level = 'info'\n "
user_secrets_overrides = ""

[[nodeset.node_specs]]
[[nodesets.node_specs]]

[nodeset.node_specs.node]
[nodesets.node_specs.node]
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
user_config_overrides = " [Log]\n level = 'info'\n "
user_secrets_overrides = ""
Expand Down
8 changes: 4 additions & 4 deletions book/src/framework/nodeset_docker_rebuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ Create a configuration file `smoke.toml`
type = "anvil"
docker_cmd_params = ["-b", "1"]

[nodeset]
[[nodesets]]
name = "don"
nodes = 5
override_mode = "all"

[nodeset.db]
[nodesets.db]
image = "postgres:12.0"

[[nodeset.node_specs]]
[[nodesets.node_specs]]

[nodeset.node_specs.node]
[nodesets.node_specs.node]
# Dockerfile path is relative to "docker_ctx"
docker_file = "core/chainlink.Dockerfile"
docker_ctx = "../.."
Expand Down
8 changes: 4 additions & 4 deletions book/src/framework/nodeset_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ Create a configuration file `smoke.toml`
type = "anvil"
docker_cmd_params = ["-b", "1"]

[nodeset]
[[nodesets]]
name = "don"
nodes = 5
override_mode = "all"

[nodeset.db]
[nodesets.db]
image = "postgres:12.0"

[[nodeset.node_specs]]
[[nodesets.node_specs]]

[nodeset.node_specs.node]
[nodesets.node_specs.node]
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
```

Expand Down
1 change: 1 addition & 0 deletions framework/.changeset/v0.7.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Use nodesets slice everywhere to ease multi-DON configuration
8 changes: 2 additions & 6 deletions framework/components/simple_node_set/node_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,9 @@ func sharedDBSetup(in *Input, bcOut *blockchain.Output) (*Output, error) {
eg := &errgroup.Group{}
mu := &sync.Mutex{}
for i := 0; i < in.Nodes; i++ {
var overrideIdx int
overrideIdx := i
var nodeName string
switch in.OverrideMode {
case "each":
overrideIdx = i
case "all":
overrideIdx = 0
if in.OverrideMode == "all" {
if len(in.NodeSpecs[overrideIdx].Node.CustomPorts) > 0 {
return nil, fmt.Errorf("custom_ports can be used only with override_mode = 'each'")
}
Expand Down
29 changes: 1 addition & 28 deletions framework/components/simple_node_set/nodeset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,7 @@ func checkBasicOutputs(t *testing.T, output *ns.Output) {

func TestSmokeComponentDockerNodeSetSharedDB(t *testing.T) {
testCases := []testCase{
{
name: "2 nodes cluster, override mode 'all'",
bcInput: &blockchain.Input{
Type: "anvil",
Image: "f4hrenh9it/foundry",
Port: "8545",
ChainID: "31337",
},
nodeSetInput: &ns.Input{
Name: "don-1",
Nodes: 2,
OverrideMode: "all",
DbInput: &postgres.Input{
Image: "postgres:12.0",
},
NodeSpecs: []*clnode.Input{
{
Node: &clnode.NodeInput{
Image: "public.ecr.aws/chainlink/chainlink:v2.17.0",
Name: "cl-node",
},
},
},
},
assertion: func(t *testing.T, output *ns.Output) {
checkBasicOutputs(t, output)
},
},
// only 'each' mode is available when using as code to simplify configuration
{
name: "2 nodes cluster, override mode 'each'",
bcInput: &blockchain.Input{
Expand Down
Loading
Loading