diff --git a/docker-compose/README.md b/docker-compose/README.md index 1283ede3d4..fcd8f8b588 100644 --- a/docker-compose/README.md +++ b/docker-compose/README.md @@ -53,6 +53,7 @@ The repo contains built-in configs for different JSON RPC clients without need t - Running explorer with external backend: `docker-compose -f external-backend.yml up -d` - Running explorer with external frontend: `docker-compose -f external-frontend.yml up -d` - Running all microservices: `docker-compose -f microservices.yml up -d` +- Running only explorer without microservices: `docker-compose -f no-services.yml up -d` All of the configs assume the Ethereum JSON RPC is running at http://localhost:8545. diff --git a/docker-compose/envs/common-stats.env b/docker-compose/envs/common-stats.env index f5eed636ba..0d2c38c1af 100644 --- a/docker-compose/envs/common-stats.env +++ b/docker-compose/envs/common-stats.env @@ -25,3 +25,5 @@ STATS__JAEGER__AGENT_ENDPOINT=localhost:6831 STATS__TRACING__ENABLED=true STATS__TRACING__FORMAT=default + +STATS__BLOCKSCOUT_API_URL=http://host.docker.internal diff --git a/docker-compose/no-services.yml b/docker-compose/no-services.yml new file mode 100644 index 0000000000..d1608dba98 --- /dev/null +++ b/docker-compose/no-services.yml @@ -0,0 +1,66 @@ +version: '3.9' + +services: + redis-db: + extends: + file: ./services/redis.yml + service: redis-db + + db-init: + extends: + file: ./services/db.yml + service: db-init + + db: + depends_on: + db-init: + condition: service_completed_successfully + extends: + file: ./services/db.yml + service: db + + backend: + depends_on: + - db + - redis-db + extends: + file: ./services/backend.yml + service: backend + build: + context: .. + dockerfile: ./docker/Dockerfile + args: + CACHE_EXCHANGE_RATES_PERIOD: "" + API_V1_READ_METHODS_DISABLED: "false" + DISABLE_WEBAPP: "false" + API_V1_WRITE_METHODS_DISABLED: "false" + CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED: "" + CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL: "" + ADMIN_PANEL_ENABLED: "" + RELEASE_VERSION: 6.9.0 + links: + - db:database + environment: + ETHEREUM_JSONRPC_HTTP_URL: http://host.docker.internal:8545/ + ETHEREUM_JSONRPC_TRACE_URL: http://host.docker.internal:8545/ + ETHEREUM_JSONRPC_WS_URL: ws://host.docker.internal:8545/ + CHAIN_ID: '1337' + + frontend: + depends_on: + - backend + extends: + file: ./services/frontend.yml + service: frontend + environment: + NEXT_PUBLIC_STATS_API_HOST: + + proxy: + depends_on: + - backend + - frontend + extends: + file: ./services/nginx-explorer.yml + service: proxy + volumes: + - "./proxy/explorer.conf.template:/etc/nginx/templates/default.conf.template" diff --git a/docker-compose/proxy/explorer.conf.template b/docker-compose/proxy/explorer.conf.template new file mode 100644 index 0000000000..f63e979a0d --- /dev/null +++ b/docker-compose/proxy/explorer.conf.template @@ -0,0 +1,34 @@ +map $http_upgrade $connection_upgrade { + + default upgrade; + '' close; +} + +server { + listen 80; + server_name localhost; + proxy_http_version 1.1; + + location ~ ^/(api|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 diff --git a/docker-compose/services/nginx-explorer.yml b/docker-compose/services/nginx-explorer.yml new file mode 100644 index 0000000000..513a054b05 --- /dev/null +++ b/docker-compose/services/nginx-explorer.yml @@ -0,0 +1,14 @@ +version: '3.9' + +services: + proxy: + image: nginx + container_name: proxy + extra_hosts: + - 'host.docker.internal:host-gateway' + environment: + BACK_PROXY_PASS: ${BACK_PROXY_PASS:-http://backend:4000} + FRONT_PROXY_PASS: ${FRONT_PROXY_PASS:-http://frontend:3000} + ports: + - target: 80 + published: 80