Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docker-compose): Add NGINX #371

Merged
merged 4 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .github/cannon/seeding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
55 changes: 55 additions & 0 deletions deploy/local/docker-compose/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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 http2;
server_name server.$HOSTNAME;

location / {
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;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
70 changes: 46 additions & 24 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -484,7 +484,6 @@ services:
- "/var/tempo"
volumes:
- tempo-data:/var/tempo

tempo:
image: *tempoImage
container_name: xatu-tempo
Expand All @@ -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:
Expand All @@ -508,6 +507,29 @@ services:
interval: 5s
timeout: 5s
retries: 5
xatu-nginx:
profiles:
- ""
image: nginx:1.27.1-bookworm
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:
Expand Down
Loading