Skip to content

Commit 1b5e2ac

Browse files
Merge #4124
4124: Modify Localnet image-build behaviour, update documentation r=jordanschalm a=jordanschalm The original default behaviour for Localnet was to always re-build all images, every time a new network was started. At some point, this default behaviour changed, so that images are not re-built, but the documentation was not updated. This diff: - changes default behaviour back to build images each time localnet is started (original behaviour: trade-speed-for-safety) - adds option (make start-cached etc) to start without building images (current behaviour: trade-safety-for-speed) - updates the documentation Co-authored-by: Jordan Schalm <[email protected]>
2 parents 2d82a5a + 197bbf0 commit 1b5e2ac

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

integration/localnet/Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,30 @@ bootstrap-ci:
8383
bootstrap-short-epochs:
8484
$(MAKE) -e EPOCHLEN=200 STAKINGLEN=10 DKGLEN=50 bootstrap
8585

86+
# Starts the network - must have been bootstrapped first. Builds fresh images.
8687
.PHONY: start
8788
start: start-metrics start-flow
8889

90+
# Starts the network, using the most recently built images.
91+
# Useful for rapid iteration, when no code has changed or only one images needs to be re-built.
92+
.PHONY: start-cached
93+
start-cached: start-metrics start-flow-cached
94+
8995
# Starts metrics services
9096
.PHONY: start-metrics
9197
start-metrics:
9298
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f docker-compose.metrics.yml up -d
9399

94-
# Starts a version of localnet with just flow nodes and without metrics services. This prevents port collision and consumption
95-
# when these services are not needed.
100+
# Starts a version of localnet with just flow nodes and without metrics services.
101+
# This prevents port collision and consumption when these services are not needed.
102+
# All images are re-built prior to being started.
96103
.PHONY: start-flow
97104
start-flow:
105+
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f docker-compose.nodes.yml up -d --build
106+
107+
# Same as start-flow, but most recently built images are used.
108+
.PHONY: start-flow-cached
109+
start-flow-cached:
98110
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f docker-compose.nodes.yml up -d
99111

100112
.PHONY: build-flow

integration/localnet/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ and then start the test network:
7474
make start
7575
```
7676

77+
Alternatively, this command will start the test network without re-building, using the most recently built image.
78+
```shell
79+
make start-cached
80+
```
81+
82+
7783
## Stop the network
7884

7985
The network needs to be stopped between each consecutive run to clear the chain state:
@@ -82,6 +88,13 @@ The network needs to be stopped between each consecutive run to clear the chain
8288
make stop
8389
```
8490

91+
## Build Localnet images
92+
93+
To build images for Localnet, run this command.
94+
```shell
95+
make build-flow
96+
```
97+
8598
## Logs
8699

87100
You can view log output from all nodes:

integration/localnet/bootstrap.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ func main() {
164164
displayPortAssignments()
165165
fmt.Println()
166166

167-
fmt.Print("Run \"make start\" to launch the network.\n")
167+
fmt.Println("Run \"make start\" to re-build images and launch the network.")
168+
fmt.Println("Run \"make start-cached\" to launch the network without rebuilding images")
168169
}
169170

170171
func displayFlowNetworkConf(flowNetworkConf testnet.NetworkConfig) {

state/protocol/badger/validity.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ func IsValidRootSnapshotQCs(snap protocol.Snapshot) error {
290290
}
291291
err = validateClusterQC(cluster)
292292
if err != nil {
293-
return fmt.Errorf("invalid cluster qc %d: %W", clusterIndex, err)
293+
return fmt.Errorf("invalid cluster qc %d: %w", clusterIndex, err)
294294
}
295295
}
296296
return nil

0 commit comments

Comments
 (0)