fix: reduce motr proxy shutdown timeout

This commit is contained in:
Prad Nukala 2024-09-27 11:00:54 -04:00
parent 162e246307
commit 4463bf6ffb
9 changed files with 43 additions and 42 deletions

View File

@ -321,7 +321,7 @@ start-caddy:
@echo "(start-caddy) Starting caddy" @echo "(start-caddy) Starting caddy"
./build/caddy run --config ./config/caddy/Caddyfile ./build/caddy run --config ./config/caddy/Caddyfile
start-proxy: start-motr: motr
@echo "(start-proxy) Starting proxy server" @echo "(start-proxy) Starting proxy server"
./build/motr proxy ./build/motr proxy

View File

@ -4,7 +4,7 @@
# Sonr Node - Identity # Sonr Node - Identity
- name: sonr - name: sonr
github-organization: onsonr github-organization: onsonr
github-repo: core github-repo: sonr
dockerfile: cosmos dockerfile: cosmos
build-target: make install build-target: make install
binaries: binaries:

View File

@ -43,7 +43,7 @@ func NewProxyCmd() *cobra.Command {
// Wait for interrupt signal to gracefully shutdown the server with a timeout of 10 seconds. // Wait for interrupt signal to gracefully shutdown the server with a timeout of 10 seconds.
<-ctx.Done() <-ctx.Done()
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel() defer cancel()
// Shutdown the server with 10 seconds timeout. // Shutdown the server with 10 seconds timeout.

View File

@ -8,7 +8,14 @@
"cloudflared@latest" "cloudflared@latest"
], ],
"env": { "env": {
"CLOUDFLARE_TUNNEL_TOKEN": "$(skate get CLOUDFLARE_TUNNEL_TOKEN)", "ACC0_ADDRESS": "idx1efd63aw40lxf3n4mhf7dzhjkr453axur9vjt6y",
"ACC0_MNEMONIC": "$(skate get ACC0_MNEMONIC)",
"ACC0_NAME": "acc0",
"ACC1_ADDRESS": "idx1hj5fveer5cjtn4wd6wstzugjfdxzl0xpecp0nd",
"ACC1_MNEMONIC": "$(skate get ACC1_MNEMONIC)",
"ACC1_NAME": "acc1",
"BINARY": "sonrd",
"TUNNEL_TOKEN": "$(skate get CLOUDFLARE_TUNNEL_TOKEN)",
"GOPATH": "$HOME/go", "GOPATH": "$HOME/go",
"PATH": "$HOME/go/bin:$PATH", "PATH": "$HOME/go/bin:$PATH",
"TEMPL_EXPERIMENT": "rawgo", "TEMPL_EXPERIMENT": "rawgo",
@ -19,40 +26,17 @@
}, },
"shell": { "shell": {
"scripts": { "scripts": {
"install": [ "install": ["make install"],
"make install", "build:docker": ["make local-image"],
"bun --cwd nebula run fetch:deps" "build:dwn": ["make dwn"],
], "build:motr": ["make motr"],
"build:docker": [ "build:nebula": ["bun --cwd nebula run build"],
"make local-image" "build:sonrd": ["make build"],
], "gen:proto": ["make proto-gen"],
"build:dwn": [ "gen:pkl": ["make pkl"],
"make dwn" "gen:templ": ["make templ"],
], "start:motr": ["make start-motr"],
"build:motr": [ "watch:nebula": ["bun --cwd nebula run watch"]
"make motr"
],
"build:nebula": [
"bun --cwd nebula run build"
],
"build:sonrd": [
"make build"
],
"gen:proto": [
"make proto-gen"
],
"gen:pkl": [
"make pkl"
],
"gen:templ": [
"make templ"
],
"start:tunnel": [
"cloudflared tunnel run --token $(skate get CLOUDFLARE_TUNNEL_TOKEN)"
],
"watch:nebula": [
"bun --cwd nebula run watch"
]
} }
} }
} }

View File

@ -3,7 +3,7 @@ version: "0.6"
processes: processes:
ipfs: ipfs:
namespace: testnet namespace: testnet
command: "sh scripts/bootstrap_ipfs.sh" command: "sh scripts/setup_ipfs.sh"
background: true background: true
availability: availability:
restart: on_failure restart: on_failure
@ -17,9 +17,18 @@ processes:
depends: depends:
- ipfs - ipfs
motr:
namespace: testnet
command: "make start-motr"
restart: on_failure
max_restarts: 1
depends:
- ipfs
- sonr
tunnel: tunnel:
namespace: public namespace: public
command: "devbox run start:tunnel" command: "cloudflared tunnel run --token $TUNNEL_TOKEN"
restart: on_failure restart: on_failure
max_restarts: 1 max_restarts: 1
depends: depends:

8
scripts/init_env.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/zsh
export ACC0_MNEMONIC=$(skate get ACC0_MNEMONIC)
export ACC1_MNEMONIC=$(skate get ACC1_MNEMONIC)
export CHAIN_ID=$(skate get CHAIN_ID)
export DENOM=$(skate get DENOM)
export KEYRING=$(skate get KEYRING)
export MONIKER=$(skate get MONIKER)

View File

@ -65,9 +65,9 @@ from_scratch () {
} }
# idx1efd63aw40lxf3n4mhf7dzhjkr453axur9vjt6y # idx1efd63aw40lxf3n4mhf7dzhjkr453axur9vjt6y
add_key $KEY "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" add_key $KEY "$ACC0_MNEMONIC"
# idx1hj5fveer5cjtn4wd6wstzugjfdxzl0xpecp0nd # idx1hj5fveer5cjtn4wd6wstzugjfdxzl0xpecp0nd
add_key $KEY2 "wealth flavor believe regret funny network recall kiss grape useless pepper cram hint member few certain unveil rather brick bargain curious require crowd raise" add_key $KEY2 "$ACC1_MNEMONIC"
# chain initial setup # chain initial setup
BINARY init $MONIKER --chain-id $CHAIN_ID --default-denom $DENOM BINARY init $MONIKER --chain-id $CHAIN_ID --default-denom $DENOM