Skip to content

Commit

Permalink
feature: start to expose grpc web to config and beyond (#558)
Browse files Browse the repository at this point in the history
* start to expose grpc web to config and beyond

* update grpc web port forwarding for js client

* update script for port-forward, add testcase
  • Loading branch information
Anmol1696 authored Sep 18, 2024
1 parent c1c83d7 commit 36a6c5d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions clients/js/packages/client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const defaultPorts: PodPorts = {
defaultPorts: {
rpc: 26657,
grpc: 9090,
"grpc-web": 9091,
rest: 1317,
exposer: 8081,
faucet: 8000,
Expand Down
1 change: 1 addition & 0 deletions clients/js/packages/client/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export interface Ports {
rest?: number;
rpc?: number;
grpc?: number;
"grpc-web"?: number;
exposer?: number;
faucet?: number;
prometheus?: number;
Expand Down
3 changes: 3 additions & 0 deletions starship/charts/devnet/scripts/default/update-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ sed -i -e "${line_number}s#address = \".*\"#address = \"tcp://0.0.0.0:1317\"#g"
line_number=$(get_next_line_number "Address defines the gRPC server address to bind to." $CHAIN_DIR/config/app.toml)
sed -i -e "${line_number}s#address = \".*\"#address = \"0.0.0.0:9090\"#g" $CHAIN_DIR/config/app.toml

line_number=$(get_next_line_number "Address defines the gRPC-web server address to bind to." $CHAIN_DIR/config/app.toml)
sed -i -e "${line_number}s#address = \".*\"#address = \"0.0.0.0:9091\"#g" $CHAIN_DIR/config/app.toml

if [ "$METRICS" == "true" ]; then
sed -i -e "s/prometheus = false/prometheus = true/g" $CHAIN_DIR/config/config.toml

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ $portMap := dict "p2p" 26656 "address" 26658 "grpc" 9090 "rest" 1317 }}
{{ $portMap := dict "p2p" 26656 "address" 26658 "grpc" 9090 "grpc-web" 9091 "rest" 1317 }}
{{- range $chain := .Values.chains }}
{{- if ne $chain.name "virtual" }}
{{ $defaultFile := $.Files.Get "defaults.yaml" | fromYaml }}
Expand Down
3 changes: 3 additions & 0 deletions starship/charts/devnet/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@
"grpc": {
"type": "number"
},
"grpc-web": {
"type": "number"
},
"exposer": {
"type": "number"
},
Expand Down
3 changes: 3 additions & 0 deletions starship/scripts/port-forward.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function stop_port_forward() {
CHAIN_RPC_PORT=26657
CHAIN_COMETMOCK_PORT=22331
CHAIN_GRPC_PORT=9090
CHAIN_GRPCWEB_PORT=9091
CHAIN_LCD_PORT=1317
CHAIN_EXPOSER_PORT=8081
CHAIN_FAUCET_PORT=8000
Expand Down Expand Up @@ -62,6 +63,7 @@ if [[ $num_chains -gt -1 ]]; then
chain=${chain/_/"-"}
localrpc=$(yq -r ".chains[$i].ports.rpc" ${CONFIGFILE} )
localgrpc=$(yq -r ".chains[$i].ports.grpc" ${CONFIGFILE} )
localgrpcweb=$(yq -r ".chains[$i].ports.grpc-web" ${CONFIGFILE} )
locallcd=$(yq -r ".chains[$i].ports.rest" ${CONFIGFILE} )
localexp=$(yq -r ".chains[$i].ports.exposer" ${CONFIGFILE})
localfaucet=$(yq -r ".chains[$i].ports.faucet" ${CONFIGFILE})
Expand All @@ -73,6 +75,7 @@ if [[ $num_chains -gt -1 ]]; then
[[ "$localrpc" != "null" ]] && color yellow " rpc to http://localhost:$localrpc" && kubectl port-forward pods/$chain-genesis-0 $localrpc:$CHAIN_RPC_PORT > /dev/null 2>&1 &
fi
[[ "$localgrpc" != "null" ]] && color yellow " grpc to http://localhost:$localgrpc" && kubectl port-forward pods/$chain-genesis-0 $localgrpc:$CHAIN_GRPC_PORT > /dev/null 2>&1 &
[[ "$localgrpcweb" != "null" ]] && color yellow " grpc-web to http://localhost:$localgrpcweb" && kubectl port-forward pods/$chain-genesis-0 $localgrpcweb:$CHAIN_GRPCWEB_PORT > /dev/null 2>&1 &
[[ "$locallcd" != "null" ]] && color yellow " lcd to http://localhost:$locallcd" && kubectl port-forward pods/$chain-genesis-0 $locallcd:$CHAIN_LCD_PORT > /dev/null 2>&1 &
[[ "$localexp" != "null" ]] && color yellow " exposer to http://localhost:$localexp" && kubectl port-forward pods/$chain-genesis-0 $localexp:$CHAIN_EXPOSER_PORT > /dev/null 2>&1 &
[[ "$localfaucet" != "null" ]] && color yellow " faucet to http://localhost:$localfaucet" && kubectl port-forward pods/$chain-genesis-0 $localfaucet:$CHAIN_FAUCET_PORT > /dev/null 2>&1 &
Expand Down
1 change: 1 addition & 0 deletions starship/tests/e2e/configs/one-chain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ chains:
rpc: 26653
exposer: 38083
faucet: 8003
grpc-web: 9091
resources:
cpu: "0.5"
memory: 500M
Expand Down

0 comments on commit 36a6c5d

Please sign in to comment.