-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(orchestration): e2e testing environment with starship
- refs: #8896
- Loading branch information
1 parent
f6d77a3
commit d355e51
Showing
6 changed files
with
567 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
NAME = starship-getting-started | ||
FILE = config.yaml | ||
|
||
HELM_REPO = starship | ||
HELM_CHART = devnet | ||
HELM_VERSION = v0.2.2 | ||
|
||
############################################################################### | ||
### All commands ### | ||
############################################################################### | ||
|
||
.PHONY: setup | ||
setup: setup-deps setup-kind | ||
|
||
.PHONY: stop | ||
stop: stop-forward delete | ||
|
||
.PHONY: clean | ||
clean: stop clean-kind | ||
|
||
############################################################################### | ||
### Dependency check ### | ||
############################################################################### | ||
|
||
.PHONY: check | ||
setup-deps: | ||
bash $(CURDIR)/scripts/dev-setup.sh | ||
|
||
############################################################################### | ||
### Helm Charts ### | ||
############################################################################### | ||
|
||
install: | ||
bash $(CURDIR)/scripts/install.sh --config $(FILE) --name $(NAME) --version $(HELM_VERSION) | ||
|
||
delete: | ||
-helm delete $(NAME) | ||
|
||
############################################################################### | ||
### Port forward ### | ||
############################################################################### | ||
|
||
.PHONY: port-forward | ||
port-forward: | ||
bash $(CURDIR)/scripts/port-forward.sh --config=$(FILE) | ||
|
||
.PHONY: stop-forward | ||
stop-forward: | ||
-pkill -f "port-forward" | ||
|
||
############################################################################### | ||
### Local Kind Setup ### | ||
############################################################################### | ||
KIND_CLUSTER=starship | ||
|
||
.PHONY: setup-kind | ||
setup-kind: | ||
kind create cluster --name $(KIND_CLUSTER) | ||
|
||
.PHONY: clean-kind | ||
clean-kind: | ||
kind delete cluster --name $(KIND_CLUSTER) | ||
|
||
############################################################################### | ||
### Agoric Setup ### | ||
############################################################################### | ||
PROVISION_POOL_ADDR=agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346 | ||
|
||
fund-provision-pool: | ||
kubectl exec -it agoriclocal-genesis-0 -c validator -- agd tx bank send faucet $(PROVISION_POOL_ADDR) 1000000000uist -y -b block | ||
|
||
ADDR=agoric1ldmtatp24qlllgxmrsjzcpe20fvlkp448zcuce | ||
COIN=1000000000uist | ||
|
||
fund-wallet: | ||
kubectl exec -it agoriclocal-genesis-0 -c validator -- agd tx bank send faucet $(ADDR) $(COIN) -y -b block | ||
|
||
provision-smart-wallet: | ||
kubectl exec -it agoriclocal-genesis-0 -c validator -- agd tx swingset provision-one wallet $(ADDR) SMART_WALLET --from faucet -y -b block | ||
|
||
# view agoric swingset logs from slog file, until we can set `DEBUG=SwingSet:vat,SwingSet:ls` | ||
tail-slog: | ||
kubectl exec -it agoriclocal-genesis-0 -c validator -- tail -f slog.slog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Starship | ||
|
||
End-to-end testing environment for fully simulated chains, powered by [Starship](https://docs.cosmology.zone/starship). | ||
|
||
|
||
## Initial Setup | ||
|
||
Ensure you have `docker`, `kubectl`, `kind`, and `helm` installed on your machine For convenience, the following command will install dependencies: | ||
|
||
```sh | ||
make setup-deps | ||
``` | ||
|
||
You will need a `kind` cluster: | ||
|
||
```sh | ||
make setup-kind | ||
``` | ||
|
||
## Getting Started | ||
|
||
```sh | ||
# install helm chart and start starship service | ||
make install | ||
|
||
# expose ports on your local machine. useful for testing dapps | ||
make port-forward | ||
|
||
# stop the containers and port-forwarding | ||
make stop | ||
``` | ||
|
||
To setup finish setting up Agoric, also run: | ||
|
||
```bash | ||
make fund-provision-poool | ||
``` | ||
|
||
You can use these commands to fund an account and make a smart wallet: | ||
```bash | ||
ADDR=agoric123 COIN=100000ubld make fund-wallet | ||
ADDR=agoric123 make provision-smart-wallet | ||
``` | ||
|
||
## Logs | ||
|
||
You can use the following commmands to view logs: | ||
|
||
```sh | ||
# agoric slogfile | ||
make tail-slog | ||
|
||
# agoric validator logs | ||
kubkubectl logs agoriclocal-genesis-0 --container=validator --follow | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
chains: | ||
- id: agoriclocal | ||
name: agoric | ||
# also have the option to build from a git tag or branch: https://docs.cosmology.zone/starship/config/chains#build-optional | ||
image: ghcr.io/agoric/agoric-sdk:dev | ||
numValidators: 1 | ||
env: | ||
- name: DEBUG | ||
value: SwingSet:vat,SwingSet:ls | ||
genesis: | ||
app_state: | ||
staking: | ||
params: | ||
unbonding_time: "48h" | ||
swingset: | ||
params: | ||
bootstrap_vat_config: "@agoric/vm-config/decentral-devnet-config.json" | ||
faucet: | ||
enabled: false | ||
ports: | ||
rest: 1317 | ||
rpc: 26657 | ||
exposer: 38087 | ||
grpc: 9090 | ||
resources: | ||
cpu: 1 | ||
memory: 4Gi | ||
- id: osmosislocal | ||
name: osmosis | ||
numValidators: 1 | ||
genesis: | ||
app_state: | ||
staking: | ||
params: | ||
unbonding_time: "48h" | ||
interchain_accounts: | ||
host_genesis_state: | ||
params: | ||
host_enabled: true | ||
allow_messages: ["*"] | ||
interchainquery: | ||
host_port: "icqhost" | ||
params: | ||
host_enabled: true | ||
allow_queries: ["*"] | ||
faucet: | ||
enabled: true | ||
type: starship | ||
ports: | ||
rest: 1315 | ||
rpc: 26655 | ||
grpc: 9093 | ||
faucet: 8084 | ||
- id: gaialocal | ||
name: cosmoshub | ||
numValidators: 1 | ||
genesis: | ||
app_state: | ||
staking: | ||
params: | ||
unbonding_time: "48h" | ||
interchain_accounts: | ||
host_genesis_state: | ||
params: | ||
host_enabled: true | ||
allow_messages: ["*"] | ||
faucet: | ||
enabled: true | ||
ports: | ||
rest: 1314 | ||
rpc: 26654 | ||
grpc: 9092 | ||
faucet: 8083 | ||
|
||
relayers: | ||
- name: osmosis-gaia | ||
type: hermes | ||
replicas: 1 | ||
chains: | ||
- osmosislocal | ||
- gaialocal | ||
- name: agoric-osmosis | ||
type: hermes | ||
replicas: 1 | ||
chains: | ||
- agoriclocal | ||
- osmosislocal | ||
- name: agoric-gaia | ||
type: hermes | ||
replicas: 1 | ||
chains: | ||
- agoriclocal | ||
- gaialocal | ||
|
||
explorer: | ||
enabled: true | ||
ports: | ||
rest: 8080 | ||
|
||
registry: | ||
enabled: true | ||
ports: | ||
rest: 8081 |
69 changes: 69 additions & 0 deletions
69
packages/orchestration/tools/starship/scripts/dev-setup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
function color() { | ||
local color=$1 | ||
shift | ||
local black=30 red=31 green=32 yellow=33 blue=34 magenta=35 cyan=36 white=37 | ||
local color_code=${!color:-$green} | ||
printf "\033[%sm%s\033[0m\n" "$color_code" "$*" | ||
} | ||
|
||
# Define a function to install a binary on macOS | ||
install_macos() { | ||
case $1 in | ||
docker) color red "Please install docker. Follow: https://docs.docker.com/desktop/install/mac-install/" ;; | ||
kubectl) brew install kubectl ;; | ||
helm) brew install helm ;; | ||
yq) brew install yq ;; | ||
kind) brew install kind ;; | ||
esac | ||
} | ||
|
||
# Define a function to install a binary on Linux | ||
install_linux() { | ||
color green "Installing $1 at ~/.local/bin, please add it to PATH" | ||
mkdir -p ~/.local/bin | ||
case $1 in | ||
docker) color red "Please install docker. Follow: https://docs.docker.com/engine/install/ubuntu/" ;; | ||
kubectl) curl -Lks "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" > ~/.local/bin/kubectl && chmod +x ~/.local/bin/kubectl ;; | ||
helm) curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash ;; | ||
yq) curl -Lks "https://github.com/mikefarah/yq/releases/download/v4.33.3/yq_linux_amd64" > ~/.local/bin/yq && chmod +x ~/.local/bin/yq ;; | ||
kind) curl -Lks https://kind.sigs.k8s.io/dl/v0.18.1/kind-linux-amd64 > ~/.local/bin/kind && chmod +x ~/.local/bin/kind ;; | ||
esac | ||
} | ||
|
||
# Define a function to install a binary | ||
install_binary() { | ||
if [[ $(uname -s) == "Darwin" ]]; then | ||
install_macos $1 | ||
else | ||
install_linux $1 | ||
fi | ||
} | ||
|
||
# Define a function to check for the presence of a binary | ||
check_binary() { | ||
if ! command -v $1 &> /dev/null | ||
then | ||
echo "$1 is not installed" | ||
install_binary $1 | ||
if ! command -v $1 &> /dev/null | ||
then | ||
color red "Installation of $1 failed, exiting..." | ||
color red "Please install $1 manually, then run me again to verify the installation" | ||
exit 1 | ||
fi | ||
fi | ||
} | ||
|
||
# Check the binaries | ||
check_binary kubectl | ||
check_binary helm | ||
check_binary yq | ||
check_binary kind | ||
check_binary docker | ||
|
||
color green "All binaries are installed" | ||
|
Oops, something went wrong.