This commit is contained in:
Piotr Biernat 2023-05-20 21:41:33 +02:00
parent 08e6275c50
commit f871d5e052
3 changed files with 92 additions and 17 deletions

View File

@ -22,7 +22,8 @@ services:
hostname: eventbus.egommerce.pbiernat.dev
environment:
- APP_DOMAIN=eventbus.egommerce.pbiernat.dev
- RABBITMQ_NODENAME=api-eventbus
# - RABBITMQ_NODENAME=api-eventbus
# - RABBITMQ_USE_LONGNAME=true
# - RABBITMQ_DEFAULT_USER = admin
# - RABBITMQ_DEFAULT_PASS = passw123

View File

@ -10,12 +10,12 @@ services:
- APP_NAME=api-gateway
- APP_DOMAIN
- API_REGISTRY_REFRESH_INTERVAL=5s
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- api-gateway-network
- api-registry-network
- api-logger-network
volumes:
- /var/run/docker.sock:/var/run/docker.sock
api-registry:
image: git.pbiernat.dev/egommerce/api-registry:latest
@ -33,12 +33,14 @@ services:
image: git.pbiernat.dev/egommerce/api-eventbus:latest
environment:
# - RABBITMQ_NODENAME=api-eventbus
- RABBITMQ_ERLANG_COOKIE=rabbitmq
- APP_NAME=api-eventbus
- APP_DOMAIN
volumes:
- eventbus_data:/var/lib/rabbitmq
- eventbus_logs:/var/log/rabbitmq
networks:
- api-gateway-network
- api-eventbus-network
- api-registry-network
- api-logger-network
@ -61,21 +63,30 @@ services:
api-prometheus:
image: prom/prometheus:latest # FIXME: create private image(prod/dev)...
user: root
environment:
- APP_NAME=api-prometheus
- APP_DOMAIN
volumes:
- ./etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- /var/run/docker.sock:/var/run/docker.sock
networks:
- api-prometheus-network
- api-grafana-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-cache-network
- api-logger-network
# - api-cache-network
# - api-logger-network
- basket-svc-network
- basket-worker-network
- catalog-svc-network
- catalog-worker-network
- identity-svc-network
- order-svc-network
- order-worker-network
- pricing-svc-network
- pricing-worker-network
api-grafana:
image: grafana/grafana-oss:latest # FIXME: create private image(prod/dev)...
@ -231,6 +242,7 @@ services:
networks:
- basket-worker-network
- pricing-svc-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-logger-network
@ -246,6 +258,7 @@ services:
- EVENTBUS_URL
networks:
- catalog-worker-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-logger-network
@ -261,6 +274,7 @@ services:
- EVENTBUS_URL
networks:
- pricing-worker-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-logger-network
@ -277,6 +291,7 @@ services:
networks:
- order-worker-network
- basket-svc-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-logger-network

View File

@ -1,8 +1,8 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_interval: 10s
evaluation_interval: 10s
rule_files:
# rule_files:
# - "first.rules"
# - "second.rules"
@ -11,13 +11,72 @@ scrape_configs:
static_configs:
- targets: ['localhost:9090']
- job_name: 'api-gateway'
static_configs:
- targets: ['api-gateway:8084']
- job_name: 'api-eventbus'
static_configs:
- targets: ['api-eventbus:8084']
- job_name: docker
dockerswarm_sd_configs:
- host: unix:///var/run/docker.sock
role: tasks
relabel_configs:
- source_labels: [__meta_dockerswarm_service_name, __address__]
regex: egommerce_(api-eventbus|api-gateway);(.*):(.*)
action: replace
replacement: '$2:8084'
target_label: __address__
# - source_labels: [__meta_dockerswarm_service_name, __address__]
# regex: egommerce_api-gateway;(.*):(.*)
# action: replace
# replacement: '$1:8084'
# target_label: __address__
# Only keep containers that should be running.
- source_labels: [__meta_dockerswarm_service_label_com_docker_stack_namespace]
regex: egommerce
action: keep
- source_labels: [__meta_dockerswarm_task_desired_state]
regex: running
action: keep
# - source_labels: [__meta_dockerswarm_network_name]
# regex: ingress
# action: keep
- source_labels: [__meta_dockerswarm_service_name]
action: replace
replacement: '$1'
target_label: instance
# - source_labels: [__meta_dockerswarm_task_desired_state]
# regex: running
# action: keep
- job_name: 'catalog-svc'
static_configs:
- targets: ['catalog-svc:8084']
# - job_name: consul
# consul_sd_configs:
# - server: api-registry:8500
# services:
# - consul
# - basket-server
# - catalog-server
# - identity-svc
# - order-svc
# - pricing-svc
# - consul
# - job_name: rabbitmq
# consul_sd_configs:
# - server: api-registry:8500
# services:
# - api-eventbus
# relabel_configs:
# - source_labels: ['__meta_consul_service_address']
# replacement: '$1:8084'
# target_label: __address__
# - source_labels: ['__meta_consul_service_port']
# replacement: '8084'
# target_label: __meta_consul_service_port
# - job_name: 'api-gateway'
# static_configs:
# - targets: ['api-gateway:8084']
# - job_name: 'api-eventbus'
# static_configs:
# - targets: ['api-eventbus:8084']
# - job_name: 'catalog-svc'
# static_configs:
# - targets: ['catalog-svc:8084']