services:

  wag_management_init_service:
    container_name: wag_management_init_service
    build:
      context: .
      dockerfile: app_init_service.Dockerfile
    networks:
      - network_store_services
    depends_on:
      - postgres_commercial
      - commercial_memory_service
      - commercial_mongo_service
    environment:
      - DATABASE_URL=postgresql+psycopg2://berkay_wag_user:berkay_wag_user_password@postgres_commercial:5432/wag_database
      - REDIS_HOST=commercial_memory_service
      - REDIS_PASSWORD=commercial_redis_password
      - REDIS_PORT=6379
      - REDIS_DB=0

  wag_management_test_service:
    container_name: wag_management_test_service
    build:
      context: .
      dockerfile: app_test_service.Dockerfile
    networks:
      - network_store_services
    depends_on:
      - wag_management_service
    environment:
      - DATABASE_URL=postgresql+psycopg2://berkay_wag_user:berkay_wag_user_password@postgres_commercial:5432/wag_database
      - REDIS_HOST=commercial_memory_service
      - REDIS_PASSWORD=commercial_redis_password
      - REDIS_PORT=6379
      - REDIS_DB=0

  wag_management_service:
    container_name: wag_management_service
    restart: on-failure
    build:
      context: app_service.Dockerfile
    ports:
      - "41575:41575"
    networks:
      - network_store_services
    depends_on:
      - wag_management_init_service
    environment:
      - DATABASE_URL=postgresql+psycopg2://berkay_wag_user:berkay_wag_user_password@postgres_commercial:5432/wag_database
      - REDIS_HOST=commercial_memory_service
      - REDIS_PASSWORD=commercial_redis_password
      - REDIS_PORT=6379
      - REDIS_DB=0

  commercial_mongo_service:
    container_name: commercial_mongo_service
#    image: "bitnami/mongodb:latest"
    image: "bitnami/mongodb:4.4.1-debian-10-r3"
    networks:
      - network_store_services
    environment:
      - MONGODB_DISABLE_ENFORCE_AUTH=true
      - MONGODB_ROOT_PASSWORD=root
      - MONGODB_DATABASE=mongo_database
      - MONGODB_USERNAME=mongo_user
      - MONGODB_PASSWORD=mongo_password
      - MONGO_INITDB_ROOT_USERNAME=mongo_user
      - MONGO_INITDB_ROOT_PASSWORD=mongo_password
      - MONGO_INITDB_DATABASE=mongo_database
    volumes:
      - wag_commercial_mongodb_data:/bitnami/mongodb
    ports:
      - "11110:27017"

  commercial_memory_service:
    container_name: commercial_memory_service
    image: 'bitnami/redis:latest'
    restart: on-failure
    environment:
      - REDIS_HOST=commercial_redis_service
      - REDIS_PASSWORD=commercial_redis_password
      - REDIS_PORT=6379
      - REDIS_DB=0
    networks:
      - network_store_services
    ports:
      - "11112:6379"

  postgres_commercial:
    image: 'bitnami/postgresql:latest'
    container_name: postgres_commercial
    restart: on-failure
    networks:
      - network_store_services
    environment:
      - POSTGRES_DB=wag_database
      - POSTGRES_USER=berkay_wag_user
      - POSTGRES_PASSWORD=berkay_wag_user_password
    ports:
      - "5434:5432"
    volumes:
      - wag_postgres_commercial_data:/bitnami/postgresql

# Todo separate api with mail receiver services add mail_service to 2.43 LXC | Create an internal Api or Socket
  mail_service:
    container_name: mail_service
    restart: on-failure
    build:
      context: .
      dockerfile: app_mail_service.Dockerfile
    ports:
      - "22222:22222"
    networks:
      - network_store_services
    depends_on:
      - wag_management_service
    environment:
      - DATABASE_URL=postgresql+psycopg2://berkay_wag_user:berkay_wag_user_password@postgres_commercial:5432/wag_database
    volumes:
      - wag_cronjob-volume:/etc/cron.d/send_email_cron


networks:
  network_store_services:
#    external: true
#    driver: bridge

volumes:
  wag_cronjob-volume:
  wag_commercial_mongodb_data:
  wag_postgres_commercial_data:
