version: '3'
services:
  web:
    image: registry.chaotikum.net/icebox/icebox-web
    restart: always
    depends_on:
    - backend
    expose:
      - 8080
      - 8081
    labels:
      - "traefik.enable=true"
      - 'traefik.http.routers.web.entrypoints=web'
      - "traefik.http.routers.web.rule=Host(`icebox.nobreakspace.org`)"
    environment:
      ICEBOX_API_HOST: backend
      ICEBOX_API_PORT: 8081
      ICEBOX_WEB_PORT: 8080
      IMAGE_SERVICE: "images.icebox.nobreakspace.org"


  web-vue:
    image: registry.chaotikum.net/icebox/icebox-vuetified
    restart: always
    depends_on:
      - backend
    expose:
      - 80
    labels:
      - "traefik.enable=true"
      - 'traefik.http.routers.vue.entrypoints=web'
      - 'traefik.http.routers.vue.rule=Host(`vue.icebox.nobreakspace.org`)'


  image-service:
    image: registry.chaotikum.net/icebox/icebox-image-service
    restart: always
    depends_on:
    - backend
    expose:
      - 80
    labels:
      - "traefik.enable=true"
      - 'traefik.http.routers.images.entrypoints=web'
      - 'traefik.http.routers.images.rule=Host(`vue.icebox.nobreakspace.org`)'

  alias:
    image: registry.chaotikum.net/icebox/iceboxalias
    restart: always
    environment:
    - ICEBOX_DB_URL=postgresql://icebox:clubmate42@database/icebox
    depends_on:
    - database


  backend:
    image: registry.chaotikum.net/icebox/icebox-service
    restart: always
    depends_on:
      - database
    expose:
      - 8081
    labels:
      - "traefik.enable=true"
      - 'traefik.http.routers.api.entrypoints=web'
      - 'traefik.http.routers.api.rule=Host(`api.icebox.nobreakspace.org`)'
    environment:
      ICEBOX_DB_HOST: database
      ICEBOX_DB_PORT: 5432
      ICEBOX_DB_USER: icebox
      ICEBOX_DB_PSW: clubmate42
      ICEBOX_DB_NAME: icebox

  # pgadmin:
  #   build: pgadmin4
  #   restart: always
  #   environment:
  #     PGADMIN_DEFAULT_PASSWORD: clubmate42
  #     PGADMIN_DEFAULT_EMAIL: icebox@nobreakspace.org

  database:
    image: postgres:12
    restart: always
    environment:
     POSTGRES_PASSWORD: clubmate42
     POSTGRES_USER: icebox
     POSTGRES_DB: icebox
    volumes:
    - icebox-data:/var/lib/postgresql/data
  icebox-exporter:
    image: registry.chaotikum.net/icebox/prometheus-icebox-exporter
    restart: always
    expose:
      - 8000
    environment:
      ICEBOX_URL: http://backend:8081
    labels:
      - "traefik.enable=true"
      - 'traefik.http.routers.api.entrypoints=web'
      - 'traefik.http.routers.api.rule=Host(`api.icebox.nobreakspace.org`) && PathPrefix(`/metrics`)'


  traefik:
    image: traefik:v2.5
    command:
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    depends_on:
    - web
    - web-vue
    - alias
    - backend
    networks:
      default:
      public:
        ipv4_address: 172.23.208.37
        ipv6_address: 2a01:170:1112::0.0.0.37



volumes:
  icebox-data:
    external: true

networks:
  public:
    external:
      name: space_net
