version: "3.9"

services:
  api-gateway:
    image: git.pbiernat.dev/egommerce/api-gateway:dev
    environment:
      - APP_DOMAIN=api-gateway
    volumes:
      - ./certs/api-gateway:/etc/traefik/certs

  api-registry:
    image: git.pbiernat.dev/egommerce/api-registry:dev
    environment:
      - APP_DOMAIN=api-registry
      - CONSUL_HTTP_TOKEN=devop

  api-eventbus:
    image: git.pbiernat.dev/egommerce/api-eventbus:dev
    environment:
      - APP_DOMAIN=api-eventbus
      # - RABBITMQ_NODENAME=api-eventbus
      # - RABBITMQ_USE_LONGNAME=true
      # - RABBITMQ_DEFAULT_USER = admin
      # - RABBITMQ_DEFAULT_PASS = passw123

  api-cache:
    image: git.pbiernat.dev/egommerce/api-cache:dev
    environment:
      - PASSWORD=12345678

  api-logger:
    image: git.pbiernat.dev/egommerce/api-logger:dev
    environment:
      - APP_DOMAIN=api-logger

  #api-prometheus:
    # image: prom/prometheus:latest # FIXME: create private image(prod/dev)...
  #  environment:
  #    - APP_DOMAIN=prometheus.keshop.bieda.it

  #api-grafana:
    # image: grafana/grafana-oss:latest # FIXME: create private image(prod/dev)...
  #  environment:
  #    - APP_DOMAIN=grafana.keshop.bieda.it

  postgres-db:
    environment:
      - APP_DOMAIN=postgres-db
      - POSTGRES_PASSWORD=12345678
    # ports:
    #   - '5432:5432'

  mongo-db:
    environment:
      - APP_DOMAIN=mongo-db
      - MONGO_INITDB_ROOT_PASSWORD=12345678

  # API micro-services
  identity-svc:
    image: git.pbiernat.dev/egommerce/identity-svc:dev
    environment:
      - APP_DOMAIN=identity-svc
      - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
      - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
      - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
    volumes:
      - ./certs/api-gateway:/certs

  basket-svc:
    image: git.pbiernat.dev/egommerce/basket-svc:dev
    environment:
      - APP_DOMAIN=basket-svc
      - AUTH_HANDLER_URL=http://identity-svc/api/v1/traefik
      - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
      - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
      - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
    volumes:
      - ./certs/api-gateway:/certs

  catalog-svc:
    image: git.pbiernat.dev/egommerce/catalog-svc:dev
    environment:
      - APP_DOMAIN=catalog-svc
      - AUTH_HANDLER_URL=http://identity-svc/api/v1/traefik
      - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
      - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
      - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
    volumes:
      - ./certs/api-gateway:/certs

  pricing-svc:
    image: git.pbiernat.dev/egommerce/pricing-svc:dev
    environment:
      - APP_DOMAIN=pricing-svc
      - AUTH_HANDLER_URL=http://identity-svc/api/v1/traefik
      - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
      - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
      - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
    volumes:
      - ./certs/api-gateway:/certs

  order-svc:
    image: git.pbiernat.dev/egommerce/order-svc:dev
    environment:
      - APP_DOMAIN=order-svc
      - AUTH_HANDLER_URL=http://identity-svc/api/v1/traefik
      - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
      - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
      - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
    volumes:
      - ./certs/api-gateway:/certs

  # Workers (Eventbus)
  basket-worker:
    image: git.pbiernat.dev/egommerce/basket-worker:dev
    environment:
      - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
      - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
      - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672

  catalog-worker:
    image: git.pbiernat.dev/egommerce/catalog-worker:dev
    environment:
      - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
      - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
      - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672

  pricing-worker:
    image: git.pbiernat.dev/egommerce/pricing-worker:dev
    environment:
      - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
      - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
      - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672

  order-worker:
    image: git.pbiernat.dev/egommerce/order-worker:dev
    environment:
      - DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
      - MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
      - EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672