From bb66fc66deedaa1302dad53a8796fa24c587cc35 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Thu, 12 Sep 2024 15:38:38 +1000 Subject: [PATCH 1/4] feat(docker-compose): Add NGINX --- deploy/local/docker-compose/nginx/nginx.conf | 69 +++++++++++++++++++ docker-compose.yml | 70 +++++++++++++------- 2 files changed, 115 insertions(+), 24 deletions(-) create mode 100644 deploy/local/docker-compose/nginx/nginx.conf diff --git a/deploy/local/docker-compose/nginx/nginx.conf b/deploy/local/docker-compose/nginx/nginx.conf new file mode 100644 index 00000000..0688d8b0 --- /dev/null +++ b/deploy/local/docker-compose/nginx/nginx.conf @@ -0,0 +1,69 @@ +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for" ' + '$host'; + access_log /var/log/nginx/access.log main; + sendfile on; + keepalive_timeout 65; + + server { + listen 80; + server_name _; + + location / { + return 404; + } + } + + server { + listen 80; + server_name grafana.$HOSTNAME; + + location / { + proxy_pass http://xatu-grafana:3000; + 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; + } + } + + server { + listen 80; + server_name server.$HOSTNAME; + + location / { + proxy_pass http://xatu-server:8080; + 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; + } + } + + + server { + listen 80; + server_name tempo.$HOSTNAME; + + location / { + proxy_pass http://tempo:3200; + 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; + } + } +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 9a0df510..4c83476e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,8 +15,8 @@ services: - ./deploy/local/docker-compose/clickhouse/clickhouse-01/etc/clickhouse-server/users.d/users.xml:/etc/clickhouse-server/users.d/users.xml - ./deploy/local/docker-compose/clickhouse/clickhouse-01/etc/clickhouse-server/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d ports: - - "127.0.0.1:8123:8123" - - "127.0.0.1:9000:9000" + - "${CLICKHOUSE_01_HTTP_ADDRESS:-127.0.0.1}:${CLICKHOUSE_01_HTTP_PORT:-8123}:8123" + - "${CLICKHOUSE_01_NATIVE_ADDRESS:-127.0.0.1}:${CLICKHOUSE_01_NATIVE_PORT:-9000}:9000" depends_on: xatu-clickhouse-zookeeper-01: condition: service_healthy @@ -50,8 +50,8 @@ services: - ./deploy/local/docker-compose/clickhouse/clickhouse-02/etc/clickhouse-server/users.d/users.xml:/etc/clickhouse-server/users.d/users.xml - ./deploy/local/docker-compose/clickhouse/clickhouse-02/etc/clickhouse-server/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d ports: - - "127.0.0.1:8124:8123" - - "127.0.0.1:9001:9000" + - "${CLICKHOUSE_02_HTTP_ADDRESS:-127.0.0.1}:${CLICKHOUSE_02_HTTP_PORT:-8124}:8123" + - "${CLICKHOUSE_02_NATIVE_ADDRESS:-127.0.0.1}:${CLICKHOUSE_02_NATIVE_PORT:-9001}:9000" depends_on: xatu-clickhouse-zookeeper-01: condition: service_healthy @@ -151,8 +151,8 @@ services: context: . dockerfile: Dockerfile ports: - - "8080:8080" - - "9096:9090" + - "${XATU_SERVER_ADDRESS:-0.0.0.0}:${XATU_SERVER_PORT:-8080}:8080" + - "127.0.0.1:9096:9090" volumes: - ./deploy/local/docker-compose/xatu-server.yaml:/etc/xatu-server/config.yaml networks: @@ -167,11 +167,11 @@ services: volumes: - postgres-data:/var/lib/postgresql/data environment: - POSTGRES_DB: xatu - POSTGRES_USER: user - POSTGRES_PASSWORD: password + POSTGRES_DB: ${POSTGRES_DB:-xatu} + POSTGRES_USER: ${POSTGRES_USER:-user} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password} healthcheck: - test: ["CMD-SHELL", "pg_isready -U user -d xatu"] + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-user} -d ${POSTGRES_DB:-xatu}"] interval: 10s timeout: 5s retries: 5 @@ -185,7 +185,7 @@ services: image: grafana/grafana:latest container_name: xatu-grafana ports: - - "3000:3000" + - "${GRAFANA_ADDRESS:-0.0.0.0}:${GRAFANA_PORT:-3000}:3000" networks: - xatu-net environment: @@ -203,7 +203,7 @@ services: - "" image: prom/prometheus:latest ports: - - "9090:9090" + - "${PROMETHEUS_ADDRESS:-127.0.0.1}:${PROMETHEUS_PORT:-9090}:9090" networks: - xatu-net volumes: @@ -303,8 +303,8 @@ services: KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 KAFKA_LOG4J_LOGGERS: "kafka.controller=ERROR,kafka.producer.async.DefaultEventHandler=ERROR,state.change.logger=ERROR" ports: - - "29092:29092" - - "9092:9092" + - "${KAFKA_ADDRESS:-127.0.0.1}:${KAFKA_PORT:-29092}:29092" + - "${KAFKA_BROKER_ADDRESS:-127.0.0.1}:${KAFKA_BROKER_PORT:-9092}:9092" networks: - xatu-net volumes: @@ -331,7 +331,7 @@ services: environment: ZOO_LOG4J_PROP: "ERROR,CONSOLE" ports: - - "2181:2181" + - "${KAFKA_ZOOKEEPER_ADDRESS:-127.0.0.1}:${KAFKA_ZOOKEEPER_PORT:-2181}:2181" networks: - xatu-net volumes: @@ -354,7 +354,7 @@ services: environment: KAFKA_BROKERS: "xatu-kafka:29092" ports: - - "9005:9005" + - "${VECTOR_HTTP_KAFKA_ADDRESS:-127.0.0.1}:${VECTOR_HTTP_KAFKA_PORT:-9005}:9005" networks: - xatu-net healthcheck: @@ -379,7 +379,7 @@ services: networks: - xatu-net ports: - - "8686:8686" + - "${VECTOR_KAFKA_CLICKHOUSE_ADDRESS:-127.0.0.1}:${VECTOR_KAFKA_CLICKHOUSE_PORT:-8686}:8686" environment: CLICKHOUSE_ENDPOINT: "xatu-clickhouse-01:8123" CLICKHOUSE_USER: default @@ -484,7 +484,6 @@ services: - "/var/tempo" volumes: - tempo-data:/var/tempo - tempo: image: *tempoImage container_name: xatu-tempo @@ -493,12 +492,12 @@ services: - ./deploy/local/docker-compose/tempo.yaml:/etc/tempo.yaml - tempo-data:/var/tempo ports: - - "14268:14268" # jaeger ingest - - "3200:3200" # tempo - - "9095:9095" # tempo grpc - - "4317:4317" # otlp grpc - - "4318:4318" # otlp http - - "9411:9411" # zipkin + - "${TEMPO_JAEGER_ADDRESS:-127.0.0.1}:${TEMPO_JAEGER_PORT:-6831}:6831/udp" # jaeger ingest + - "${TEMPO_HTTP_ADDRESS:-127.0.0.1}:${TEMPO_HTTP_PORT:-3200}:3200" # tempo + - "${TEMPO_GRPC_ADDRESS:-127.0.0.1}:${TEMPO_GRPC_PORT:-9095}:9095" # tempo grpc + - "${TEMPO_OTLP_GRPC_ADDRESS:-127.0.0.1}:${TEMPO_OTLP_GRPC_PORT:-4317}:4317" # otlp grpc + - "${TEMPO_OTLP_HTTP_ADDRESS:-127.0.0.1}:${TEMPO_OTLP_HTTP_PORT:-4318}:4318" # otlp http + - "${TEMPO_ZIPKIN_ADDRESS:-127.0.0.1}:${TEMPO_ZIPKIN_PORT:-9411}:9411" # zipkin networks: - xatu-net depends_on: @@ -508,6 +507,29 @@ services: interval: 5s timeout: 5s retries: 5 + xatu-nginx: + profiles: + - nginx + image: nginx:alpine + container_name: xatu-nginx + ports: + - "${NGINX_ADDRESS:-127.0.0.1}:${NGINX_PORT:-80}:80" + environment: + - BASE_HOSTNAME=${BASE_HOSTNAME:-example.com} + volumes: + - ./deploy/local/docker-compose/nginx/nginx.conf:/tmp/nginx.conf:ro + networks: + - xatu-net + depends_on: + - xatu-grafana + - xatu-server + - xatu-prometheus + - tempo + command: > + /bin/sh -c " + sed 's/\$$HOSTNAME/'"$$BASE_HOSTNAME"'/g' /tmp/nginx.conf > /etc/nginx/nginx.conf && + nginx -g 'daemon off;' + " networks: xatu-net: From f2b5447385b2a02de4904115fb315540bf9b6d3e Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Thu, 12 Sep 2024 16:11:35 +1000 Subject: [PATCH 2/4] feat: Update nginx server to use HTTP/2 and gRPC pass --- deploy/local/docker-compose/nginx/nginx.conf | 4 ++-- docker-compose.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deploy/local/docker-compose/nginx/nginx.conf b/deploy/local/docker-compose/nginx/nginx.conf index 0688d8b0..c16c5776 100644 --- a/deploy/local/docker-compose/nginx/nginx.conf +++ b/deploy/local/docker-compose/nginx/nginx.conf @@ -41,11 +41,11 @@ http { } server { - listen 80; + listen 80 http2; server_name server.$HOSTNAME; location / { - proxy_pass http://xatu-server:8080; + grpc_pass grpc://xatu-server:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/docker-compose.yml b/docker-compose.yml index 4c83476e..69197092 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -509,8 +509,8 @@ services: retries: 5 xatu-nginx: profiles: - - nginx - image: nginx:alpine + - "" + image: nginx:1.27.1-bookworm container_name: xatu-nginx ports: - "${NGINX_ADDRESS:-127.0.0.1}:${NGINX_PORT:-80}:80" From 1a127afa99100456d08227a5087aad6fed635c78 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Thu, 12 Sep 2024 16:11:50 +1000 Subject: [PATCH 3/4] style: Remove duplicate server block in nginx.conf --- deploy/local/docker-compose/nginx/nginx.conf | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/deploy/local/docker-compose/nginx/nginx.conf b/deploy/local/docker-compose/nginx/nginx.conf index c16c5776..c307f022 100644 --- a/deploy/local/docker-compose/nginx/nginx.conf +++ b/deploy/local/docker-compose/nginx/nginx.conf @@ -52,18 +52,4 @@ http { proxy_set_header X-Forwarded-Proto $scheme; } } - - - server { - listen 80; - server_name tempo.$HOSTNAME; - - location / { - proxy_pass http://tempo:3200; - 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; - } - } } \ No newline at end of file From 4f704c339b843189750027f2e7b223f8bfea0fcc Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Thu, 12 Sep 2024 16:58:44 +1000 Subject: [PATCH 4/4] chore: Remove obsolete seeding test for BEACON_API_ETH_V1 --- .github/cannon/seeding.yaml | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/.github/cannon/seeding.yaml b/.github/cannon/seeding.yaml index f1f993cd..3e7ed7b7 100644 --- a/.github/cannon/seeding.yaml +++ b/.github/cannon/seeding.yaml @@ -142,25 +142,6 @@ networks: AND proposer_validator_index = 1337851 AND proposer_pubkey = '0xb69cc87f9610eeaff816b2c0182e3320fd04c8be572a3adba2b40d7f11a6d84dadeb24cf2829d10eda0d611b46da0907'" expected: "1" - - name: BEACON_API_ETH_V1_BEACON_BLOB_SIDECAR - finalizedEpoch: 71010 - assert: - query: "SELECT COUNT(*) FROM canonical_beacon_blob_sidecar FINAL - WHERE - slot = 2272356 - AND slot_start_date_time = '2024-08-09 02:31:12' - AND epoch = 71011 - AND epoch_start_date_time = '2024-08-09 02:30:24' - AND block_root = '0x1e02ff0da1811c5609acafd4597543878cb6216fe519587da1ab0aeb3296ac75' - AND block_parent_root = '0x0e81a2325869e04919bffc5bbf745ecafd22c7005ac717ee5122f1a3f51ea24a' - AND versioned_hash = '0x0100d3b0b63aefd96e6b2c7aa84c1a0cdd6fe8366128cebf032fc64846c6608c' - AND kzg_commitment = '0xb1b3ca5607286f6b221fa38321a80980cfe10946e9e33e07b74e13a93e385ddb99ca727a1f617e6f0c088f68f1da63b5' - AND kzg_proof = '0x8bdca97a0c6c7baf0a94d25bfa70024319f2ebb36442865333f6d41d8d5f141283f337da24dc7f3b72151098ddf60571' - AND proposer_index = 1744957 - AND blob_index = 2 - AND blob_size = 131072 - AND blob_empty_size = 56206" - expected: "1" - name: BEACON_API_ETH_V2_BEACON_BLOCK_EXECUTION_TRANSACTION finalizedEpoch: 71010 assert: