Added base prometheus config + fast clean-up

This commit is contained in:
Piotr Biernat 2023-03-20 15:08:33 +01:00
parent 6042f81c35
commit bd38c66fda
3 changed files with 77 additions and 83 deletions

View File

@ -7,22 +7,6 @@ services:
hostname: egommerce.pbiernat.dev
environment:
- APP_DOMAIN=egommerce.pbiernat.dev
# labels:
# - "traefik.enable=true"
# - "traefik.http.routers.api-gateway-dashboard.rule=PathPrefix(`/`)"
# - "traefik.http.routers.api-gateway-dashboard.service=dashboard@internal"
# - "traefik.http.routers.api-gateway-dashboard.middlewares=dashboard_redirect@internal,dashboard_stripprefix@internal"
# - "traefik.http.routers.api-gateway-api.rule=PathPrefix(`/api`)"
# - "traefik.http.routers.api-gateway-api.service=api@internal"
# - "traefik.http.routers.api-gateway-api.middlewares=PathPrefix(`/`)"
# - "traefik.http.routers.api-gateway.rule=Headers(`X-API-SERVICE`, `admin-gateway`)"
# - "traefik.http.routers.api-gateway.tls=true"
# - "traefik.http.routers.api-gateway.entryPoints=https"
# - "traefik.http.services.api-gateway.loadbalancer.server.scheme=http"
# - "traefik.http.services.api-gateway.loadbalancer.server.port=8080"
# - "traefik.http.middlewares.gateway-stripprefix.stripprefix.prefixes=/admin/gateway"
# - "traefik.tls.certificates.certfile=/etc/traefik/certs/client.cert"
# - "traefik.tls.certificates.keyfile=/etc/traefik/certs/client.key"
volumes:
- ./certs/api-gateway:/etc/traefik/certs
@ -32,22 +16,6 @@ services:
environment:
- APP_DOMAIN=registry.egommerce.pbiernat.dev
- CONSUL_HTTP_TOKEN=devop
# labels:
# - "traefik.enable=true"
# - "traefik.http.routers.api-registry.rule=PathPrefix(`/admin/registry`)"
# - "traefik.http.routers.api-registry.rule=Headers(`X-API-SERVICE`, `admin-registry`)"
# - "traefik.http.routers.api-registry.tls=true"
# - "traefik.http.routers.api-registry.tls.domains[0].main=egommerce.pbiernat.dev"
# - "traefik.http.routers.api-registry.entryPoints=https"
# - "traefik.http.routers.api-registry.service=api-registry"
# - "traefik.http.routers.api-registry.middlewares=registry-stripprefix"
# - "traefik.http.services.api-registry.loadbalancer.server.scheme=http"
# - "traefik.http.services.api-registry.loadbalancer.server.port=8500"
# - "traefik.http.middlewares.registry-stripprefix.stripprefix.prefixes=/admin/registry"
# - "traefik.tls.certificates.certfile=/certs/client.cert"
# - "traefik.tls.certificates.keyfile=/certs/client.key"
# volumes:
# - ./certs/api-gateway:/certs
api-eventbus:
image: git.pbiernat.dev/egommerce/api-eventbus:dev
@ -57,21 +25,6 @@ services:
- RABBITMQ_NODENAME=api-eventbus
# - RABBITMQ_DEFAULT_USER = admin
# - RABBITMQ_DEFAULT_PASS = passw123
# labels:
# - "traefik.enable=true"
# - "traefik.http.routers.api-eventbus.rule=PathPrefix(`/admin/eventbus`)"
# - "traefik.http.routers.api-eventbus.tls=true"
# - "traefik.http.routers.api-eventbus.tls.domains[0].main=egommerce.pbiernat.dev"
# - "traefik.http.routers.api-eventbus.entryPoints=https"
# - "traefik.http.routers.api-eventbus.service=api-eventbus"
# - "traefik.http.routers.api-eventbus.middlewares=eventbus-stripprefix"
# - "traefik.http.services.api-eventbus.loadbalancer.server.scheme=http"
# - "traefik.http.services.api-eventbus.loadbalancer.server.port=15672"
# - "traefik.http.middlewares.eventbus-stripprefix.stripprefix.prefixes=/admin/eventbus"
# # - "traefik.tls.certificates.certfile=/certs/client.cert"
# # - "traefik.tls.certificates.keyfile=/certs/client.key"
# volumes:
# - ./certs/api-gateway:/certs
api-cache:
image: git.pbiernat.dev/egommerce/api-cache:dev
@ -83,8 +36,18 @@ services:
hostname: logger.egommerce.pbiernat.dev
environment:
- APP_DOMAIN=logger.egommerce.pbiernat.dev
# ports:
# - 24224:24224
api-prometheus:
# image: prom/prometheus:latest # FIXME: create private image(prod/dev)...
hostname: prometheus.egommerce.pbiernat.dev
environment:
- APP_DOMAIN=prometheus.egommerce.pbiernat.dev
api-grafana:
# image: grafana/grafana-oss:latest # FIXME: create private image(prod/dev)...
hostname: grafana.egommerce.pbiernat.dev
environment:
- APP_DOMAIN=grafana.egommerce.pbiernat.dev
postgres-db:
hostname: db.egommerce.pbiernat.dev
@ -93,18 +56,12 @@ services:
- POSTGRES_PASSWORD=12345678
# ports:
# - '5432:5432'
# volumes:
# - ./certs/postgres-db:/certs
mongo-db:
hostname: mongodb.egommerce.pbiernat.dev
environment:
- APP_DOMAIN=mongodb.egommerce.pbiernat.dev
- MONGO_INITDB_ROOT_PASSWORD=12345678
# ports:
# - '27017:27017'
# volumes:
# - ./certs/mongo-db:/certs
# API micro-services
identity-svc:
@ -160,8 +117,6 @@ services:
# Workers (EventBus)
basket-worker:
image: git.pbiernat.dev/egommerce/basket-worker:dev
# deploy:
# replicas: 2
environment:
- DATABASE_URL=postgres://postgres:12345678@db.egommerce.pbiernat.dev:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongodb.egommerce.pbiernat.dev:27017
@ -169,8 +124,6 @@ services:
catalog-worker:
image: git.pbiernat.dev/egommerce/catalog-worker:dev
# deploy:
# replicas: 2
environment:
- DATABASE_URL=postgres://postgres:12345678@db.egommerce.pbiernat.dev:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongodb.egommerce.pbiernat.dev:27017
@ -178,8 +131,6 @@ services:
pricing-worker:
image: git.pbiernat.dev/egommerce/pricing-worker:dev
# deploy:
# replicas: 2
environment:
- DATABASE_URL=postgres://postgres:12345678@db.egommerce.pbiernat.dev:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongodb.egommerce.pbiernat.dev:27017
@ -187,8 +138,6 @@ services:
order-worker:
image: git.pbiernat.dev/egommerce/order-worker:dev
# deploy:
# replicas: 2
environment:
- DATABASE_URL=postgres://postgres:12345678@db.egommerce.pbiernat.dev:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongodb.egommerce.pbiernat.dev:27017

View File

@ -4,14 +4,16 @@ services:
api-gateway:
image: git.pbiernat.dev/egommerce/api-gateway:latest
# command:
# - '--providers.consulcatalog.refreshinterval=5s' # FIXME only on config option: static/env/cli must be selected
# - '--providers.consulcatalog.refreshinterval=5s'
# FIXME ^^ only on config option: static/env/cli must be selected
environment:
- APP_NAME=api-gateway
- APP_DOMAIN
- API_REGISTRY_REFRESH_INTERVAL=5s
networks:
- api-gateway-network
# - api-logger-network # TODO
- api-registry-network
- api-logger-network
volumes:
- /var/run/docker.sock:/var/run/docker.sock
@ -25,8 +27,7 @@ services:
- registry_data:/consul/data
networks:
- api-registry-network
# - api-logger-network # TODO
- api-gateway-network
- api-logger-network
api-eventbus:
image: git.pbiernat.dev/egommerce/api-eventbus:latest
@ -37,12 +38,6 @@ services:
volumes:
- eventbus_data:/var/lib/rabbitmq
- eventbus_logs:/var/log/rabbitmq
# labels:
# - "traefik.enable=true"
# - "traefik.tcp.routers.eventbus-svc.rule=HostSNI(`*`)"
# - "traefik.tcp.routers.eventbus-svc.service=eventbus-svc"
# - "traefik.tcp.routers.eventbus-svc.entryPoints=eventbus"
# - "traefik.tcp.services.eventbus-svc.loadbalancer.server.port=5672"
networks:
- api-eventbus-network
- api-registry-network
@ -63,6 +58,34 @@ services:
- APP_DOMAIN
networks:
- api-logger-network
api-prometheus:
image: prom/prometheus:latest # FIXME: create private image(prod/dev)...
environment:
- APP_NAME=api-prometheus
- APP_DOMAIN
volumes:
- ./etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
networks:
- api-prometheus-network
- api-grafana-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-cache-network
- api-logger-network
- catalog-svc-network
- catalog-worker-network
api-grafana:
image: grafana/grafana-oss:latest # FIXME: create private image(prod/dev)...
environment:
- APP_NAME=api-grafana
- APP_DOMAIN
volumes:
- grafana-db:/var/lib/grafana
networks:
- api-grafana-network
postgres-db:
image: postgres:14.1-alpine
@ -71,11 +94,6 @@ services:
- APP_DOMAIN
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD
# labels:
# - "traefik.enable=true"
# - "traefik.tcp.routers.postgres-svc.service=postgres-svc"
# - "traefik.tcp.routers.postgres-svc.entryPoints=db"
# - "traefik.tcp.services.postgres-svc.loadbalancer.server.port=5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
@ -89,11 +107,6 @@ services:
- APP_DOMAIN
- MONGO_INITDB_ROOT_USERNAME=mongodb
- MONGO_INITDB_ROOT_PASSWORD
# labels:
# - "traefik.enable=true"
# - "traefik.tcp.routers.mongodb-svc.service=mongodb-svc"
# - "traefik.tcp.routers.mongodb-svc.entryPoints=mongodb"
# - "traefik.tcp.services.mongodb-svc.loadbalancer.server.port=27017"
volumes:
- mongodb_data:/data/db
networks:
@ -276,6 +289,7 @@ volumes:
registry_data: ~
eventbus_data: ~
eventbus_logs: ~
grafana-db: ~
networks:
api-gateway-network:
@ -297,6 +311,14 @@ networks:
api-logger-network:
driver: overlay
internal: true
api-prometheus-network:
driver: overlay
internal: true
api-grafana-network:
driver: overlay
internal: true
postgres-db-network:
driver: overlay

View File

@ -0,0 +1,23 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
rule_files:
# - "first.rules"
# - "second.rules"
scrape_configs:
- job_name: prometheus
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: 'catalog-svc'
static_configs:
- targets: ['catalog-svc:8084']