Улучшения в кластере. Кластер формируется динамически, без единой точки отказа (каждая нода подключается ко всем трём через connect_nodes/0)
This commit is contained in:
@@ -1,137 +1,115 @@
|
||||
# docker/docker-compose.yml
|
||||
services:
|
||||
# ================== Кластер EventHub ==================
|
||||
eventhub-node1:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
container_name: eventhub-node1
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "8081:8081"
|
||||
- "8445:8445"
|
||||
- "8446:8446"
|
||||
hostname: eventhub-node1.local
|
||||
environment:
|
||||
- NODE_NAME=eventhub-node1@eventhub-node1
|
||||
- HTTP_PORT=8080
|
||||
- WS_PORT=8081
|
||||
- ADMIN_HTTP_PORT=8445
|
||||
- ADMIN_WS_PORT=8446
|
||||
- MNESIA_DIR=/app/data
|
||||
- NODE_NAME=eventhub-node1@eventhub-node1.local
|
||||
- RELEASE_COOKIE=${RELEASE_COOKIE}
|
||||
- JWT_SECRET=${JWT_SECRET}
|
||||
volumes:
|
||||
- eventhub-node1-data:/app/data
|
||||
- JOIN_NODES=eventhub-node1@eventhub-node1.local,eventhub-node2@eventhub-node2.local,eventhub-node3@eventhub-node3.local
|
||||
networks:
|
||||
- eventhub-net
|
||||
volumes:
|
||||
- eventhub-node1-data:/app/data
|
||||
ports:
|
||||
- "8080:8080" # REST API
|
||||
- "8081:8081" # WebSocket
|
||||
- "8445:8445" # Admin REST
|
||||
- "8446:8446" # Admin WebSocket
|
||||
restart: unless-stopped
|
||||
|
||||
eventhub-node2:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
container_name: eventhub-node2
|
||||
hostname: eventhub-node2.local
|
||||
environment:
|
||||
- NODE_NAME=eventhub-node2@eventhub-node2.local
|
||||
- RELEASE_COOKIE=${RELEASE_COOKIE}
|
||||
- JWT_SECRET=${JWT_SECRET}
|
||||
- JOIN_NODES=eventhub-node1@eventhub-node1.local,eventhub-node2@eventhub-node2.local,eventhub-node3@eventhub-node3.local
|
||||
networks:
|
||||
- eventhub-net
|
||||
volumes:
|
||||
- eventhub-node2-data:/app/data
|
||||
ports:
|
||||
- "8082:8080"
|
||||
- "8083:8081"
|
||||
- "8447:8445"
|
||||
- "8448:8446"
|
||||
environment:
|
||||
- NODE_NAME=eventhub-node2@eventhub-node2
|
||||
- HTTP_PORT=8080
|
||||
- WS_PORT=8081
|
||||
- ADMIN_HTTP_PORT=8445
|
||||
- ADMIN_WS_PORT=8446
|
||||
- MNESIA_DIR=/app/data
|
||||
- RELEASE_COOKIE=${RELEASE_COOKIE}
|
||||
- JWT_SECRET=${JWT_SECRET}
|
||||
- JOIN_NODES=eventhub-node1@eventhub-node1
|
||||
volumes:
|
||||
- eventhub-node2-data:/app/data
|
||||
networks:
|
||||
- eventhub-net
|
||||
depends_on:
|
||||
- eventhub-node1
|
||||
- "9445:8445"
|
||||
- "9446:8446"
|
||||
restart: unless-stopped
|
||||
|
||||
eventhub-node3:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
container_name: eventhub-node3
|
||||
hostname: eventhub-node3.local
|
||||
environment:
|
||||
- NODE_NAME=eventhub-node3@eventhub-node3.local
|
||||
- RELEASE_COOKIE=${RELEASE_COOKIE}
|
||||
- JWT_SECRET=${JWT_SECRET}
|
||||
- JOIN_NODES=eventhub-node1@eventhub-node1.local,eventhub-node2@eventhub-node2.local,eventhub-node3@eventhub-node3.local
|
||||
networks:
|
||||
- eventhub-net
|
||||
volumes:
|
||||
- eventhub-node3-data:/app/data
|
||||
ports:
|
||||
- "8084:8080"
|
||||
- "8085:8081"
|
||||
- "8449:8445"
|
||||
- "8450:8446"
|
||||
environment:
|
||||
- NODE_NAME=eventhub-node3@eventhub-node3
|
||||
- HTTP_PORT=8080
|
||||
- WS_PORT=8081
|
||||
- ADMIN_HTTP_PORT=8445
|
||||
- ADMIN_WS_PORT=8446
|
||||
- MNESIA_DIR=/app/data
|
||||
- RELEASE_COOKIE=${RELEASE_COOKIE}
|
||||
- JWT_SECRET=${JWT_SECRET}
|
||||
- JOIN_NODES=eventhub-node1@eventhub-node1
|
||||
volumes:
|
||||
- eventhub-node3-data:/app/data
|
||||
networks:
|
||||
- eventhub-net
|
||||
depends_on:
|
||||
- eventhub-node1
|
||||
restart: unless-stopped
|
||||
|
||||
observer_web:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/ObserverWeb.Dockerfile
|
||||
container_name: observer_web
|
||||
ports:
|
||||
- "4000:4000"
|
||||
environment:
|
||||
- RELEASE_COOKIE=${RELEASE_COOKIE}
|
||||
networks:
|
||||
- eventhub-net
|
||||
- "11445:8445"
|
||||
- "11446:8446"
|
||||
restart: unless-stopped
|
||||
|
||||
# ================== Мониторинг ==================
|
||||
prometheus:
|
||||
image: prom/prometheus:latest
|
||||
container_name: prometheus
|
||||
volumes:
|
||||
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
- prometheus-data:/prometheus
|
||||
command:
|
||||
- '--config.file=/etc/prometheus/prometheus.yml'
|
||||
- '--storage.tsdb.path=/prometheus'
|
||||
ports:
|
||||
- "9090:9090"
|
||||
networks:
|
||||
- eventhub-net
|
||||
ports:
|
||||
- "9090:9090"
|
||||
restart: unless-stopped
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:latest
|
||||
container_name: grafana
|
||||
depends_on:
|
||||
- prometheus
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_USER=admin
|
||||
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD}
|
||||
volumes:
|
||||
- grafana-data:/var/lib/grafana
|
||||
- ./grafana/provisioning:/etc/grafana/provisioning
|
||||
- grafana-data:/var/lib/grafana
|
||||
networks:
|
||||
- eventhub-net
|
||||
ports:
|
||||
- "3000:3000"
|
||||
restart: unless-stopped
|
||||
|
||||
# ================== Инструмент отладки ==================
|
||||
observer_web:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/ObserverWeb.Dockerfile
|
||||
environment:
|
||||
- RELEASE_COOKIE=${RELEASE_COOKIE}
|
||||
networks:
|
||||
- eventhub-net
|
||||
ports:
|
||||
- "4000:4000"
|
||||
restart: unless-stopped
|
||||
|
||||
# ================== Сети и тома ==================
|
||||
networks:
|
||||
eventhub-net:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
eventhub-node1-data:
|
||||
eventhub-node2-data:
|
||||
eventhub-node3-data:
|
||||
prometheus-data:
|
||||
grafana-data:
|
||||
|
||||
networks:
|
||||
eventhub-net:
|
||||
driver: bridge
|
||||
grafana-data:
|
||||
Reference in New Issue
Block a user