From 7a07b719a82cc39a5e7d2a15cb1e872494e78ec7 Mon Sep 17 00:00:00 2001 From: czarly <379651+czarly@users.noreply.github.com> Date: Tue, 15 Mar 2022 15:51:58 +0400 Subject: [PATCH] first try of a frontend config --- haproxy/erigon-healthcheck.sh | 25 ------ ...healthcheck.sh => ethereum-healthcheck.sh} | 6 +- haproxy/geth-healthcheck.sh | 25 ------ haproxy/goerli-healthcheck.sh | 25 ------ haproxy/rinkeby-healthcheck.sh | 25 ------ haproxy/ropsten-healthcheck.sh | 25 ------ pocket-frontend.yml | 81 +++++++++++++++++++ 7 files changed, 84 insertions(+), 128 deletions(-) delete mode 100644 haproxy/erigon-healthcheck.sh rename haproxy/{avalanche-healthcheck.sh => ethereum-healthcheck.sh} (72%) delete mode 100644 haproxy/geth-healthcheck.sh delete mode 100644 haproxy/goerli-healthcheck.sh delete mode 100644 haproxy/rinkeby-healthcheck.sh delete mode 100644 haproxy/ropsten-healthcheck.sh create mode 100644 pocket-frontend.yml diff --git a/haproxy/erigon-healthcheck.sh b/haproxy/erigon-healthcheck.sh deleted file mode 100644 index 8fb06909..00000000 --- a/haproxy/erigon-healthcheck.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# $1 = Virtual Service IP (VIP) -# $2 = Virtual Service Port (VPT) -# $3 = Real Server IP (RIP) -# $4 = Real Server Port (RPT) -# $5 = Check Source IP - -PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -VIP=$1 -VPT=$2 -RIP=$3 -RPT=$4 -# RPT=8545 - -# Run curl with appropriate options -curl -s -X POST -H "Content-Type: application/json" -m 2 -d '{"jsonrpc":"2.0","method":"eth_syncing","params": [],"id":1}' http://$RIP:$RPT/erigon 2>/dev/null | jq '.result' -r | grep -q false -exit1=$? - -peers=$(curl -s -X POST -H "Content-Type: application/json" -m 2 -d '{"jsonrpc":"2.0","method":"net_peerCount","params": [],"id":1}' http://$RIP:$RPT/erigon 2>/dev/null | jq '.result' -r) - -# If any of the above tests failed, then exit 1. -if [[ "$exit1" -ne 0 ]]; then exit 1; fi -if [[ `printf "%d" $peers` == "0" || `printf "%d" $peers` == "1" ]]; then exit 1; fi -exit 0 \ No newline at end of file diff --git a/haproxy/avalanche-healthcheck.sh b/haproxy/ethereum-healthcheck.sh similarity index 72% rename from haproxy/avalanche-healthcheck.sh rename to haproxy/ethereum-healthcheck.sh index 358efc00..f830fa32 100644 --- a/haproxy/avalanche-healthcheck.sh +++ b/haproxy/ethereum-healthcheck.sh @@ -14,12 +14,12 @@ RPT=$4 # RPT=8545 # Run curl with appropriate options -curl -s -X POST -H "Content-Type: application/json" -m 2 -d '{"jsonrpc":"2.0","method":"eth_syncing","params": [],"id":1}' http://$RIP:$RPT/avalanche 2>/dev/null | jq '.result' -r | grep -q false +curl -s -X POST -H "Content-Type: application/json" -m 2 -d '{"jsonrpc":"2.0","method":"eth_syncing","params": [],"id":1}' https://$HAPROXY_SERVER_NAME:$RPT/$HAPROXY_PROXY_NAME 2>/dev/null | jq '.result' -r | grep -q false exit1=$? -peers=$(curl -s -X POST -H "Content-Type: application/json" -m 2 -d '{"jsonrpc":"2.0","method":"net_peerCount","params": [],"id":1}' http://$RIP:$RPT/avalanche 2>/dev/null | jq '.result' -r) +peers=$(curl -s -X POST -H "Content-Type: application/json" -m 2 -d '{"jsonrpc":"2.0","method":"net_peerCount","params": [],"id":1}' https://$HAPROXY_SERVER_NAME:$RPT/$HAPROXY_PROXY_NAME 2>/dev/null | jq '.result' -r) # If any of the above tests failed, then exit 1. if [[ "$exit1" -ne 0 ]]; then exit 1; fi if [[ `printf "%d" $peers` == "0" || `printf "%d" $peers` == "1" ]]; then exit 1; fi -exit 0 \ No newline at end of file +exit 0 diff --git a/haproxy/geth-healthcheck.sh b/haproxy/geth-healthcheck.sh deleted file mode 100644 index 8a5c8aac..00000000 --- a/haproxy/geth-healthcheck.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# $1 = Virtual Service IP (VIP) -# $2 = Virtual Service Port (VPT) -# $3 = Real Server IP (RIP) -# $4 = Real Server Port (RPT) -# $5 = Check Source IP - -PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -VIP=$1 -VPT=$2 -RIP=$3 -RPT=$4 -# RPT=8545 - -# Run curl with appropriate options -curl -s -X POST -H "Content-Type: application/json" -m 2 -d '{"jsonrpc":"2.0","method":"eth_syncing","params": [],"id":1}' http://$RIP:$RPT/geth 2>/dev/null | jq '.result' -r | grep -q false -exit1=$? - -peers=$(curl -s -X POST -H "Content-Type: application/json" -m 2 -d '{"jsonrpc":"2.0","method":"net_peerCount","params": [],"id":1}' http://$RIP:$RPT/geth 2>/dev/null | jq '.result' -r) - -# If any of the above tests failed, then exit 1. -if [[ "$exit1" -ne 0 ]]; then exit 1; fi -if [[ `printf "%d" $peers` == "0" || `printf "%d" $peers` == "1" ]]; then exit 1; fi -exit 0 \ No newline at end of file diff --git a/haproxy/goerli-healthcheck.sh b/haproxy/goerli-healthcheck.sh deleted file mode 100644 index c0a64155..00000000 --- a/haproxy/goerli-healthcheck.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# $1 = Virtual Service IP (VIP) -# $2 = Virtual Service Port (VPT) -# $3 = Real Server IP (RIP) -# $4 = Real Server Port (RPT) -# $5 = Check Source IP - -PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -VIP=$1 -VPT=$2 -RIP=$3 -RPT=$4 -# RPT=8545 - -# Run curl with appropriate options -curl -s -X POST -H "Content-Type: application/json" -m 2 -d '{"jsonrpc":"2.0","method":"eth_syncing","params": [],"id":1}' http://$RIP:$RPT/goerli 2>/dev/null | jq '.result' -r | grep -q false -exit1=$? - -peers=$(curl -s -X POST -H "Content-Type: application/json" -m 2 -d '{"jsonrpc":"2.0","method":"net_peerCount","params": [],"id":1}' http://$RIP:$RPT/goerli 2>/dev/null | jq '.result' -r) - -# If any of the above tests failed, then exit 1. -if [[ "$exit1" -ne 0 ]]; then exit 1; fi -if [[ `printf "%d" $peers` == "0" || `printf "%d" $peers` == "1" ]]; then exit 1; fi -exit 0 \ No newline at end of file diff --git a/haproxy/rinkeby-healthcheck.sh b/haproxy/rinkeby-healthcheck.sh deleted file mode 100644 index dea96192..00000000 --- a/haproxy/rinkeby-healthcheck.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# $1 = Virtual Service IP (VIP) -# $2 = Virtual Service Port (VPT) -# $3 = Real Server IP (RIP) -# $4 = Real Server Port (RPT) -# $5 = Check Source IP - -PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -VIP=$1 -VPT=$2 -RIP=$3 -RPT=$4 -# RPT=8545 - -# Run curl with appropriate options -curl -s -X POST -H "Content-Type: application/json" -m 2 -d '{"jsonrpc":"2.0","method":"eth_syncing","params": [],"id":1}' http://$RIP:$RPT/rinkeby 2>/dev/null | jq '.result' -r | grep -q false -exit1=$? - -peers=$(curl -s -X POST -H "Content-Type: application/json" -m 2 -d '{"jsonrpc":"2.0","method":"net_peerCount","params": [],"id":1}' http://$RIP:$RPT/rinkeby 2>/dev/null | jq '.result' -r) - -# If any of the above tests failed, then exit 1. -if [[ "$exit1" -ne 0 ]]; then exit 1; fi -if [[ `printf "%d" $peers` == "0" || `printf "%d" $peers` == "1" ]]; then exit 1; fi -exit 0 \ No newline at end of file diff --git a/haproxy/ropsten-healthcheck.sh b/haproxy/ropsten-healthcheck.sh deleted file mode 100644 index 9911db84..00000000 --- a/haproxy/ropsten-healthcheck.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# $1 = Virtual Service IP (VIP) -# $2 = Virtual Service Port (VPT) -# $3 = Real Server IP (RIP) -# $4 = Real Server Port (RPT) -# $5 = Check Source IP - -PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -VIP=$1 -VPT=$2 -RIP=$3 -RPT=$4 -# RPT=8545 - -# Run curl with appropriate options -curl -s -X POST -H "Content-Type: application/json" -m 2 -d '{"jsonrpc":"2.0","method":"eth_syncing","params": [],"id":1}' http://$RIP:$RPT/ropsten 2>/dev/null | jq '.result' -r | grep -q false -exit1=$? - -peers=$(curl -s -X POST -H "Content-Type: application/json" -m 2 -d '{"jsonrpc":"2.0","method":"net_peerCount","params": [],"id":1}' http://$RIP:$RPT/ropsten 2>/dev/null | jq '.result' -r) - -# If any of the above tests failed, then exit 1. -if [[ "$exit1" -ne 0 ]]; then exit 1; fi -if [[ `printf "%d" $peers` == "0" || `printf "%d" $peers` == "1" ]]; then exit 1; fi -exit 0 \ No newline at end of file diff --git a/pocket-frontend.yml b/pocket-frontend.yml new file mode 100644 index 00000000..a1135079 --- /dev/null +++ b/pocket-frontend.yml @@ -0,0 +1,81 @@ +version: '3.1' + +services: + traefik: + image: traefik:latest + container_name: traefik + restart: always + ports: + - "443:443" + - "127.0.0.1:8080:8080" + expose: + - "8082" + command: + - "--api=true" + - "--api.insecure=true" + - "--api.dashboard=true" + - "--log.level=DEBUG" + - "--providers.docker=true" + - "--providers.docker.exposedbydefault=false" + - "--entrypoints.websecure.address=:443" + - "--entryPoints.metrics.address=:8082" + - "--metrics.prometheus.entryPoint=metrics" + - "--certificatesresolvers.myresolver.acme.tlschallenge=true" + # TESTING + # - "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory" + - "--certificatesresolvers.myresolver.acme.email=$MAIL" + - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json" + volumes: + - "./traefik/letsencrypt:/letsencrypt" + - "/var/run/docker.sock:/var/run/docker.sock:ro" + labels: + - "traefik.enable=true" + + haproxy: + build: haproxy + volumes: + - ./haproxy:/usr/local/etc/haproxy + expose: + - "8404" + - "80" + ports: + - "127.0.0.1:80:80" + restart: always + labels: + - "prometheus-scrape.enabled=true" + - "prometheus-scrape.port=8404" + - "prometheus-scrape.job_name=haproxy" + - "prometheus-scrape.metrics_path=/metrics" + + pocket: + image: poktnetwork/pocket-core:stagenet-latest + ports: + - "127.0.0.1:8081:8081" + - "26657:26656" + expose: + - 26656 + - 26660 + - 8081 + - 8083 + command: /home/app/.pocket/pokt_mainnet.sh && pocket start --seeds=$POCKET_MAIN_SEEDS --mainnet + #command: pocket start --simulateRelay + environment: + - POCKET_CORE_KEY=$POCKET_CORE_KEY + - POCKET_CORE_PASSPHRASE=$POCKET_CORE_PASSPHRASE + - POCKET_SNAPSHOT=$POCKET_SNAPSHOT + volumes: + - ./bootstrap_skript/pokt_mainnet.sh:/home/app/.pocket/pokt_mainnet.sh + - ./chains/chains_mainnet.json:/home/app/.pocket/config/chains.json + - ./pokt/config.json:/home/app/.pocket/config/config.json + - pocket:/home/app/.pocket + restart: unless-stopped + labels: + - "traefik.enable=true" + - "traefik.http.services.pocket.loadbalancer.server.port=8081" + - "traefik.http.routers.pocket.entrypoints=websecure" + - "traefik.http.routers.pocket.tls.certresolver=myresolver" + - "traefik.http.routers.pocket.rule=Host(`$DOMAIN`) && Path(`/v1`, `/v1/client/{dispatch|relay|challenge|sim}`)" + +### VOLUMES +volumes: + pocket: \ No newline at end of file