better switch
This commit is contained in:
@@ -18,30 +18,35 @@ services:
|
|||||||
- chains
|
- chains
|
||||||
command: "/avalanchego/build/avalanchego --http-host= --http-allowed-hosts=* --staking-port=18507 --public-ip=$IP"
|
command: "/avalanchego/build/avalanchego --http-host= --http-allowed-hosts=* --staking-port=18507 --public-ip=$IP"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
|
||||||
|
avalanche-proxy:
|
||||||
|
restart: unless-stopped
|
||||||
|
image: nginx
|
||||||
|
depends_on:
|
||||||
|
- mantle
|
||||||
|
expose:
|
||||||
|
- 80
|
||||||
|
environment:
|
||||||
|
PROXY_HOST: avalanche-fullnode
|
||||||
|
RPC_PORT: 9650
|
||||||
|
RPC_PATH: /ext/bc/c/rpc
|
||||||
|
WS_PORT: 9650
|
||||||
|
WS_PATH: /ext/bc/C/ws
|
||||||
|
networks:
|
||||||
|
- chains
|
||||||
|
volumes:
|
||||||
|
- ./nginx-proxy:/etc/nginx/templates
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.middlewares.avalanche-fullnode-replacepath.replacepath.path=/ext/bc/C/rpc"
|
- "traefik.http.middlewares.avalanche-fullnode-replacepath.replacepath.path=/ext/bc/C/rpc"
|
||||||
- "traefik.http.middlewares.avalanche-fullnode-stripprefix.stripprefix.prefixes=/avalanche-fullnode"
|
- "traefik.http.middlewares.avalanche-fullnode-stripprefix.stripprefix.prefixes=/avalanche-fullnode"
|
||||||
- "traefik.http.services.avalanche-fullnode.loadbalancer.server.port=9650"
|
- "traefik.http.services.avalanche-fullnode.loadbalancer.server.port=80"
|
||||||
- "traefik.http.routers.avalanche-fullnode.entrypoints=websecure"
|
- "traefik.http.routers.avalanche-fullnode.entrypoints=websecure"
|
||||||
- "traefik.http.routers.avalanche-fullnode.tls.certresolver=myresolver"
|
- "traefik.http.routers.avalanche-fullnode.tls.certresolver=myresolver"
|
||||||
- "traefik.http.routers.avalanche-fullnode.service=avalanche-fullnode"
|
- "traefik.http.routers.avalanche-fullnode.service=avalanche-fullnode"
|
||||||
- "traefik.http.routers.avalanche-fullnode.rule=Host(`$DOMAIN`) && PathPrefix(`/avalanche-fullnode`)"
|
- "traefik.http.routers.avalanche-fullnode.rule=Host(`$DOMAIN`) && PathPrefix(`/avalanche-fullnode`)"
|
||||||
- "traefik.http.routers.avalanche-fullnode.middlewares=avalanche-fullnode-stripprefix, avalanche-fullnode-replacepath, ipwhitelist"
|
- "traefik.http.routers.avalanche-fullnode.middlewares=avalanche-fullnode-stripprefix, avalanche-fullnode-replacepath, ipwhitelist"
|
||||||
|
|
||||||
- "traefik.http.middlewares.avalanche-fullnode-ws-replacepath.replacepath.path=/ext/bc/C/ws"
|
|
||||||
- "traefik.http.middlewares.avalanche-fullnode-ws-stripprefix.stripprefix.prefixes=/avalanche-fullnode-ws"
|
|
||||||
- "traefik.http.services.avalanche-fullnode-ws.loadbalancer.server.port=9650"
|
|
||||||
- "traefik.http.routers.avalanche-fullnode-ws.entrypoints=websecure"
|
|
||||||
- "traefik.http.routers.avalanche-fullnode-ws.tls.certresolver=myresolver"
|
|
||||||
- "traefik.http.routers.avalanche-fullnode-ws.service=avalanche-fullnode"
|
|
||||||
- "traefik.http.routers.avalanche-fullnode-ws.rule=Host(`$DOMAIN`) && PathPrefix(`/avalanche-fullnode-ws`)"
|
|
||||||
- "traefik.http.routers.avalanche-fullnode-ws.middlewares=avalanche-fullnode-ws-stripprefix, avalanche-fullnode-ws-replacepath, ipwhitelist"
|
|
||||||
|
|
||||||
- "prometheus-scrape.enabled=true"
|
|
||||||
- "prometheus-scrape.port=9650"
|
|
||||||
- "prometheus-scrape.job_name=avalanche-fullnode"
|
|
||||||
- "prometheus-scrape.metrics_path=/ext/metrics"
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
avalanche-fullnode:
|
avalanche-fullnode:
|
||||||
|
|||||||
@@ -1,17 +1,25 @@
|
|||||||
|
map $http_upgrade $proxy_connection {
|
||||||
|
default "https_backend";
|
||||||
|
websocket "ws_backend";
|
||||||
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name frontend;
|
server_name example.com;
|
||||||
|
|
||||||
location = / {
|
location / {
|
||||||
proxy_pass http://${PROXY_HOST}:${RPC_PORT};
|
proxy_pass http://$proxy_connection;
|
||||||
}
|
proxy_set_header Host $host;
|
||||||
|
|
||||||
location /ws {
|
|
||||||
proxy_pass http://${PROXY_HOST}:${WS_PORT};
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
proxy_set_header Host $http_host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upstream rpc_backend {
|
||||||
|
server ${PROXY_HOST}:${RPC_PORT}${RPC_PATH:-/};
|
||||||
|
}
|
||||||
|
|
||||||
|
upstream ws_backend {
|
||||||
|
server ${PROXY_HOST}:${WS_PORT}${WS_PATH:-/};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user