version: '3'
networks:
  cachenet:
services:
  grima:
    image:            "zemkat/grima-cloud"
    environment:
      SESSION_MODULE: "redis"
      SESSION_NAME:   "grima"
      SESSION_PATH:   "tcp://redis"
      DATABASE_URL:   "pgsql:host=grima-users;dbname=grima;user=grima;password=7ad0e257c0d00be2e4fbdc90ae97f7138fba124b42fb153628d58bbccfba3d87"
    networks:
      - cachenet

    # Only needed for the load balancer
    labels:
      - "traefik.enable=true"
      - "traefik.http.services.web.loadbalancer.server.port=19290"
      - "traefik.http.services.web.loadbalancer.healthcheck.path=/grimas/HealthCheck/HealthCheck.php"
      - "traefik.http.services.web.loadbalancer.healthcheck.port=19290"
  redis:
    image: "redis:5.0"
    hostname: "redis"
    networks:
      - cachenet
  postgres:
    image: "postgres:12"
    hostname: "postgres"
    environment:
      POSTGRES_USER: grima
      POSTGRES_PASSWORD: 7ad0e257c0d00be2e4fbdc90ae97f7138fba124b42fb153628d58bbccfba3d87
      POSTGRES_DB: grima
    networks:
      - cachenet

  # load-balancer
  reverse-proxy:
    image: traefik:v2.0
    command:
      #- "--accesslog=true" 
      #- "--api.insecure=true"
      - "--providers.docker"
      - "--providers.docker.exposedbydefault=false"
      - "--providers.docker.defaultrule=HostRegexp(`{s:.*}`)"
      - "--entrypoints.web.address=:19290"
    ports:
      - "19290:19290"
      #- "8080:8080"
    volumes:
      # XXX: insecure, but required
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      cachenet:
