Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

haproxy: add eth-jsonrpc and eth-jsonrpcws for needed chains #374

Merged
merged 1 commit into from
Jun 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion load_balancer/caddy/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ pacman -S --noconfirm base-devel jq dnsutils python caddy screen wget cronie

# write env vars to bash file, so that cronjobs or other scripts could know
cat <<EOT >> $HOME/env.sh
CHAIN_REGISTRY_INI_URL="$CHAIN_REGISTRY_INI_URL"
CONFIG_FILE="/etc/caddy/Caddyfile"
TMP_CONFIG_FILE="/etc/caddy/Caddyfile.tmp"
rpc_service_name="$rpc_service_name"
Expand Down
40 changes: 40 additions & 0 deletions load_balancer/haproxy/haproxy.eth.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# to be append to haproxy.cfg for needed chains

frontend fe_eth
bind :8004
mode http
log global
option httplog
option dontlognull
option forwardfor except 127.0.0.0/8

default_backend be_eth


frontend fe_ethws
bind :8005
mode http
log global
option httplog
option dontlognull
option forwardfor except 127.0.0.0/8

default_backend be_ethws


backend be_eth
mode http
balance roundrobin
option httpchk
http-check connect proto h1
http-check send meth GET uri /healthcheck
server-template st 3 tasks.${rpc_service_name}:8545 check port 80 inter 10s weight 1 resolvers ns init-addr none


backend be_ethws
mode http
balance roundrobin
option httpchk
http-check connect proto h1
http-check send meth GET uri /healthcheck
server-template st 3 tasks.${rpc_service_name}:8546 check port 80 inter 10s weight 1 resolvers ns init-addr none
8 changes: 7 additions & 1 deletion load_balancer/haproxy/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ pacman -S --noconfirm base-devel jq dnsutils python haproxy screen wget cronie

# write env vars to bash file, so that cronjobs or other scripts could know
cat <<EOT >> $HOME/env.sh
CHAIN_REGISTRY_INI_URL="$CHAIN_REGISTRY_INI_URL"
rpc_service_name="$rpc_service_name"
EOT

Expand All @@ -25,6 +24,13 @@ source $HOME/env.sh
# haproxy

curl -Ls "https://raw.githubusercontent.com/notional-labs/cosmosia/main/load_balancer/haproxy/haproxy.cfg" > $HOME/haproxy.cfg

# enable eth for needed chains by appending haproxy.eth.cfg to haproxy.cfg
if [[ $rpc_service_name == rpc_evmos* ]]; then
curl -Ls "https://raw.githubusercontent.com/notional-labs/cosmosia/main/load_balancer/haproxy/haproxy.eth.cfg" >> $HOME/haproxy.cfg
fi


curl -Ls "https://raw.githubusercontent.com/notional-labs/cosmosia/main/load_balancer/haproxy/start.sh" > $HOME/start.sh
curl -Ls "https://raw.githubusercontent.com/notional-labs/cosmosia/main/load_balancer/haproxy/reload.sh" > $HOME/reload.sh

Expand Down