version: "3.9"

services:
  api-registry:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/api-registry:prod
    environment:
      - APP_DOMAIN=registry.service.ego.io

  api-gateway:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/api-registry:prod
    environment:
      - APP_DOMAIN=gw.service.ego.io

  api-vault:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/api-vault:prod
    command: ["vault", "server", "-config=/vault/config/server.hcl"]
    environment:
      - APP_DOMAIN=vault.service.ego.io
      - VAULT_API_ADDR=https://localhost:8200
      - VAULT_ADDR=https://localhost:8200

  api-eventbus:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/api-eventbus:prod
    environment:
      - APP_DOMAIN=esb.service.ego.io

  api-cache:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/api-cache:prod
    environment:
      - APP_DOMAIN=cache.service.ego.io

  api-logger:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/api-logger:prod
    environment:
      - APP_DOMAIN=logger.service.ego.io
  
  # api-prometheus:
  #   image: prom/prometheus:prod # FIXME: create private image(prod/dev)...
  #   user: root
  #   environment:
  #     - APP_NAME=api-prometheus

  # api-grafana:
  #   image: grafana/grafana-oss:prod # FIXME: create private image(prod/dev)...
  #   environment:
  #     - APP_NAME=api-grafana

  db-postgres:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/db-postgres:prod
    environment:
      - APP_DOMAIN=postgresdb.service.ego.io
      - POSTGRESQL_USERNAME=egommerce
      - POSTGRESQL_DATABASE=egommerce

  # db-mongo:
  #   env_file: ../.env.prod
  #   environment:
  #     - APP_NAME=db-mongo
  #     - APP_DOMAIN=mongo-db.service.ego.io
  #     - MONGO_INITDB_ROOT_USERNAME=mongodb

  # API micro-services
  identity-svc:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/identity-svc:prod
    environment:
      - APP_DOMAIN=identity.service.ego.io
      - APP_PATH_PREFIX=/identity
      - DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
      - EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672

  catalog-svc:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/catalog-svc:prod
    environment:
      - APP_DOMAIN=catalog.service.ego.io
      - APP_PATH_PREFIX=/catalog
      - DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
      - EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672

  basket-svc:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/basket-svc:prod
    environment:
      - APP_DOMAIN=basket.service.ego.io
      - APP_PATH_PREFIX=/basket
      - DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
      - EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672

  pricing-svc:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/pricing-svc:prod
    environment:
      - APP_DOMAIN=pricing.service.ego.io
      - APP_PATH_PREFIX=/pricing
      - DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
      - EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672

  order-svc:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/order-svc:prod
    environment:
      - APP_DOMAIN=order.service.ego.io
      - APP_PATH_PREFIX=/order
      - DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
      - EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672

  # Workers (Eventbus)
  basket-worker:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/basket-worker:prod
    environment:
      - DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
      - EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672

  catalog-worker:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/catalog-worker:prod
    environment:
      - DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
      - EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672

  pricing-worker:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/pricing-worker:prod
    environment:
      - DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
      - EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672

  order-worker:
    env_file: ../.env.prod
    image: git.pbiernat.io/egommerce/order-worker:prod
    environment:
      - DATABASE_URL=postgres://postgres:12345678@postgresdb.service.ego.io:5432/egommerce
      - EVENTBUS_URL=amqp://guest:guest@esb.service.ego.io:5672
