Skip to content

Commit 393d260

Browse files
committed
upgrade starhsip to 0.1.47
1 parent ef18e79 commit 393d260

File tree

5 files changed

+199
-30
lines changed

5 files changed

+199
-30
lines changed

examples/telescope-authz/Makefile

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ HELM_NAME = telescope-starship
22
HELM_FILE = configs/starship.yaml
33
HELM_REPO = starship
44
HELM_CHART = devnet
5-
HELM_VERSION = v0.1.38
5+
HELM_VERSION = v0.1.47
66

77
###############################################################################
88
### All commands ###
99
###############################################################################
1010

1111
.PHONY: setup
12-
setup: check setup-helm
12+
setup: check
1313

1414
.PHONY: test
1515
test:
@@ -25,21 +25,13 @@ clean: stop clean-kind
2525
### Helm commands ###
2626
###############################################################################
2727

28-
.PHONY: setup-helm
29-
setup-helm:
30-
helm repo add $(HELM_REPO) https://cosmology-tech.github.io/starship/
31-
helm repo update
32-
helm search repo $(HELM_REPO)/$(HELM_CHART) --version $(HELM_VERSION)
33-
3428
.PHONY: install
3529
install:
36-
@echo "Installing the helm chart. This is going to take a while....."
37-
@echo "You can check the status with \"kubectl get pods\", run in another terminal please"
38-
helm install -f $(HELM_FILE) $(HELM_NAME) $(HELM_REPO)/$(HELM_CHART) --version $(HELM_VERSION)
30+
bash $(CURDIR)/scripts/install.sh --config $(HELM_FILE) --version $(HELM_VERSION) --name $(HELM_NAME)
3931

4032
.PHONY: debug
4133
debug:
42-
helm install --dry-run --debug -f $(HELM_FILE) $(HELM_NAME) $(HELM_REPO)/$(HELM_CHART)
34+
bash $(CURDIR)/scripts/install.sh --config $(HELM_FILE) --version $(HELM_VERSION) --name $(HELM_NAME) --dry-run
4335

4436
.PHONY: delete
4537
delete:

examples/telescope-authz/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"locks": "npm run locks:remove && npm run locks:create",
1111
"codegen": "node scripts/codegen.js",
1212
"e2e": "npm run e2e:test",
13-
"e2e:deps": "make setup",
13+
"e2e:deps": "make setup-deps",
1414
"e2e:kind": "make setup-kind",
1515
"e2e:start": "make install",
1616
"e2e:port": "make port-forward",
@@ -93,4 +93,4 @@
9393
"ts-jest": "^29.1.0",
9494
"typescript": "4.9.3"
9595
}
96-
}
96+
}

examples/telescope-authz/scripts/dev-setup.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function color() {
1313
# Define a function to install a binary on macOS
1414
install_macos() {
1515
case $1 in
16+
docker) color red "Please install docker. Follow: https://docs.docker.com/desktop/install/mac-install/" ;;
1617
kubectl) brew install kubectl ;;
1718
helm) brew install helm ;;
1819
yq) brew install yq ;;
@@ -25,10 +26,11 @@ install_linux() {
2526
color green "Installing $1 at ~/.local/bin, please add it to PATH"
2627
mkdir -p ~/.local/bin
2728
case $1 in
29+
docker) color red "Please install docker. Follow: https://docs.docker.com/engine/install/ubuntu/" ;;
2830
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 ;;
2931
helm) curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash ;;
3032
yq) curl -Lks "https://github.com/mikefarah/yq/releases/download/v4.33.3/yq_linux_amd64" > ~/.local/bin/yq && chmod +x ~/.local/bin/yq ;;
31-
kind) curl -Lks https://kind.sigs.k8s.io/dl/v0.18.0/kind-linux-amd64 > ~/.local/bin/kind && chmod +x ~/.local/bin/kind ;;
33+
kind) curl -Lks https://kind.sigs.k8s.io/dl/v0.18.1/kind-linux-amd64 > ~/.local/bin/kind && chmod +x ~/.local/bin/kind ;;
3234
esac
3335
}
3436

@@ -61,5 +63,7 @@ check_binary kubectl
6163
check_binary helm
6264
check_binary yq
6365
check_binary kind
66+
check_binary docker
6467

6568
color green "All binaries are installed"
69+
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
#!/bin/bash
2+
3+
## Script used to install the helm chart for the devnet from a config file
4+
## Usage:
5+
## ./scripts/install.sh --coinfig <config_file>
6+
## Options:
7+
## -c|--config: config file to use (default: config.yaml)
8+
## -v|--version: helm chart version (default: 0.1.43)
9+
10+
set -euo pipefail
11+
12+
# read config file from args into variable
13+
CONFIGFILE="config.yaml"
14+
15+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
16+
echo "Script dir: ${SCRIPT_DIR}"
17+
18+
# default values
19+
DRY_RUN=""
20+
TIMEOUT=""
21+
NAMESPACE=""
22+
HELM_REPO="starship"
23+
HELM_CHART="starship/devnet"
24+
HELM_REPO_URL="https://cosmology-tech.github.io/starship/"
25+
HELM_CHART_VERSION="0.1.43"
26+
27+
# check_helm function verifies the helm binary is installed
28+
function check_helm() {
29+
if ! command -v helm &> /dev/null
30+
then
31+
echo "helm could not be found; please install it first!!!"
32+
exit
33+
fi
34+
}
35+
36+
# setup_helm function adds the helm repo and updates it
37+
function setup_helm() {
38+
if [ -d "$HELM_CHART" ]; then
39+
echo "using local helm chart"
40+
return
41+
fi
42+
helm repo add ${HELM_REPO} ${HELM_REPO_URL}
43+
helm repo update
44+
helm search repo ${HELM_CHART} --version ${HELM_CHART_VERSION}
45+
}
46+
47+
function set_helm_args() {
48+
if [[ $TIMEOUT ]]; then
49+
args="$args --timeout $TIMEOUT --wait --debug"
50+
fi
51+
if [[ $NAMESPACE ]]; then
52+
args="$args --namespace $NAMESPACE --create-namespace"
53+
fi
54+
if [[ $DRY_RUN ]]; then
55+
args="$args --dry-run --debug"
56+
fi
57+
num_chains=$(yq -r ".chains | length - 1" ${CONFIGFILE})
58+
if [[ $num_chains -lt 0 ]]; then
59+
echo "No chains to parse: num: $num_chains"
60+
return 0
61+
fi
62+
for i in $(seq 0 $num_chains); do
63+
chain=$(yq -r ".chains[$i].name" ${CONFIGFILE})
64+
scripts=$(yq -r ".chains[$i].scripts" ${CONFIGFILE})
65+
if [[ "$scripts" == "null" ]]; then
66+
return 0
67+
fi
68+
datadir="$(cd "$(dirname -- "${CONFIGFILE}")" >/dev/null; pwd -P)"
69+
for script in $(yq -r ".chains[$i].scripts | keys | .[]" ${CONFIGFILE}); do
70+
args="$args --set-file chains[$i].scripts.$script.data=$datadir/$(yq -r ".chains[$i].scripts.$script.file" ${CONFIGFILE})"
71+
done
72+
done
73+
}
74+
75+
function install_chart() {
76+
args=""
77+
set_helm_args
78+
echo "name: ${HELM_NAME}, args: $args, chart: ${HELM_CHART}, version: ${HELM_CHART_VERSION}"
79+
helm install ${HELM_NAME} ${HELM_CHART} --version ${HELM_CHART_VERSION} -f ${CONFIGFILE} $args
80+
}
81+
82+
while [ $# -gt 0 ]; do
83+
case "$1" in
84+
-c|--config)
85+
CONFIGFILE="$2"
86+
shift 2 # past argument=value
87+
;;
88+
-v|--version)
89+
HELM_CHART_VERSION="$2"
90+
shift 2 # past argument
91+
;;
92+
-t|--timeout)
93+
TIMEOUT="$2"
94+
shift 2 # past argument
95+
;;
96+
-n|--name)
97+
HELM_NAME="$2"
98+
shift 2 # past argument
99+
;;
100+
--namespace)
101+
NAMESPACE="$2"
102+
shift 2 # past argument
103+
;;
104+
--chart)
105+
HELM_CHART="$2"
106+
shift 2 # past argument
107+
;;
108+
--dry-run)
109+
DRY_RUN=1
110+
shift # past argument
111+
;;
112+
-*|--*)
113+
echo "Unknown option $1"
114+
exit 1
115+
;;
116+
*)
117+
;;
118+
esac
119+
done
120+
121+
check_helm
122+
setup_helm
123+
install_chart
124+
125+

examples/telescope-authz/scripts/port-forward.sh

Lines changed: 63 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,18 @@ function stop_port_forward() {
2121

2222
# Default values
2323
CHAIN_RPC_PORT=26657
24+
CHAIN_COMETMOCK_PORT=22331
25+
CHAIN_GRPC_PORT=9090
2426
CHAIN_LCD_PORT=1317
2527
CHAIN_EXPOSER_PORT=8081
2628
CHAIN_FAUCET_PORT=8000
29+
RELAYER_REST_PORT=3000
30+
RELAYER_EXPOSER_PORT=8081
2731
EXPLORER_LCD_PORT=8080
2832
REGISTRY_LCD_PORT=8080
2933
REGISTRY_GRPC_PORT=9090
34+
MONITORING_PROMETHEUS_PORT=8080
35+
MONITORING_GRAFANA_PORT=8080
3036

3137
for i in "$@"; do
3238
case $i in
@@ -48,23 +54,54 @@ stop_port_forward
4854
echo "Port forwarding for config ${CONFIGFILE}"
4955
echo "Port forwarding all chains"
5056
num_chains=$(yq -r ".chains | length - 1" ${CONFIGFILE})
51-
if [[ $num_chains -lt 0 ]]; then
57+
if [[ $num_chains -gt -1 ]]; then
58+
for i in $(seq 0 $num_chains); do
59+
# derive chain pod name from chain id
60+
# https://github.com/cosmology-tech/starship/blob/main/charts/devnet/templates/_helpers.tpl#L56
61+
chain=$(yq -r ".chains[$i].name" ${CONFIGFILE} )
62+
chain=${chain/_/"-"}
63+
localrpc=$(yq -r ".chains[$i].ports.rpc" ${CONFIGFILE} )
64+
localgrpc=$(yq -r ".chains[$i].ports.grpc" ${CONFIGFILE} )
65+
locallcd=$(yq -r ".chains[$i].ports.rest" ${CONFIGFILE} )
66+
localexp=$(yq -r ".chains[$i].ports.exposer" ${CONFIGFILE})
67+
localfaucet=$(yq -r ".chains[$i].ports.faucet" ${CONFIGFILE})
68+
color yellow "chains: forwarded $chain"
69+
if [[ $(yq -r ".chains[$i].cometmock.enabled" $CONFIGFILE) == "true" ]];
70+
then
71+
[[ "$localrpc" != "null" ]] && color yellow " cometmock rpc to http://localhost:$localrpc" && kubectl port-forward pods/$chain-cometmock-0 $localrpc:$CHAIN_COMETMOCK_PORT > /dev/null 2>&1 &
72+
else
73+
[[ "$localrpc" != "null" ]] && color yellow " rpc to http://localhost:$localrpc" && kubectl port-forward pods/$chain-genesis-0 $localrpc:$CHAIN_RPC_PORT > /dev/null 2>&1 &
74+
fi
75+
[[ "$localgrpc" != "null" ]] && color yellow " grpc to http://localhost:$localgrpc" && kubectl port-forward pods/$chain-genesis-0 $localgrpc:$CHAIN_GRPC_PORT > /dev/null 2>&1 &
76+
[[ "$locallcd" != "null" ]] && color yellow " lcd to http://localhost:$locallcd" && kubectl port-forward pods/$chain-genesis-0 $locallcd:$CHAIN_LCD_PORT > /dev/null 2>&1 &
77+
[[ "$localexp" != "null" ]] && color yellow " exposer to http://localhost:$localexp" && kubectl port-forward pods/$chain-genesis-0 $localexp:$CHAIN_EXPOSER_PORT > /dev/null 2>&1 &
78+
[[ "$localfaucet" != "null" ]] && color yellow " faucet to http://localhost:$localfaucet" && kubectl port-forward pods/$chain-genesis-0 $localfaucet:$CHAIN_FAUCET_PORT > /dev/null 2>&1 &
79+
sleep 1
80+
done
81+
else
5282
echo "No chains to port-forward: num: $num_chains"
53-
exit 1
5483
fi
55-
for i in $(seq 0 $num_chains); do
56-
chain=$(yq -r ".chains[$i].name" ${CONFIGFILE} )
57-
localrpc=$(yq -r ".chains[$i].ports.rpc" ${CONFIGFILE} )
58-
locallcd=$(yq -r ".chains[$i].ports.rest" ${CONFIGFILE} )
59-
localexp=$(yq -r ".chains[$i].ports.exposer" ${CONFIGFILE})
60-
localfaucet=$(yq -r ".chains[$i].ports.faucet" ${CONFIGFILE})
61-
[[ "$localrpc" != "null" ]] && kubectl port-forward pods/$chain-genesis-0 $localrpc:$CHAIN_RPC_PORT > /dev/null 2>&1 &
62-
[[ "$locallcd" != "null" ]] && kubectl port-forward pods/$chain-genesis-0 $locallcd:$CHAIN_LCD_PORT > /dev/null 2>&1 &
63-
[[ "$localexp" != "null" ]] && kubectl port-forward pods/$chain-genesis-0 $localexp:$CHAIN_EXPOSER_PORT > /dev/null 2>&1 &
64-
[[ "$localfaucet" != "null" ]] && kubectl port-forward pods/$chain-genesis-0 $localfaucet:$CHAIN_FAUCET_PORT > /dev/null 2>&1 &
65-
sleep 1
66-
color yellow "chains: forwarded $chain lcd to http://localhost:$locallcd, rpc to http://localhost:$localrpc, faucet to http://localhost:$localfaucet"
67-
done
84+
85+
86+
echo "Port forward relayers"
87+
num_relayers=$(yq -r ".relayers | length - 1" ${CONFIGFILE})
88+
if [[ $num_relayers -gt -1 ]]; then
89+
for i in $(seq 0 $num_relayers); do
90+
# derive chain pod name from chain id
91+
# https://github.com/cosmology-tech/starship/blob/main/charts/devnet/templates/_helpers.tpl#L56
92+
relayer=$(yq -r ".relayers[$i].name" ${CONFIGFILE} )
93+
relayer=$(yq -r ".relayers[$i].type" ${CONFIGFILE} )-${relayer/_/"-"}
94+
localrest=$(yq -r ".relayers[$i].ports.rest" ${CONFIGFILE} )
95+
localexposer=$(yq -r ".relayers[$i].ports.exposer" ${CONFIGFILE} )
96+
color yellow "relayers: forwarded $relayer"
97+
[[ "$localrest" != "null" ]] && color yellow " rpc to http://localhost:$localrest" && kubectl port-forward pods/$relayer-0 $localrest:$RELAYER_REST_PORT > /dev/null 2>&1 &
98+
[[ "$localexposer" != "null" ]] && color yellow " rpc to http://localhost:$localexposer" && kubectl port-forward pods/$relayer-0 $localexposer:$RELAYER_EXPOSER_PORT > /dev/null 2>&1 &
99+
sleep 1
100+
done
101+
else
102+
echo "No relayer to port-forward: num: $num_relayers"
103+
fi
104+
68105

69106
echo "Port forward services"
70107

@@ -82,3 +119,14 @@ then
82119
sleep 1
83120
color green "Open the explorer to get started.... http://localhost:8080"
84121
fi
122+
123+
if [[ $(yq -r ".monitoring.enabled" $CONFIGFILE) == "true" ]];
124+
then
125+
color yellow "monitoring port forward:"
126+
localgrafana=$(yq -r ".monitoring.ports.grafana" ${CONFIGFILE})
127+
localprometheus=$(yq -r ".monitoring.ports.prometheus" ${CONFIGFILE})
128+
[[ "$localgrafana" != "null" ]] && color yellow " grafana to http://localhost:$localgrafana" && kubectl port-forward service/grafana $localgrafana:$MONITORING_GRAFANA_PORT > /dev/null 2>&1 &
129+
[[ "$localprometheus" != "null" ]] && color yellow " prometheus to http://localhost:$localprometheus" && kubectl port-forward service/prometheus-service $localprometheus:$MONITORING_PROMETHEUS_PORT > /dev/null 2>&1 &
130+
sleep 1
131+
fi
132+

0 commit comments

Comments
 (0)