Skip to content

Commit

Permalink
Merge pull request #287 from terra-money/feat/docker-localnet
Browse files Browse the repository at this point in the history
feat: introduce docker localnet
  • Loading branch information
emidev98 authored Mar 25, 2024
2 parents da882bb + 2b57c83 commit b652921
Show file tree
Hide file tree
Showing 10 changed files with 686 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
build/
integration-tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# OS
.testnets
.DS_Store
*.swp
*.swo
Expand Down
26 changes: 25 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,28 @@ format: format-tools
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*statik*" -not -name '*.pb.go' | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*statik*" -not -name '*.pb.go' | xargs goimports -w -local github.com/cosmos/cosmos-sdk

.PHONY: lint lint-fix lint-docker format-tools format
.PHONY: lint lint-fix lint-docker format-tools format


###############################################################################
### Local Testnet (docker) ###
###############################################################################

localnet-rmi:
$(DOCKER) rmi terra-money/localnet-core 2>/dev/null; true

localnet-build-env: localnet-rmi
$(DOCKER) build --tag terra-money/localnet-core -f scripts/containers/Dockerfile \
$(shell git rev-parse --show-toplevel)

localnet-build-nodes:
$(DOCKER) run --rm -v $(CURDIR)/.testnets:/terra terra-money/localnet-core \
testnet init-files --v 3 -o /terra --starting-ip-address 192.168.15.20 --keyring-backend=test --chain-id=core-testnet-1
$(DOCKER) compose up -d

localnet-stop:
$(DOCKER) compose down

localnet-start: localnet-stop localnet-build-env localnet-build-nodes

.PHONY: localnet-stop localnet-start localnet-build-env localnet-build-nodes localnet-rmi
3 changes: 2 additions & 1 deletion cmd/terrad/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ func initRootCmd(rootCmd *cobra.Command, moduleBasics module.BasicManager, encod
a := appCreator{encodingConfig}

rootCmd.AddCommand(
InitCmd(terraapp.ModuleBasics, terraapp.DefaultNodeHome),
InitCmd(moduleBasics, terraapp.DefaultNodeHome),
config.Cmd(),
tmcli.NewCompletionCmd(rootCmd, true),
debug.Cmd(),
pruning.Cmd(a.newApp, terraapp.DefaultNodeHome),
snapshot.Cmd(a.newApp),
NewTestnetCmd(moduleBasics),
)

server.AddCommands(rootCmd, terraapp.DefaultNodeHome, a.newApp, a.appExport, addModuleInitFlags)
Expand Down
Loading

0 comments on commit b652921

Please sign in to comment.