Skip to content

Commit

Permalink
Testnet manager local setup improvements (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
aardbol committed Oct 19, 2023
1 parent 91c0aad commit d9e0889
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 18 deletions.
32 changes: 22 additions & 10 deletions local-kubernetes/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# ============================================================================================
# Validator-manager Quick Deploy Makefile for Development and Testing
# Testnet Manager Quick Deploy Makefile for Development and Testing
# ============================================================================================

KUBERNETES_CONTEXT = minikube # minikube or rancher-desktop
# rococo or wococo (don't put space at the end of the variable it will be used as is)
CHAIN_NAMESPACE = rococo
# docker or podman
MINIKUBE_DRIVER = docker

# ============================================================================================

all: kube check build install
ifeq ($(MINIKUBE_DRIVER),podman)
TARGETS := kube_minikube-podman check install
else
TARGETS := kube check install
endif

all: $(TARGETS)

# ============================================================================================

Expand Down Expand Up @@ -37,39 +45,43 @@ setup: setup_${KUBERNETES_CONTEXT}

setup_minikube:
@kubectl --context ${KUBERNETES_CONTEXT} apply -f ./kube-setup
@echo "Waiting 20 seconds for chainspec pod readiness before continuing"
@sleep 20

setup_rancher-desktop:
@kubectl --context ${KUBERNETES_CONTEXT} apply -f ./kube-setup -f ./rancher-desktop/kube-setup
@echo "Waiting 20 seconds for chainspec pod readiness before continuing"
@sleep 20

build: check build_${KUBERNETES_CONTEXT}

build_minikube:
cd ../. && minikube image build . -t local/testnet-manager
cd ../. && minikube image build . -t localhost/testnet-manager

build_rancher-desktop:
cd ../. && docker image build -t local/testnet-manager:latest .
cd ../. && docker image build -t localhost/testnet-manager:latest .

# ============================================================================================

rpc:
@xdg-open 'https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer'
@kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local${CHAIN_NAMESPACE}-bootnode 9944:9944 -n ${CHAIN_NAMESPACE}
@kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local-${CHAIN_NAMESPACE}-bootnode 9944:9944 -n ${CHAIN_NAMESPACE}

para-shell:
@xdg-open 'https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9948#/explorer'
@kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local${CHAIN_NAMESPACE}-shell-collator-node 9948:9944 -n ${CHAIN_NAMESPACE}
@kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local-${CHAIN_NAMESPACE}-shell-collator-node 9948:9944 -n ${CHAIN_NAMESPACE}

para-moon:
@xdg-open 'https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9949#/explorer'
@kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local${CHAIN_NAMESPACE}-moonbase-alice-node 9949:9944 -n ${CHAIN_NAMESPACE}
@kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local-${CHAIN_NAMESPACE}-moonbase-alice-node 9949:9944 -n ${CHAIN_NAMESPACE}

para-mint:
@xdg-open 'https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9950#/explorer'
@kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local${CHAIN_NAMESPACE}-statemint-alice-node 9950:9944 -n ${CHAIN_NAMESPACE}
@kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local-${CHAIN_NAMESPACE}-statemint-alice-node 9950:9944 -n ${CHAIN_NAMESPACE}

para-tick:
@xdg-open 'https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9951#/explorer'
@kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local${CHAIN_NAMESPACE}-tick-collator-node 9951:9944 -n ${CHAIN_NAMESPACE}
@kubectl --context ${KUBERNETES_CONTEXT} port-forward service/local-${CHAIN_NAMESPACE}-tick-collator-node 9951:9944 -n ${CHAIN_NAMESPACE}

web:
@xdg-open 'http://localhost:8080/'
Expand Down Expand Up @@ -108,4 +120,4 @@ uninstall: check
@kubectl --context ${KUBERNETES_CONTEXT} delete pvc -n ${CHAIN_NAMESPACE} --all

cleanup: check
@kubectl --context ${KUBERNETES_CONTEXT} delete namespace ${CHAIN_NAMESPACE}
@kubectl --context ${KUBERNETES_CONTEXT} delete namespace rococo wococo
4 changes: 2 additions & 2 deletions local-kubernetes/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Requirements

1. Helm
a. Helmdiff
a. Helm diff plugin
b. Helmfile
2. Minikube or Rancher-desktop

Expand Down Expand Up @@ -46,7 +46,7 @@ make rpc
This command will open browser and port-forward the 9944
> Note: you should have port `9944` free in your host before running `make rpc`
### Validator-manager web endpoint
### Testnet Manager web endpoint
Run:
```
make web
Expand Down
3 changes: 0 additions & 3 deletions local-kubernetes/charts/values-moonbase-collator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ node:
chainKeystore: *chainKeystore
persistGeneratedNodeKey: true
allowUnsafeRpcMethods: true
# To be removed once https://github.com/moonbeam-foundation/moonbeam/pull/2359
# is included in release
legacyRpcFlags: true
flags:
- "--allow-private-ipv4"

Expand Down
2 changes: 1 addition & 1 deletion local-kubernetes/charts/values-testnet-manager.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
image:
repository: "local/testnet-manager"
repository: "localhost/testnet-manager"
tag: latest
pullPolicy: IfNotPresent

Expand Down
2 changes: 1 addition & 1 deletion skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: testnet-manager
build:
artifacts:
- image: local/testnet-manager
- image: localhost/testnet-manager
docker: {}
local:
useBuildkit: true
Expand Down
2 changes: 1 addition & 1 deletion tests/stash_account_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def tearDown(self):
def test_get_account_funds(self):
alice_key = Keypair.create_from_uri("//Alice")
alice_funds = get_account_funds(self.polkadot_rpc_ws_url, alice_key.ss58_address)
self.assertEqual(alice_funds, 10000000000000000, "Alice's funds successfully retrieved")
self.assertEqual(alice_funds, 1000000000000000000, "Alice's funds successfully retrieved")

if __name__ == '__main__':
unittest.main()

0 comments on commit d9e0889

Please sign in to comment.