Commit 2c72df58 authored by vicotor's avatar vicotor

add blockscout

parent 19306cab
...@@ -8,16 +8,24 @@ init: ...@@ -8,16 +8,24 @@ init:
&& docker compose up layer2-init && docker compose up layer2-init
.PHONY: init .PHONY: init
layer1:
@docker compose up -d layer1
.PHONY: layer1
explorer:
@docker compose up -d backend db frontend blockscout-proxy redis-db stats visualizer stats-db stats-db-init db-init
.PHONY: explorer
build: build:
@docker build --no-cache -t tscel/exchain:contracts -f ./build/Dockerfile.contracts . @docker build --no-cache -t tscel/exchain:contracts -f ./build/Dockerfile.contracts .
.PHONY: build .PHONY: build
start: start:
docker compose up -d layer1 layer2 docker compose up -d layer1 layer2 backend db frontend blockscout-proxy redis-db stats visualizer stats-db stats-db-init db-init
.PHONY: start .PHONY: start
stop: stop:
docker compose down layer1 layer2 docker compose down layer1 layer2 backend db frontend blockscout-proxy redis-db stats visualizer stats-db stats-db-init db-init
.PHONY: stop .PHONY: stop
stop-all: stop-all:
......
...@@ -11,6 +11,8 @@ services: ...@@ -11,6 +11,8 @@ services:
layer1-init: layer1-init:
image: tscel/eth:v1.10.26 image: tscel/eth:v1.10.26
container_name: initlayer1 container_name: initlayer1
networks:
- exchain
volumes: volumes:
- "./layer1/genesis.json:/root/genesis.json" - "./layer1/genesis.json:/root/genesis.json"
- "./data/layer1:/root/node/data" - "./data/layer1:/root/node/data"
...@@ -97,5 +99,379 @@ services: ...@@ -97,5 +99,379 @@ services:
depends_on: depends_on:
- layer1 - layer1
# bellow is services for blockscout.
backend:
command:
- sh
- -c
- bin/blockscout eval "Elixir.Explorer.ReleaseTasks.create_and_migrate()" && bin/blockscout start
container_name: backend
depends_on:
- db
- redis-db
environment:
ACCOUNT_CLOAK_KEY: ""
ACCOUNT_ENABLED: "true"
ACCOUNT_REDIS_URL: redis://redis-db:6379
ADMIN_PANEL_ENABLED: "false"
API_NO_RATE_LIMIT_API_KEY: ""
API_RATE_LIMIT: "50"
API_RATE_LIMIT_BY_IP: "3000"
API_RATE_LIMIT_BY_IP_TIME_INTERVAL: 5m
API_RATE_LIMIT_BY_KEY: "50"
API_RATE_LIMIT_BY_WHITELISTED_IP: "50"
API_RATE_LIMIT_STATIC_API_KEY: ""
API_RATE_LIMIT_TIME_INTERVAL: 1s
API_RATE_LIMIT_UI_V2_TOKEN_TTL_IN_SECONDS: "18000"
API_RATE_LIMIT_UI_V2_WITH_TOKEN: "5"
API_RATE_LIMIT_WHITELISTED_IPS: ""
API_V1_READ_METHODS_DISABLED: "false"
API_V1_WRITE_METHODS_DISABLED: "false"
API_V2_ENABLED: "true"
APPS_MENU: "true"
BLOCK_TRANSFORMER: clique
BLOCKSCOUT_HOST: ""
BLOCKSCOUT_PROTOCOL: ""
CACHE_ADDRESS_SUM_PERIOD: "3600"
CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD: "1800"
CACHE_ADDRESS_TOKENS_USD_SUM_PERIOD: "3600"
CACHE_ADDRESS_TRANSACTIONS_COUNTER_PERIOD: "1800"
CACHE_ADDRESS_TRANSACTIONS_GAS_USAGE_COUNTER_PERIOD: "1800"
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL: "1800"
CACHE_AVERAGE_BLOCK_PERIOD: "1800"
CACHE_BLOCK_COUNT_PERIOD: "7200"
CACHE_MARKET_HISTORY_PERIOD: "21600"
CACHE_TOKEN_HOLDERS_COUNTER_PERIOD: "3600"
CACHE_TOKEN_TRANSFERS_COUNTER_PERIOD: "3600"
CACHE_TOTAL_GAS_USAGE_PERIOD: "3600"
CACHE_TXS_COUNT_PERIOD: "7200"
CHAIN_ID: "10099"
CHECKSUM_ADDRESS_HASHES: "true"
COIN: "ETH"
COIN_BALANCE_HISTORY_DAYS: "90"
COIN_NAME: "ETH"
CONTRACT_MAX_STRING_LENGTH_WITHOUT_TRIMMING: "2040"
CONTRACT_VERIFICATION_ALLOWED_SOLIDITY_EVM_VERSIONS: homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg,istanbul,berlin,london,paris,shanghai,cancun,default
CONTRACT_VERIFICATION_ALLOWED_VYPER_EVM_VERSIONS: byzantium,constantinople,petersburg,istanbul,berlin,paris,shanghai,cancun,default
DATABASE_URL: postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout
DECODE_NOT_A_CONTRACT_CALLS: "true"
DISABLE_CATCHUP_INDEXER: "false"
DISABLE_EXCHANGE_RATES: "true"
DISABLE_INDEXER: "false"
DISABLE_REALTIME_INDEXER: "false"
DISABLE_WEBAPP: "true"
DISPLAY_TOKEN_ICONS: "false"
ECTO_USE_SSL: "false"
EIP_1559_ELASTICITY_MULTIPLIER: "2"
EMISSION_FORMAT: DEFAULT
ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES: "false"
ETHEREUM_JSONRPC_HTTP_URL: http://172.80.1.2:8545
ETHEREUM_JSONRPC_TRACE_URL: http://172.80.1.2:8545
ETHEREUM_JSONRPC_TRANSPORT: http
ETHEREUM_JSONRPC_VARIANT: geth
EXCHANGE_RATES_COIN: ""
EXTERNAL_APPS: '[]'
FETCH_REWARDS_WAY: trace_block
FOOTER_LINK_TO_OTHER_EXPLORERS: "false"
FOOTER_LOGO: /images/blockscout_logo.svg
FOOTER_OTHER_EXPLORERS: '{}'
HEART_BEAT_TIMEOUT: "30"
HIDE_BLOCK_MINER: "false"
INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER: "false"
INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER: "false"
INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER: "false"
INDEXER_DISABLE_TOKEN_INSTANCE_REALTIME_FETCHER: "false"
INDEXER_DISABLE_TOKEN_INSTANCE_REFETCH_FETCHER: "false"
INDEXER_DISABLE_TOKEN_INSTANCE_RETRY_FETCHER: "false"
INDEXER_DISABLE_TOKEN_INSTANCE_SANITIZE_FETCHER: "false"
IPC_PATH: ""
JSON_RPC: ""
LOGO: /images/blockscout_logo.svg
MAINTENANCE_ALERT_MESSAGE: ""
MAX_SIZE_UNLESS_HIDE_ARRAY: "50"
MICROSERVICE_ACCOUNT_ABSTRACTION_ENABLED: "false"
MICROSERVICE_ACCOUNT_ABSTRACTION_URL: http://user-ops-indexer:8050/
MICROSERVICE_ETH_BYTECODE_DB_INTERVAL_BETWEEN_LOOKUPS: 10m
MICROSERVICE_ETH_BYTECODE_DB_MAX_LOOKUPS_CONCURRENCY: "10"
MICROSERVICE_SC_VERIFIER_ENABLED: "true"
MICROSERVICE_SC_VERIFIER_TYPE: eth_bytecode_db
MICROSERVICE_SC_VERIFIER_URL: https://eth-bytecode-db.services.blockscout.com/
MICROSERVICE_SIG_PROVIDER_ENABLED: "true"
MICROSERVICE_SIG_PROVIDER_URL: http://sig-provider:8050/
MICROSERVICE_VISUALIZE_SOL2UML_ENABLED: "true"
MICROSERVICE_VISUALIZE_SOL2UML_URL: http://visualizer:8050/
NETWORK: "LAYER1"
NETWORK_PATH: /
NFT_MEDIA_HANDLER_ENABLED: "false"
NFT_MEDIA_HANDLER_REMOTE_DISPATCHER_NODE_MODE_ENABLED: "true"
POOL_SIZE: "80"
POOL_SIZE_API: "10"
PORT: "4000"
RE_CAPTCHA_CLIENT_KEY: ""
RE_CAPTCHA_DISABLED: "false"
RE_CAPTCHA_SECRET_KEY: ""
RE_CAPTCHA_V3_CLIENT_KEY: ""
RE_CAPTCHA_V3_SECRET_KEY: ""
RELEASE_COOKIE: secret_cookie
RELEASE_DISTRIBUTION: name
RELEASE_LINK: ""
RELEASE_NODE: producer@172.18.0.4
SECRET_KEY_BASE: 56NtB48ear7+wMSf0IQuWDAAazhpb31qyc7GiyspBP2vh7t5zlCsF5QDv76chXeN
SHOW_ADDRESS_MARKETCAP_PERCENTAGE: "true"
SHOW_MAINTENANCE_ALERT: "false"
SHOW_PRICE_CHART: "false"
SHOW_PRICE_CHART_LEGEND: "false"
SHOW_TENDERLY_LINK: "false"
SHOW_TXS_CHART: "true"
SOURCIFY_INTEGRATION_ENABLED: "false"
SOURCIFY_REPO_URL: ""
SOURCIFY_SERVER_URL: ""
SUBNETWORK: Exchain Layer1
SUPPORTED_CHAINS: '{}'
TENDERLY_CHAIN_PATH: ""
TOKEN_METADATA_UPDATE_INTERVAL: "172800"
TXS_HISTORIAN_INIT_LAG: "0"
TXS_STATS_DAYS_TO_COMPILE_AT_INIT: "10"
TXS_STATS_ENABLED: "true"
UNCLES_IN_AVERAGE_BLOCK_TIME: "false"
extra_hosts:
- host.docker.internal=host-gateway
image: blockscout/blockscout:latest
links:
- db:database
networks:
- exchain
restart: always
volumes:
- "./data/blockscout/logs:/app/logs"
- "./data/blockscout/dets:/app/dets"
db:
command:
- postgres
- -c
- max_connections=200
- -c
- client_connection_check_interval=60000
container_name: db
depends_on:
db-init:
condition: service_completed_successfully
required: true
environment:
POSTGRES_DB: blockscout
POSTGRES_PASSWORD: ceWb1MeLBEeOIfk65gU8EjF8
POSTGRES_USER: blockscout
healthcheck:
test:
- CMD-SHELL
- pg_isready -U blockscout -d blockscout
timeout: 5s
interval: 10s
retries: 5
start_period: 10s
image: postgres:17
networks:
- exchain
ports:
- target: 5432
published: "7432"
restart: always
shm_size: "268435456"
user: 2000:2000
volumes:
- "./data/blockscout/db-data:/var/lib/postgresql/data"
db-init:
entrypoint:
- sh
- -c
- |
chown -R 2000:2000 /var/lib/postgresql/data
image: postgres:17
networks:
- exchain
volumes:
- "./data/blockscout/db-data:/var/lib/postgresql/data"
frontend:
container_name: frontend
depends_on:
- backend
environment:
NEXT_PUBLIC_API_BASE_PATH: /
NEXT_PUBLIC_API_HOST: localhost:29080
NEXT_PUBLIC_API_PROTOCOL: http
NEXT_PUBLIC_API_SPEC_URL: https://raw.githubusercontent.com/blockscout/blockscout-api-v2-swagger/main/swagger.yaml
NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL: ws
NEXT_PUBLIC_APP_HOST: localhost:29080
NEXT_PUBLIC_APP_PROTOCOL: http
NEXT_PUBLIC_HOMEPAGE_CHARTS: '[''daily_txs'']'
NEXT_PUBLIC_IS_TESTNET: "true"
NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS: "18"
NEXT_PUBLIC_NETWORK_CURRENCY_NAME: Ether
NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL: ETH
NEXT_PUBLIC_NETWORK_ID: "10099"
NEXT_PUBLIC_NETWORK_NAME: layer1 chain
NEXT_PUBLIC_NETWORK_SHORT_NAME: layer1 chain
NEXT_PUBLIC_STATS_API_HOST: http://localhost:28080
NEXT_PUBLIC_VISUALIZE_API_HOST: http://localhost:28081
image: ghcr.io/blockscout/frontend:latest
networks:
- exchain
restart: always
blockscout-proxy:
container_name: proxy
depends_on:
- backend
- frontend
- stats
environment:
BACK_PROXY_PASS: http://backend:4000
FRONT_PROXY_PASS: http://frontend:3000
extra_hosts:
- host.docker.internal=host-gateway
image: nginx
networks:
- exchain
ports:
- "29080:80"
- "28080:8080"
- "28081:8081"
volumes:
- "./layer1/proxy:/etc/nginx/templates"
redis-db:
command:
- redis-server
container_name: redis-db
image: redis:alpine
networks:
- exchain
volumes:
- "./data/blockscout/redis-data:/data"
sig-provider:
container_name: sig-provider
image: ghcr.io/blockscout/sig-provider:latest
networks:
- exchain
restart: always
stats:
container_name: stats
depends_on:
- backend
- stats-db
environment:
STATS__BLOCKSCOUT_API_URL: http://host.docker.internal
STATS__BLOCKSCOUT_DB_URL: postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout
STATS__CREATE_DATABASE: "true"
STATS__DB_URL: postgres://stats:n0uejXPl61ci6ldCuE2gQU5Y@stats-db:5432/stats
STATS__DEFAULT_SCHEDULE: 0 0 1 * * * *
STATS__FORCE_UPDATE_ON_START: "false"
STATS__JAEGER__AGENT_ENDPOINT: localhost:6831
STATS__JAEGER__ENABLED: "false"
STATS__METRICS__ADDR: 0.0.0.0:6060
STATS__METRICS__ENABLED: "false"
STATS__METRICS__ROUTE: /metrics
STATS__RUN_MIGRATIONS: "true"
STATS__SERVER__GRPC__ADDR: 0.0.0.0:8051
STATS__SERVER__GRPC__ENABLED: "false"
STATS__SERVER__HTTP__ADDR: 0.0.0.0:8050
STATS__SERVER__HTTP__ENABLED: "true"
STATS__SERVER__HTTP__MAX_BODY_SIZE: "2097152"
STATS__TRACING__ENABLED: "true"
STATS__TRACING__FORMAT: default
extra_hosts:
- host.docker.internal=host-gateway
image: ghcr.io/blockscout/stats:latest
networks:
- exchain
restart: always
stats-db:
command:
- postgres
- -c
- max_connections=200
container_name: stats-db
depends_on:
stats-db-init:
condition: service_completed_successfully
required: true
environment:
POSTGRES_DB: stats
POSTGRES_PASSWORD: n0uejXPl61ci6ldCuE2gQU5Y
POSTGRES_USER: stats
healthcheck:
test:
- CMD-SHELL
- pg_isready -U stats -d stats
timeout: 5s
interval: 10s
retries: 5
start_period: 10s
image: postgres:17
networks:
- exchain
ports:
- target: 5432
published: "7433"
restart: always
shm_size: "268435456"
user: 2000:2000
volumes:
- "./data/blockscout/stats-db-data:/var/lib/postgresql/data"
stats-db-init:
entrypoint:
- sh
- -c
- |
chown -R 2000:2000 /var/lib/postgresql/data
image: postgres:17
networks:
- exchain
volumes:
- "./data/blockscout/stats-db-data:/var/lib/postgresql/data"
user-ops-indexer:
container_name: user-ops-indexer
depends_on:
- backend
- db
environment:
USER_OPS_INDEXER__API__MAX_PAGE_SIZE: "100"
USER_OPS_INDEXER__DATABASE__CONNECT__URL: postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout
USER_OPS_INDEXER__DATABASE__CREATE_DATABASE: "false"
USER_OPS_INDEXER__DATABASE__RUN_MIGRATIONS: "true"
USER_OPS_INDEXER__INDEXER__CONCURRENCY: "20"
USER_OPS_INDEXER__INDEXER__ENTRYPOINTS__V06: "true"
USER_OPS_INDEXER__INDEXER__ENTRYPOINTS__V07: "true"
USER_OPS_INDEXER__INDEXER__PAST_DB_LOGS_INDEXER__ENABLED: "true"
USER_OPS_INDEXER__INDEXER__PAST_DB_LOGS_INDEXER__END_BLOCK: "0"
USER_OPS_INDEXER__INDEXER__PAST_DB_LOGS_INDEXER__START_BLOCK: "-100000"
USER_OPS_INDEXER__INDEXER__PAST_RPC_LOGS_INDEXER__BLOCK_RANGE: "1000"
USER_OPS_INDEXER__INDEXER__PAST_RPC_LOGS_INDEXER__ENABLED: "true"
USER_OPS_INDEXER__INDEXER__REALTIME__ENABLED: "true"
USER_OPS_INDEXER__INDEXER__RPC_URL: ws://host.docker.internal:8545/
USER_OPS_INDEXER__JAEGER__AGENT_ENDPOINT: localhost:6831
USER_OPS_INDEXER__JAEGER__ENABLED: "false"
USER_OPS_INDEXER__METRICS__ADDR: 0.0.0.0:6060
USER_OPS_INDEXER__METRICS__ENABLED: "true"
USER_OPS_INDEXER__METRICS__ROUTE: /metrics
USER_OPS_INDEXER__SERVER__GRPC__ADDR: 0.0.0.0:8051
USER_OPS_INDEXER__SERVER__GRPC__ENABLED: "false"
USER_OPS_INDEXER__SERVER__HTTP__ADDR: 0.0.0.0:8050
USER_OPS_INDEXER__SERVER__HTTP__ENABLED: "true"
USER_OPS_INDEXER__SERVER__HTTP__MAX_BODY_SIZE: "2097152"
USER_OPS_INDEXER__TRACING__ENABLED: "true"
USER_OPS_INDEXER__TRACING__FORMAT: default
extra_hosts:
- host.docker.internal=host-gateway
image: ghcr.io/blockscout/user-ops-indexer:latest
networks:
- exchain
restart: always
visualizer:
container_name: visualizer
environment:
VISUALIZER__SERVER__GRPC__ENABLED: "false"
image: ghcr.io/blockscout/visualizer:latest
networks:
- exchain
restart: always
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name localhost;
proxy_http_version 1.1;
location ~ ^/(api(?!-docs$)|socket|sitemap.xml|auth/auth0|auth/auth0/callback|auth/logout) {
proxy_pass ${BACK_PROXY_PASS};
proxy_http_version 1.1;
proxy_set_header Host "$host";
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";
proxy_set_header Upgrade "$http_upgrade";
proxy_set_header Connection $connection_upgrade;
proxy_cache_bypass $http_upgrade;
}
location / {
proxy_pass ${FRONT_PROXY_PASS};
proxy_http_version 1.1;
proxy_set_header Host "$host";
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";
proxy_set_header Upgrade "$http_upgrade";
proxy_set_header Connection $connection_upgrade;
proxy_cache_bypass $http_upgrade;
}
}
server {
listen 8080;
server_name localhost;
proxy_http_version 1.1;
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Methods;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always;
location / {
proxy_pass http://stats:8050/;
proxy_http_version 1.1;
proxy_set_header Host "$host";
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";
proxy_set_header Upgrade "$http_upgrade";
proxy_set_header Connection $connection_upgrade;
proxy_cache_bypass $http_upgrade;
}
}
server {
listen 8081;
server_name localhost;
proxy_http_version 1.1;
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Methods;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always;
add_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,x-csrf-token' always;
location / {
proxy_pass http://visualizer:8050/;
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host "$host";
proxy_set_header X-Real-IP "$remote_addr";
proxy_connect_timeout 30m;
proxy_read_timeout 30m;
proxy_send_timeout 30m;
proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for";
proxy_set_header X-Forwarded-Proto "$scheme";
proxy_set_header Upgrade "$http_upgrade";
proxy_set_header Connection $connection_upgrade;
proxy_cache_bypass $http_upgrade;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always;
add_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,x-csrf-token' always;
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
}
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name localhost;
proxy_http_version 1.1;
location ~ ^/(api(?!-docs$)|socket|sitemap.xml|auth/auth0|auth/auth0/callback|auth/logout) {
proxy_pass ${BACK_PROXY_PASS};
proxy_http_version 1.1;
proxy_set_header Host "$host";
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";
proxy_set_header Upgrade "$http_upgrade";
proxy_set_header Connection $connection_upgrade;
proxy_cache_bypass $http_upgrade;
}
location / {
proxy_pass ${FRONT_PROXY_PASS};
proxy_http_version 1.1;
proxy_set_header Host "$host";
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";
proxy_set_header Upgrade "$http_upgrade";
proxy_set_header Connection $connection_upgrade;
proxy_cache_bypass $http_upgrade;
}
}
\ No newline at end of file
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 8080;
server_name localhost;
proxy_http_version 1.1;
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Methods;
add_header 'Access-Control-Allow-Origin' 'http://localhost:3000' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always;
location / {
proxy_pass http://stats:8050/;
proxy_http_version 1.1;
proxy_set_header Host "$host";
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";
proxy_set_header Upgrade "$http_upgrade";
proxy_set_header Connection $connection_upgrade;
proxy_cache_bypass $http_upgrade;
}
}
server {
listen 8081;
server_name localhost;
proxy_http_version 1.1;
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Methods;
add_header 'Access-Control-Allow-Origin' 'http://localhost:3000' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always;
add_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,x-csrf-token' always;
location / {
proxy_pass http://visualizer:8050/;
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host "$host";
proxy_set_header X-Real-IP "$remote_addr";
proxy_connect_timeout 30m;
proxy_read_timeout 30m;
proxy_send_timeout 30m;
proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for";
proxy_set_header X-Forwarded-Proto "$scheme";
proxy_set_header Upgrade "$http_upgrade";
proxy_set_header Connection $connection_upgrade;
proxy_cache_bypass $http_upgrade;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' 'http://localhost:3000' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always;
add_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,x-csrf-token' always;
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment