Skip to content

Commit a37dc03

Browse files
committed
Make it work for a local node as well
1 parent 196e53d commit a37dc03

File tree

2 files changed

+51
-5
lines changed

2 files changed

+51
-5
lines changed

tools/docker/localdon/Makefile

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help build up setup down logs clean restart local-dev-up local-dev-setup local-dev-node
1+
.PHONY: help build up setup down logs clean restart local-dev-up local-dev-setup local-dev-setup-full local-dev-node
22

33
COMPOSE := docker compose
44
COMPOSE_LOCAL_DEV := docker compose -f docker-compose.yml -f docker-compose.local-dev.yml
@@ -74,6 +74,39 @@ local-dev-up: ## Start Docker services (postgres + anvil + 3 nodes; node-4 disab
7474
local-dev-setup: ## Run the setup script in local-dev mode
7575
cd $(REPO_ROOT)/core/scripts && go run ./setup-localdon --local-dev
7676

77+
local-dev-setup-full: local-dev-up ## Full local-dev setup: start Docker nodes, wait for local node-4, create keys, restart, deploy
78+
@echo ""
79+
@echo ">>> Start node-4 locally in another terminal: make local-dev-node"
80+
@echo ">>> Waiting for node-4 to become healthy on localhost:6691..."
81+
@until curl -sf http://localhost:6691/readyz > /dev/null 2>&1; do \
82+
printf "."; sleep 2; \
83+
done
84+
@echo " node-4 ready"
85+
@echo ""
86+
@echo "Creating secondary ETH keys on all 4 nodes..."
87+
cd $(REPO_ROOT)/core/scripts && go run ./setup-localdon --keys-only
88+
@echo ""
89+
@echo "Restarting Docker nodes 1-3 so TXMv2 picks up secondary keys..."
90+
$(COMPOSE_LOCAL_DEV) restart node-1 node-2 node-3
91+
@echo "Waiting for Docker nodes to become healthy after restart..."
92+
@for i in 1 2 3; do \
93+
printf " node-$$i: "; \
94+
until curl -sf http://localhost:$$(( 6687 + $$i ))/readyz > /dev/null 2>&1; do \
95+
printf "."; sleep 2; \
96+
done; \
97+
echo " ready"; \
98+
done
99+
@echo ""
100+
@echo ">>> Now restart node-4: Ctrl-C the local-dev-node process, then re-run: make local-dev-node"
101+
@echo ">>> Waiting for node-4 to become healthy on localhost:6691..."
102+
@until curl -sf http://localhost:6691/readyz > /dev/null 2>&1; do \
103+
printf "."; sleep 2; \
104+
done
105+
@echo " node-4 ready"
106+
@echo ""
107+
cd $(REPO_ROOT)/core/scripts && go run ./setup-localdon --local-dev
108+
@echo "Local-dev full setup complete."
109+
77110
local-dev-node: ## Run node-4 locally from source (logs to local-dev/node-4.log)
78111
@echo "Node-4 logs: $(LOCALDON_DIR)/local-dev/node-4.log"
79112
cd $(REPO_ROOT) && go run -mod=mod . \

tools/docker/localdon/README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,26 @@ If you already have a DON with secondary keys (e.g. after a previous `setup-full
4545

4646
Run node-4 from local source for fast iteration and debugging. The other 3 nodes + infra remain in Docker.
4747

48+
For **dual transmission**, use the full flow (handles secondary key creation + restarts):
49+
4850
```bash
49-
# Start Docker services (postgres, anvil, flashbots mock, 3 nodes; node-4 disabled)
50-
make local-dev-up
51+
# Terminal 1: start Docker infra + nodes 1-3, then wait for you to start node-4
52+
make local-dev-setup-full
5153

52-
# In a separate terminal: start node-4 from local source
54+
# Terminal 2 (when prompted): start node-4 from source
5355
make local-dev-node
56+
# The setup-full target will wait for node-4 to be healthy, create secondary keys,
57+
# then prompt you to restart node-4 (Ctrl-C + re-run make local-dev-node).
58+
# After node-4 is back, it deploys contracts and creates jobs automatically.
59+
```
60+
61+
For **primary-only** (or if keys already exist from a previous run):
5462

55-
# Once node-4 is healthy, deploy contracts and create jobs
63+
```bash
64+
make local-dev-up
65+
# In another terminal:
66+
make local-dev-node
67+
# Once node-4 is healthy:
5668
make local-dev-setup
5769
```
5870

@@ -72,6 +84,7 @@ To restart just node-4 after code changes, Ctrl-C the `local-dev-node` process a
7284
| `make build` | Build chainlink image from local source (optional) |
7385
| `make local-dev-up` | Start Docker services with node-4 disabled + P2P port exposed |
7486
| `make local-dev-setup` | Run setup script in local-dev mode |
87+
| `make local-dev-setup-full` | Full local-dev flow: up, wait for local node-4, create keys, restart all, deploy |
7588
| `make local-dev-node` | Run node-4 locally from source (`go run`) |
7689

7790
## Architecture

0 commit comments

Comments
 (0)