@@ -21,12 +21,18 @@ function stop_port_forward() {
2121
2222# Default values
2323CHAIN_RPC_PORT=26657
24+ CHAIN_COMETMOCK_PORT=22331
25+ CHAIN_GRPC_PORT=9090
2426CHAIN_LCD_PORT=1317
2527CHAIN_EXPOSER_PORT=8081
2628CHAIN_FAUCET_PORT=8000
29+ RELAYER_REST_PORT=3000
30+ RELAYER_EXPOSER_PORT=8081
2731EXPLORER_LCD_PORT=8080
2832REGISTRY_LCD_PORT=8080
2933REGISTRY_GRPC_PORT=9090
34+ MONITORING_PROMETHEUS_PORT=8080
35+ MONITORING_GRAFANA_PORT=8080
3036
3137for i in " $@ " ; do
3238 case $i in
@@ -48,23 +54,54 @@ stop_port_forward
4854echo " Port forwarding for config ${CONFIGFILE} "
4955echo " Port forwarding all chains"
5056num_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
5483fi
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
69106echo " Port forward services"
70107
82119 sleep 1
83120 color green " Open the explorer to get started.... http://localhost:8080"
84121fi
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