version: '3.3'

services:
  core:
    image: registry.gitlab.com/samarasoft/samarasoft.loyalty.core/master
    environment:
      ASPNETCORE_URLS: "http://*:5020"
      DB_HOST: postgres
      DB_PORT: 5432
      DB_NAME: loyalty
      DB_USER: admin
      DB_PASSWORD: password
      RMQ_HOST: rabbitmq
      RMQ_USER: admin
      RMQ_PASSWORD: password
      RMQ_QUEUE: Loyalty
    restart: on-failure
    ports:
      - "5020:5020"
    labels:
      NAME: "core"
    depends_on:
      - rabbitmq
      - postgres
    networks:
      - mynetwork
      
  personal_area:
    image: registry.gitlab.com/samarasoft/samarasoft.loyalty.personalarea/master
    environment:
      ASPNETCORE_URLS: "http://*:5010"
      DB_HOST: postgres
      DB_PORT: 5432
      DB_NAME: loyalty
      DB_USER: admin
      DB_PASSWORD: password
      API_AUTH_TOKEN: "secret"
    restart: on-failure
    ports:
      - "5010:5010"
    labels:
      NAME: "personalarea"
    depends_on:
      - postgres
      - core
    networks:
      - mynetwork

  processing:
    image: registry.gitlab.com/samarasoft/samarasoft.loyalty/master
    environment:
      ASPNETCORE_URLS: "http://*:5000"
      DB_HOST: postgres
      DB_PORT: 5432
      DB_NAME: loyalty
      DB_USER: admin
      DB_PASSWORD: password
      API_AUTH_TOKEN: secret
    restart: on-failure
    ports:
      - "5000:5000"
    labels:
      NAME: "processing"
    depends_on:
      - postgres
      - core
    networks:
      - mynetwork

  rabbitmq:
    image: rabbitmq:3-management
    hostname: rabbitmq
    environment:
      RABBITMQ_DEFAULT_USER: "admin"
      RABBITMQ_DEFAULT_PASS: "password"
      RABBITMQ_DEFAULT_VHOST: "/"
    ports:
      - "15672:15672"
      - "5672:5672"
    labels:
      NAME: "rabbitmq"
    networks:
      - mynetwork

  postgres:
    image: postgres:11
    environment:
      POSTGRES_USER: admin
      POSTGRES_PASSWORD: password
      POSTGRES_DB: loyalty
    volumes:
       - pgdata:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    labels:
      NAME: "postgres"
    networks:
      - mynetwork
volumes:
  pgdata:

networks:
  mynetwork: