services:

  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
    depends_on:
      - commercial_mongo_service
    ports:
      - "5434:5432"
    volumes:
      - wag_postgres_commercial_data:/bitnami/postgresql

  wag_management_service:
    container_name: wag_management_service
    restart: on-failure
    build:
      context: .
      dockerfile: service_app/Dockerfile
    ports:
      - "41575:41575"
    networks:
      - network_store_services
    depends_on:
      - wag_management_init_service
      - grafana

  wag_management_service_second:
    container_name: wag_management_service_second
    restart: on-failure
    build:
      context: .
      dockerfile: service_app/Dockerfile
    ports:
      - "41576:41575"
    networks:
      - network_store_services
    depends_on:
      - wag_management_init_service
      - grafana

  wag_management_init_service:
    container_name: wag_management_init_service
    build:
      context: .
      dockerfile: service_app_init/Dockerfile
    networks:
      - network_store_services
    depends_on:
      - postgres_commercial

  wag_bank_services:
    container_name: wag_bank_services
    restart: on-failure
    build:
      context: .
      dockerfile: service_app_banks/mailService.Dockerfile
    networks:
      - network_store_services
    depends_on:
      - postgres_commercial
    environment:
      - DATABASE_URL=postgresql+psycopg2://berkay_wag_user:berkay_wag_user_password@postgres_commercial:5432/wag_database

  wag_account_services:
    container_name: wag_account_services
    restart: on-failure
    build:
      context: .
      dockerfile: service_account_records/account.Dockerfile
    networks:
      - network_store_services
    depends_on:
      - postgres_commercial
    environment:
      - DATABASE_URL=postgresql+psycopg2://berkay_wag_user:berkay_wag_user_password@postgres_commercial:5432/wag_database
      - PYTHONPATH=/

  prometheus:
    image: prom/prometheus
    container_name: prometheus
    ports:
      - "9090:9090"
    volumes:
      - ./prometheus_data/prometheus.yml:/etc/prometheus/prometheus.yml
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
    networks:
      - network_store_services

  grafana:
    image: grafana/grafana
    container_name: grafana
    ports:
      - "3000:3000"
    depends_on:
      - prometheus
    networks:
      - network_store_services
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=admin
      - GF_USERS_ALLOW_SIGN_UP=false
      - GF_USERS_ALLOW_ORG_CREATE=false
    volumes:
      - grafana_data:/var/lib/grafana

#  wag_management_test_service:
#    container_name: wag_management_test_service
#    build:
#      context: .
#      dockerfile: service_app_test/Dockerfile
#    networks:
#      - network_store_services
#    depends_on:
#      - wag_management_init_service
#
#  nginx-proxy-wag:
#    container_name: nginx-proxy-wag
#    image: 'jc21/nginx-proxy-manager:latest'
#    restart: unless-stopped
#    networks:
#      - network_store_services
#    depends_on:
#      - wag_management_service
#    ports:
#      - '80:80' # Public HTTP Port
#      - '443:443' # Public HTTPS Port
#      - '81:81' # Admin Web Port
#    volumes:
#      - ./data:/data
#      - ./letsencrypt:/etc/letsencrypt

networks:
  network_store_services:

volumes:
  wag_postgres_commercial_data:
  grafana_data:
  wag_commercial_mongodb_data:

#    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