Skip to content

Commit ee1d8f6

Browse files
committed
external components
1 parent c92943e commit ee1d8f6

File tree

3 files changed

+63
-18
lines changed

3 files changed

+63
-18
lines changed

book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- [Test Configuration](./framework/test_configuration_overrides.md)
1717
- [Components Persistence](framework/components/state.md)
1818
- [Components Caching](framework/components/caching.md)
19+
- [External Environment](framework/components/external.md)
1920
- [Secrets]()
2021
- [Docker](framework/docker.md)
2122
- [Observability Stack](framework/observability/observability_stack.md)

book/src/framework/components/caching.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,3 @@ If cached config has any outputs with `use_cache = true` it will be used instead
99
```
1010
export CTF_CONFIGS=smoke-cache.toml
1111
```
12-
13-
### Using remote components
14-
15-
Because components are decoupled through outputs, you can use a cached config and switch outputs to any deployed infrastructure, such as staging. This allows you to reuse the same testing logic for behavior validation.
16-
17-
Example:
18-
```
19-
[blockchain_a.out]
20-
use_cache = true
21-
chain_id = '31337'
22-
23-
[[blockchain_a.out.nodes]]
24-
ws_url = 'ws://127.0.0.1:33447'
25-
http_url = 'http://127.0.0.1:33447'
26-
docker_internal_ws_url = 'ws://anvil-3716a:8900'
27-
docker_internal_http_url = 'http://anvil-3716a:8900'
28-
```
29-
Set flag `use_cache = true` on any component output, change output fields as needed and run your test again.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# External Environment
2+
3+
### Using remote components
4+
5+
Because components are decoupled through outputs, you can use a cached config and switch outputs to any deployed infrastructure, such as staging.
6+
7+
This allows you to reuse the same testing logic for behavior validation.
8+
9+
For example, to integrate with remote `k8s` environment you can use `CTF_CONFIGS=smoke_external.toml` and override all the outputs of components to connect to your remote env.
10+
11+
```toml
12+
[blockchain_a]
13+
14+
[blockchain_a.out]
15+
chain_id = "31337"
16+
use_cache = true
17+
18+
[[blockchain_a.out.nodes]]
19+
# set up your RPC URLs
20+
docker_internal_http_url = "http://anvil-2cfcf:8545"
21+
docker_internal_ws_url = "ws://anvil-2cfcf:8545"
22+
http_url = "http://127.0.0.1:8545"
23+
ws_url = "ws://127.0.0.1:8545"
24+
25+
[contracts]
26+
27+
[contracts.out]
28+
# set up your contracts
29+
addresses = ["0x5fbdb2315678afecb367f032d93f642f64180aa3"]
30+
use_cache = true
31+
32+
[data_provider]
33+
port = 9111
34+
35+
[data_provider.out]
36+
# setup your data provider URLs
37+
base_url_docker = "http://host.docker.internal:9111"
38+
base_url_host = "http://localhost:9111"
39+
40+
[nodeset]
41+
42+
[[nodeset.node_specs]]
43+
44+
[nodeset.out]
45+
use_cache = true
46+
47+
[[nodeset.out.cl_nodes]]
48+
use_cache = true
49+
50+
[nodeset.out.cl_nodes.node]
51+
# set up each node URLs
52+
docker_internal_url = "http://node0:6688"
53+
p2p_docker_internal_url = "http://node0:6690"
54+
p2p_url = "http://127.0.0.1:12000"
55+
url = "http://127.0.0.1:10000"
56+
57+
[nodeset.out.cl_nodes.postgresql]
58+
# set up a database URL so tests can connect to your database if needed
59+
url = "postgresql://chainlink:[email protected]:13000/db_0?sslmode=disable"
60+
61+
# more nodes in this array, configuration is the same ...
62+
```

0 commit comments

Comments
 (0)