chore: use envoy route (#1)

* feat: use envoy to route stacks core requests

* chore: use envoy 1.30.2
This commit is contained in:
mhatal
2024-06-10 16:11:36 +08:00
committed by GitHub
parent 560d7b4180
commit a14580e84d
2 changed files with 72 additions and 1 deletions

63
config/envoy.yaml Normal file
View File

@@ -0,0 +1,63 @@
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 3999
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
stat_prefix: ingress_http
codec_type: auto
http_filters:
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
route_config:
name: local_route
virtual_hosts:
- name: stacks_node
domains:
- "*"
routes:
- match:
prefix: "/v2"
route:
cluster: stacks_core
- match:
prefix: "/"
route:
cluster: stacks_api
cors:
allow_origin_string_match:
- prefix: "*"
allow_methods: GET, PUT, DELETE, POST, OPTIONS
allow_headers: Accept, Accept-Language, Content-Language, Content-Type, Range
max_age: "1728000"
clusters:
- name: stacks_api
type: STATIC
connect_timeout: 10s
load_assignment:
cluster_name: stacks_api
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 23999
- name: stacks_core
type: STATIC
connect_timeout: 10s
load_assignment:
cluster_name: stacks_core
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 20443

View File

@@ -1,4 +1,12 @@
services:
envoy:
restart: always
container_name: stacks_envoy
image: envoyproxy/envoy:v1.30.2
network_mode: "host"
command: --base-id 3999 --config-path /etc/envoy/envoy.yaml
volumes:
- "$PWD/config/envoy.yaml:/etc/envoy/envoy.yaml:ro"
stacks-blockchain-postgres:
restart: always
image: postgres:15.6
@@ -31,7 +39,7 @@ services:
PG_SCHEMA: stacks_blockchain_api
STACKS_CORE_EVENT_PORT: "3700"
STACKS_CORE_EVENT_HOST: http://0.0.0.0
STACKS_BLOCKCHAIN_API_PORT: "3999"
STACKS_BLOCKCHAIN_API_PORT: "23999"
STACKS_BLOCKCHAIN_API_HOST: 0.0.0.0
STACKS_CORE_RPC_HOST: 127.0.0.1
STACKS_CORE_RPC_PORT: "20443"