Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix localnet #94

Merged
merged 4 commits into from
Nov 17, 2022
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
62 changes: 62 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!--
Guiding Principles:

Changelogs are for humans, not machines.
There should be an entry for every single version.
The same types of changes should be grouped.
Versions and sections should be linkable.
The latest version comes first.
The release date of each version is displayed.
Mention whether you follow Semantic Versioning.

Usage:

Change log entries are to be added to the Unreleased section under the
appropriate stanza (see below). Each entry should ideally include a tag and
the Github issue reference in the following format:

* (<tag>) \#<issue-number> message

The issue numbers will later be link-ified during the release process so you do
not have to worry about including a link manually, but you can if you wish.

Types of changes (Stanzas):

"Features" for new features.
"Improvements" for changes in existing functionality.
"Deprecated" for soon-to-be removed features.
"Bug Fixes" for any bug fixes.
"Client Breaking" for breaking CLI commands and REST routes used by end-users.
"API Breaking" for breaking exported APIs used by developers building on SDK.
"State Machine Breaking" for any changes that result in a different AppState
given same genesisState and txList.
Ref: https://keepachangelog.com/en/1.0.0/
-->

# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Features

### Bug fixes

- [#94](https://github.com/envadiv/Passage3D/pull/94) Fix localnet commands in `Makefile`

### Misc Improvements

## [v1.1.0](https://github.com/envadiv/Passage3D/releases/tag/v1.1.0) - 2022-10-17

- Update cosmos-sdk to v0.45.9 and tendermint v0.34.21 which includes the patch for IBC issue
- fix lint by @anilCSE in https://github.com/envadiv/Passage3D/pull/79

**Full Changelog**: https://github.com/envadiv/Passage3D/compare/v1.0.0...v1.1.0

## [v1.0.0](https://github.com/envadiv/Passage3D/releases/tag/v1.0.0) - 2022-08-08

Initial Release!
23 changes: 17 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ COMMIT := $(shell git log -1 --format='%H')
LEDGER_ENABLED ?= true
BINDIR ?= $(GOPATH)/bin
BUILDDIR ?= $(CURDIR)/build
USER ?= ubuntu
TESTNETCHAINID ?= mytestnet
TESTNETDIR ?= $(CURDIR)/$(TESTNETCHAINID)
APP = ./passage
MOCKS_DIR = $(CURDIR)/tests/mocks
HTTPS_GIT := https://github.com/envadiv/Passage3D.git
Expand Down Expand Up @@ -489,13 +492,21 @@ proto-update-deps:
###############################################################################

# Run a 4-node testnet locally
localnet-start: build-linux localnet-stop
$(if $(shell $(DOCKER) inspect -f '{{ .Id }}' cosmossdk/passage-env 2>/dev/null),$(info found image cosmossdk/passage-env),$(MAKE) -C contrib/images passage-env)
$(DOCKER) run --rm -v $(CURDIR)/localnet:/data cosmossdk/passage-env \
testnet init-files --v 4 -o /data --starting-ip-address 192.168.10.2 --keyring-backend=test
docker-compose up -d
localnet-start: localnet-stop $(TESTNETDIR)
docker-compose up

$(TESTNETDIR): build-linux
$(BUILDDIR)/passage testnet \
--chain-id $(TESTNETCHAINID) \
--keyring-backend test \
--node-dir-prefix passagenode \
--node-daemon-home passage \
--starting-ip-address 192.168.0.2

localnet-stop:
docker-compose down

.PHONY: localnet-start localnet-stop
localnet-clean:
sudo rm -rf $(TESTNETDIR)

.PHONY: localnet-start localnet-stop localnet-clean
66 changes: 29 additions & 37 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,66 @@
version: "3"

services:
simdnode0:
container_name: simdnode0
image: "cosmossdk/simd-env"
passagenode0:
container_name: passagenode0
image: ubuntu:22.04
ports:
- "26656-26657:26656-26657"
- "1317:1317"
- "9090:9090"
environment:
- ID=0
- LOG=${LOG:-simd.log}
volumes:
- ./localnet:/data:Z
- ./mytestnet/passagenode0/passage/:/root/.passage:Z
- ./build/passage:/usr/local/bin/passage:Z
command: /usr/local/bin/passage start
networks:
localnet:
ipv4_address: 192.168.10.2

simdnode1:
container_name: simdnode1
image: "cosmossdk/simd-env"
ipv4_address: 192.168.0.2
passagenode1:
container_name: passagenode1
image: ubuntu:22.04
ports:
- "26666-26667:26656-26657"
- "1318:1317"
- "9091:9090"
environment:
- ID=1
- LOG=${LOG:-simd.log}
volumes:
- ./localnet:/data:Z
- ./mytestnet/passagenode1/passage/:/root/.passage:Z
- ./build/passage:/usr/local/bin/passage:Z
command: /usr/local/bin/passage start
networks:
localnet:
ipv4_address: 192.168.10.3

simdnode2:
container_name: simdnode2
image: "cosmossdk/simd-env"
environment:
- ID=2
- LOG=${LOG:-simd.log}
ipv4_address: 192.168.0.3
passagenode2:
container_name: passagenode2
image: ubuntu:22.04
ports:
- "26676-26677:26656-26657"
- "1319:1317"
- "9092:9090"
volumes:
- ./localnet:/data:Z
- ./mytestnet/passagenode2/passage/:/root/.passage:Z
- ./build/passage:/usr/local/bin/passage:Z
command: /usr/local/bin/passage start
networks:
localnet:
ipv4_address: 192.168.10.4

simdnode3:
container_name: simdnode3
image: "cosmossdk/simd-env"
environment:
- ID=3
- LOG=${LOG:-simd.log}
ipv4_address: 192.168.0.4
passagenode3:
container_name: passagenode3
image: ubuntu:22.04
ports:
- "26686-26687:26656-26657"
- "1320:1317"
- "9093:9090"
volumes:
- ./localnet:/data:Z
- ./mytestnet/passagenode3/passage/:/root/.passage:Z
- ./build/passage:/usr/local/bin/passage:Z
command: /usr/local/bin/passage start
networks:
localnet:
ipv4_address: 192.168.10.5

ipv4_address: 192.168.0.5
networks:
localnet:
driver: bridge
ipam:
driver: default
config:
- subnet: 192.168.10.0/16
- subnet: 192.168.0.0/16
53 changes: 53 additions & 0 deletions tests/localpassage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# LocalPassage

LocalPassage is a complete Passage testnet containerized with Docker and orchestrated with a simple docker-compose file. LocalPassage comes preconfigured with opinionated, sensible defaults for a standard testing environment.

LocalPassage comes with no initial state. In the future, we would like to be able to run LocalPassage with a mainnet export.

## Prerequisites

Ensure you have docker docker-compose, and golang installed:

```sh
# Docker
sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt install docker.io -y

# Docker compose
sudo apt install docker-compose -y

# Golang
curl -OL https://golang.org/dl/go1.18.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xvf go1.18.1.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
```

Alternatively, internal teams can use the AWS Launch Template `passage-localnet-devbox-template` to provision an instance with these dependencies already installed.

## LocalPassage - No Initial State

The following commands must be executed from the root folder of the Passage repository.

1. Make any change to the passage code that you want to test

2. Initialize LocalPassage:

```bash
make localnet-start
```

The command:

- Runs `passage testnet` to initialize the configuration files of the network. These will be stored under `./mytestnet`.
- Runs the `docker-compose.yml` file to spin up the networked nodes in separate containers.

3. You can stop the chain using Ctrl + C.

4. When you are done you can clean up the environment with:

```bash
make localnet-clean
```

Which will remove the configuration files found under `./mytestnet`.