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

Unified network configuration generation #267

Merged
merged 97 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from 79 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
0ce6d9e
Refactor: Docker Compose Easy Setup
jay-dee7 Dec 10, 2021
e85cba2
Changed action to reflect the updates
Eengineer1 Dec 10, 2021
f52d351
Add: long-syntax for ports in docker-compose config
jay-dee7 Dec 13, 2021
d20aab7
File structure and workflows
Eengineer1 Dec 13, 2021
95c8c9e
Merge branch 'new-docker-compose' of https://github.com/cheqd/cheqd-n…
Eengineer1 Dec 13, 2021
59fe235
Switched permissions
Eengineer1 Dec 13, 2021
3978c17
Copy as root then own it
Eengineer1 Dec 13, 2021
51e96b6
Added permissions
Eengineer1 Dec 13, 2021
52fca4d
Created localnet setup extracted from workflow
Eengineer1 Dec 13, 2021
687c8cc
Removed volume from Dockerfile
Eengineer1 Dec 14, 2021
03ce3ef
Switched directory to match changes
Eengineer1 Dec 14, 2021
137ab28
Fixed to match new image settings
Eengineer1 Dec 14, 2021
846c683
External laddr availability
Eengineer1 Dec 14, 2021
d2a248d
Switched test port to avoid clashes
Eengineer1 Dec 14, 2021
febc36b
Bypass defaults
Eengineer1 Dec 14, 2021
926bbdb
Removed excess
Eengineer1 Dec 14, 2021
7ab6769
Removed moniker name in container env vars
jay-dee7 Dec 15, 2021
b7f3e3c
Fixed supervisor config to match dirs
Eengineer1 Dec 15, 2021
0928943
Removed unwanted quotes
Eengineer1 Dec 15, 2021
fa50c10
Merge branch 'main' into new-docker-compose
Eengineer1 Dec 24, 2021
e099c33
Merge branch 'main' into new-docker-compose
Eengineer1 Dec 24, 2021
fb60a5c
Switched to reflect main
Eengineer1 Dec 24, 2021
3ad8ad0
Single Dockerfile for mainnet & testnet
Eengineer1 Dec 24, 2021
5abb084
Adjusted to old dir
Eengineer1 Dec 24, 2021
fdf6e02
Removed excess
Eengineer1 Dec 24, 2021
f981be3
Upgraded testnet version beforehand
Eengineer1 Dec 24, 2021
63303b3
Added whole home dir volume
Eengineer1 Dec 24, 2021
9154844
Multiple driver options & fixes
Eengineer1 Jan 10, 2022
bb91640
Testnet ref typo fix
Eengineer1 Jan 10, 2022
47506cf
Consistent across mainnet & testnet
Eengineer1 Jan 10, 2022
eaf75bf
Moved environment variables to host
Eengineer1 Jan 10, 2022
8089aec
Merge branch 'main' into new-docker-compose
askolesov Jan 11, 2022
c471a4d
Move single image localnet to tests
askolesov Jan 11, 2022
243901b
Fix naming of build tools
askolesov Jan 11, 2022
75886df
Fx liinks in workflows
askolesov Jan 11, 2022
7be8d5b
Move docker localnet to tests
askolesov Jan 11, 2022
6212660
Fix documentation
askolesov Jan 11, 2022
4b7dc28
Fix case
askolesov Jan 11, 2022
763aeae
Fix broken links
askolesov Jan 11, 2022
582e6a4
Allow 0, 403 status codes for link checker
askolesov Jan 11, 2022
afc76b0
Fix broken links
askolesov Jan 11, 2022
30589c5
Fix file names
askolesov Jan 11, 2022
c5fc54a
Fx links, dockerfile
askolesov Jan 11, 2022
28c6946
Fix test pipeline
askolesov Jan 11, 2022
29969bf
Fix test pipeline
askolesov Jan 11, 2022
68ac40a
Fix test
askolesov Jan 11, 2022
5e9cd5b
Revert volume names
askolesov Jan 11, 2022
44770e7
Fix corner case where host ip is invalid at first launch
askolesov Jan 11, 2022
71aa4c9
Optimize docker file
askolesov Jan 11, 2022
042ed46
Improve gen-network-config
askolesov Jan 12, 2022
f6c1f7e
Update git ignore
askolesov Jan 12, 2022
69ce3bf
Update cheqd-localnet image to run several nodes inside again
askolesov Jan 12, 2022
89f1429
Corrected spelling in filename
ankurdotb Jan 12, 2022
d71edb4
Make docker-compose localnet to use unified gen-net-conf base script
askolesov Jan 12, 2022
1d82709
Fix script name in the lint pipeline
askolesov Jan 12, 2022
72f4e97
Fix permissions in the test pipeline
askolesov Jan 12, 2022
dcd9ded
Replace waiter script with the new one
askolesov Jan 12, 2022
dd900e4
Typo fixes in GitHub Actions release workflow
ankurdotb Jan 12, 2022
33be740
Cosmetic switch to put exposed ports in same order as in config files
ankurdotb Jan 12, 2022
777d33b
Swapping parameter order around in node-runner.sh
ankurdotb Jan 12, 2022
ea70f3b
Added explanatory comments to Docker Compose file
ankurdotb Jan 12, 2022
4f46eb1
Added extended descriptions for inside-container configuration file f…
ankurdotb Jan 12, 2022
a1f875d
Update Dockerfile
ankurdotb Jan 13, 2022
78c1b45
Modified configuration for volumes in Docker Compose file
ankurdotb Jan 13, 2022
ed23e5b
Extended descriptions in host environment variables
ankurdotb Jan 13, 2022
3c28fa6
Merge remote-tracking branch 'origin/new-docker-compose' into unified…
askolesov Jan 13, 2022
47fc9c4
Update .Dockerignore
ankurdotb Jan 13, 2022
66de48b
Update release.yml
ankurdotb Jan 13, 2022
804983f
Update .gitignore
ankurdotb Jan 13, 2022
8c28b3a
Fix paths
askolesov Jan 13, 2022
22a61a0
More path fixes
askolesov Jan 13, 2022
4fe2e95
Fix paths
askolesov Jan 13, 2022
9155127
Fix typos
askolesov Jan 13, 2022
62b53d5
Fix failing tests
askolesov Jan 13, 2022
ff97c4f
Changed node-runner script to copy genesis and seed config data from …
ankurdotb Jan 14, 2022
50c60ad
Optimise Dockerfile by removing unnecessary requirements
ankurdotb Jan 14, 2022
e1104a6
Fixed errors due to incorrect commenting style in Compose environment…
ankurdotb Jan 14, 2022
18fae6e
Fixed incorrect variable names in Docker Compose file
ankurdotb Jan 14, 2022
52d7c3c
Merge branch 'new-docker-compose' into unified-net-config-generation
askolesov Jan 15, 2022
1ce5efa
Enable bash linter (#271)
askolesov Jan 31, 2022
bbe75fa
Merge branch 'main' into unified-net-config-generation
askolesov Feb 9, 2022
0b8ad06
Fix step name
askolesov Feb 9, 2022
e039fd7
Get rid of files included because of merge conflict
askolesov Feb 9, 2022
85d94bf
Fix build-tar, build-deb scripts
askolesov Feb 9, 2022
d9646b8
Various merge fixes
askolesov Feb 9, 2022
06db9dc
Fix docker-compose-localnet merge conflicts
askolesov Feb 9, 2022
242e3ba
Fix images build job names
askolesov Feb 9, 2022
55caf39
More merge fixes
askolesov Feb 10, 2022
a4008e2
Fix base image
askolesov Feb 10, 2022
ab697fc
Improve job names
askolesov Feb 10, 2022
118f5e3
Fix test job
askolesov Feb 10, 2022
61d00a3
Restore docker-compose required for the upgrade tests
askolesov Feb 10, 2022
00a7372
Fix docker-compose up
askolesov Feb 10, 2022
a9e6184
Fix broken link
askolesov Feb 10, 2022
dd9d90d
Fix lint issues in common.sh
askolesov Feb 10, 2022
2c9d1b0
Fix linter issues
askolesov Feb 10, 2022
91f8dbb
Fix typo
askolesov Feb 10, 2022
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
29 changes: 23 additions & 6 deletions .Dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
ci
.devcontainer
### APP-SPECIFIC
.github
*.md
build-tools/*
docs/*
architecture/*
persistent_chains/*


### GENERAL EXCLUSIONS ###

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# IDE Exclusions
.devcontainer
.vscode
.vscode-upload.json
.idea
vue/node_modules
vue/src/store/generated
vue/dist
secret.yml

# Python
.pytest_cache
4 changes: 2 additions & 2 deletions .github/linters/mlc_config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"aliveStatusCodes": [200, 206, 999]
}
"aliveStatusCodes": [0, 200, 206, 403, 999]
}
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ jobs:
folder-path: "."

sh-euox-pipefail-check:
name: Check for 'set -euox pipelail' in shell scripts
name: Check for 'set -euox pipefail' in shell scripts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Check that all shell scripts use 'set -euox pipelail'
run: bash .github/scripts/enshure_set_euox_pipefail.sh
- name: Check that all shell scripts use 'set -euox pipefail'
run: bash .github/scripts/ensure_set_euox_pipefail.sh

super-lint:
name: Run super linter
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
- name: Set outputs
id: cache
run: |
# Exposes org_name/repository_name in lower case. Required by docker.
# Exposes org_name/repository_name in lower case. Required by Docker.
echo "::set-output name=GITHUB_REPOSITORY_NAME::$(echo ${GITHUB_REPOSITORY,,})"

# Version is tag without `v` prefix. Reuired by deb package.
# Version is tag without `v` prefix. Required by Debian package.
TAG=${GITHUB_REF/refs\/tags\//}
echo "::set-output name=TAG::$TAG"

Expand All @@ -39,7 +39,7 @@ jobs:
with:
go-version: 1.17

- name: Get go protoc compiler plugins
- name: Get Go protoc compiler plugins
env:
GOLANG_PROTOBUF_VERSION: 1.3.5
GOGO_PROTOBUF_VERSION: 1.3.2
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
path: build/cheqd-noded

build-deb-package:
name: Build deb package
name: Build Debian package
runs-on: ubuntu-20.04
needs: [ build-binary, setup-workflow ]
env:
Expand All @@ -97,36 +97,36 @@ jobs:
run: sudo chmod +x /home/runner/go/bin/cheqd-noded

- name: Make intermediate archive
working-directory: ./build_tools
working-directory: ./build-tools
run: |
./build_tar.sh ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}
./build-tar.sh ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}

- name: Install fpm
run: |
sudo apt-get install ruby ruby-dev rubygems build-essential
sudo gem install --no-document fpm

- name: Build deb # Depends on tar archive
- name: Build Debian package # Depends on tar archive
working-directory: ./build-tools
run: |
./build_deb.sh ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}
working-directory: ./build_tools
./build-deb.sh ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}

- name: Store deb package artifact
- name: Store Debian package artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.PACKAGE_NAME }}_${{ env.VERSION }}_amd64.deb
path: build_tools/output/${{ env.PACKAGE_NAME }}_${{ env.VERSION }}_amd64.deb
path: build-tools/output/${{ env.PACKAGE_NAME }}_${{ env.VERSION }}_amd64.deb

build-node-image:
name: Build cheqd-node image
name: Build cheqd-node Docker image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # FIXME: Starport requires full repository

- name: Build
run: docker build -f docker/cheqd_node/Dockerfile --no-cache -t cheqd-node --build-arg UID=$(id -u) --build-arg GID=$(id -g) . # TODO: Get rid of UID and GID
run: docker build -f docker/Dockerfile --no-cache -t cheqd-node

- name: Save
run: docker save -o cheqd-node-image.tar cheqd-node
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
run: docker load -i cheqd-node-image.tar

- name: Build
run: docker build -f docker/single_image_testnet/Dockerfile --no-cache -t cheqd-testnet .
run: docker build -f tests/networks/docker-localnet/Dockerfile --no-cache -t cheqd-testnet .

- name: Save
run: docker save -o cheqd-testnet-image.tar cheqd-testnet
Expand Down
58 changes: 32 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- '.gitbook/**'

env:
NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/tests/networks/docker_compose/node_configs"
NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/tests/networks/docker-compose-localnet/network-config"
PACKAGE_NAME: "cheqd-node"
VERSION: "1.0.0" # Package build scripts require version to be provided

Expand Down Expand Up @@ -93,25 +93,25 @@ jobs:
run: sudo chmod +x /home/runner/go/bin/cheqd-noded

- name: Make intermediate archive
working-directory: ./build_tools
working-directory: ./build-tools
run: |
./build_tar.sh ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}
./build-tar.sh ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}

- name: Install fpm
run: |
sudo apt-get install ruby ruby-dev rubygems build-essential
sudo gem install --no-document fpm

- name: Build deb # Depends on tar archive
working-directory: ./build-tools
run: |
./build_deb.sh ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}
working-directory: ./build_tools
./build-deb.sh ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}

- name: Store deb package artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.PACKAGE_NAME }}_${{ env.VERSION }}_amd64.deb
path: build_tools/output/${{ env.PACKAGE_NAME }}_${{ env.VERSION }}_amd64.deb
path: build-tools/output/${{ env.PACKAGE_NAME }}_${{ env.VERSION }}_amd64.deb

build-node-image:
name: Build cheqd-node image
Expand All @@ -122,7 +122,7 @@ jobs:
fetch-depth: 0 # FIXME: Starport requires full repository

- name: Build
run: docker build -f docker/cheqd_node/Dockerfile --no-cache -t cheqd-node --build-arg UID=$(id -u) --build-arg GID=$(id -g) . # TODO: Get rid of UID and GID
run: docker build -f docker/Dockerfile --no-cache -t cheqd-node --build-arg UID=$(id -u) --build-arg GID=$(id -g) . # TODO: Get rid of UID and GID

- name: Save
run: docker save -o cheqd-node-image.tar cheqd-node
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
run: docker load -i cheqd-node-image.tar

- name: Build
run: docker build -f docker/single_image_testnet/Dockerfile --no-cache -t cheqd-testnet .
run: docker build -f tests/networks/docker-localnet/Dockerfile --no-cache -t cheqd-testnet .

- name: Save
run: docker save -o cheqd-testnet-image.tar cheqd-testnet
Expand Down Expand Up @@ -186,23 +186,25 @@ jobs:
uses: actions/checkout@v2

- name: Set up 4 validators + 2 observers node docker pool # TODO: Replace with testnet image
working-directory: ./tests/networks/docker_compose
working-directory: ./tests/networks/docker-compose-localnet
run: |
./gen_node_configs.sh
./run_docker.sh
./wait.sh '[[ $(curl -s -N localhost:26657/block | jq -cr '"'"'.result.block.last_commit.height'"'"') -gt 1 ]] && echo "Height is more than 1"'
bash gen-network-config.sh
docker-compose up -d

- name: Wait for chain
run: bash tests/networks/tools/wait-for-chain.sh

- name: Add observer node
working-directory: ./tests/networks/docker_compose
working-directory: ./tests/networks/docker-compose-localnet
run: |
./add_observer.sh
./add-observer.sh
cheqd-noded status -n tcp://localhost:26677 2>&1
./wait.sh '[[ $(cheqd-noded status -n '"'"'tcp://localhost:26677'"'"' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"'

- name: Promote observer to validator
working-directory: ./tests/networks/docker_compose
working-directory: ./tests/networks/docker-compose-localnet
run: |
bash -x promote_validator.sh
bash -x promote-validator.sh
cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' $1 | while read x; do [[ "BOND_STATUS_BONDED" == $x ]] && echo "Validator's status is bonded!" || exit 1 ; done
./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"'
./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"'
Expand Down Expand Up @@ -242,24 +244,28 @@ jobs:
- uses: actions/checkout@v2

- name: Set up 4 validators + 2 observers node docker pool for local test run # Replace with testnet image
working-directory: ./tests/networks/docker_compose
working-directory: ./tests/networks/docker-compose-localnet
run: |
./gen_node_configs.sh
./run_docker.sh
./wait.sh '[[ $(curl -s -N localhost:26657/block | jq -cr '"'"'.result.block.last_commit.height'"'"') -gt 1 ]] && echo "Height is more than 1"'
bash gen-network-config.sh
docker-compose up -d

- name: Wait for chain
run: bash tests/networks/tools/wait-for-chain.sh

- name: Set up test environment
working-directory: ./tests/e2e
run: |
pip3 install -r requirements.txt >> /dev/null
pip3 install --force-reinstall 'git+https://gitlab.com/evernym/verity/[email protected]#egg=vdr-tools&subdirectory=wrappers/python' -U
cp -R ${NODE_CONFIGS_BASE}/client/.cheqdnode /home/runner/
cp -Rf ${NODE_CONFIGS_BASE}/validator-0/. /home/runner/.cheqdnode
cp -Rf ${NODE_CONFIGS_BASE}/validator-1/. /home/runner/.cheqdnode
sudo chmod -R 777 /home/runner

- name: Run tests
run: |
export OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 1p | sed 's/\r//g')
export OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 2p | sed 's/\r//g')
set -euxo pipefail
export OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-0" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g')
export OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-1" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g')
pytest -v -rP tests/e2e/test_cosmos.py

run-identity-tests-using-vdr:
Expand All @@ -280,7 +286,7 @@ jobs:
- name: Run test net container
run: |
docker run -d --rm -p "26657:26657" cheqd-testnet
bash tests/networks/wait_for_chain.sh
bash tests/networks/tools/wait-for-chain.sh

- name: Set up test environment
working-directory: ./tests/e2e
Expand Down Expand Up @@ -321,8 +327,8 @@ jobs:

- name: Run test net container
run: |
docker run -d --rm -p "26657:26657" -p "1317:1317" cheqd-testnet
bash tests/networks/wait_for_chain.sh
docker run -d --rm -p "26657:26657" -p "1317:1317" cheqd-testnet
bash tests/networks/tools/wait-for-chain.sh

- name: Set up and run tests
working-directory: tests/cli
Expand Down
14 changes: 6 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### APP-SPECIFIC EXCLUSIONS ###
**/network-config
.idea

### GENERAL EXCLUSIONS ###

### macOS ###
# General
.DS_Store
Expand Down Expand Up @@ -30,14 +36,6 @@ Temporary Items
.devcontainer
.vscode

# Application specific
vue/node_modules
vue/src/store/generated
vue/dist
secret.yml
**/node_configs
.idea

# Python
.pytest_cache
**/__pycache__
Expand Down
6 changes: 3 additions & 3 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
* [Using cheqd Cosmos CLI for token transactions](docs/cheqd-cli/cheqd-cli-token-transactions.md)
* [Building from source](docs/build-and-networks/README.md)
* [Building and testing](docs/build-and-networks/README.md)
* [cheqd-testsnet docker image](docs/build-and-networks/local-docker-network.md)
* [Docker Compose Based Localnet](docs/build-and-networks/docker-compose.md)
* [Setting up a new network](docs/build-and-networks/build-and-networks.md)
* [Docker Based Localnet](docs/build-and-networks/local-docker-network.md)
* [Docker Compose Based Localnet](docs/build-and-networks/local-docker-compose-network.md)
* [Setting up a new network](docs/build-and-networks/manual-network-setup.md)
* [Client-app Identity APIs](docs/identity-api/README.md)
* [Error messages](docs/identity-api/identity-api-error-messages.md)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion build_tools/postinst → build-tools/postinst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

CHEQD_USER_NAME=cheqd

Expand Down
File renamed without changes.
Loading