version: '3'

networks:
  private:
  web:
   external:
    name: web
  #pipeline-test-mean-stack-docker_default:
  #pipeline-test-mean-stack-docker_private:
  grafana:

volumes:
  app_data: {}
  database:

services:
  express_preprod:
#   container_name: express_"${ENV}"
    build: express-server
    ports:
      - "4000:4000"
    environment:
      - db=mongodb://database_preprod/fatboar  
    networks:
      - web
      - private
      #- pipeline-test-FatboarProject_default
      #- pipeline-test-FatboarProject_private
      - grafana
    volumes:
      - /var/log:/var/www/app/log/root
    labels:
      - traefik.enable=true
      - traefik.http.routers.express_preprod.rule=Host(`api-preprod.foodgame.fr`)
#     - traefik.http.routers.apache_prod.rule=Host(`${URLEXPRESS}`)
      - traefik.http.services.express_preprod.loadbalancer.server.port=4000
      - traefik.http.routers.express_preprod.entrypoints=websecure
      - traefik.http.routers.express_preprod.tls.certresolver=myresolver
    links:
      - database_preprod
    depends_on: 
      - database_preprod
    restart: always

  database_preprod:
#   container_name: mongo_"${ENV}"
    image: mongo
    ports:
      - "27017:27017"
    volumes:
      - ./backup:/backup
      - /var/lib/mongodb/data_preprod:/data/db
#     - database:/data/database
    labels:
      - traefik.enable=true
      - traefik.http.routers.database_preprod.rule=Host(`mongodb-preprod.foodgame.fr`)
#     - traefik.http.routers.apache_prod.rule=Host(`${URLMONGO}`)
      - traefik.http.services.database_preprod.loadbalancer.server.port=27017
      - traefik.http.routers.database_preprod.entrypoints=websecure
      - traefik.http.routers.database_preprod.tls.certresolver=myresolver  
    networks:
      - web
      - private
      #- pipeline-test-FatboarProject_default
      #- pipeline-test-FatboarProject_private
    restart: always

  apache_preprod:
#   container_name: apache_"${ENV}"    
    build:  
      context: ./
     #dockerfile: build/docker/httpd/Dockerfile
      dockerfile: build/docker/apache/Dockerfile
    ports:
      - "8080:80"
    networks:
      - web
      - private
      #- pipeline-test-FatboarProject_default
      #- pipeline-test-FatboarProject_private
    volumes:     
      - /var/log:/var/log/apache2
    labels:
      - traefik.enable=true
      - traefik.http.routers.apache_prod.rule=Host(`angular-preprod.foodgame.fr`)
#     - traefik.http.routers.apache_prod.rule=Host(`${URLANGULAR}`)
      - traefik.http.services.apache_prod.loadbalancer.server.port=80
      - traefik.http.routers.apache_prod.entrypoints=websecure
      - traefik.http.routers.apache_prod.tls.certresolver=myresolver  
    restart: always  


 