networks:
  traefik:
    external: true
  taiga:
    driver: bridge

services:
  taiga-front:
    image: taigaio/taiga-front:latest
    container_name: taiga-front
    restart: always
    environment:
      - TAIGA_API_URL=https://${DOMAIN}/api/v1
      - TAIGA_EVENTS_URL=wss://${DOMAIN}/events
    networks:
      - taiga
      - traefik
    depends_on:
      - taiga-back
    labels:
      - traefik.http.routers.taiga.rule=Host(`${DOMAIN}`)
      - traefik.http.routers.taiga.tls=true
      - traefik.http.routers.taiga.tls.certresolver=lets-encrypt
      - traefik.http.services.taiga.loadbalancer.server.port=80

  taiga-back:
    image: taigaio/taiga-back:latest
    container_name: taiga-back
    restart: always
    env_file:
      - .env
    volumes:
      - /pwspool/software/taiga/back/data:/taiga-back/data
      - /pwspool/software/taiga/back/media:/taiga-back/media
    networks:
      - taiga
      - traefik
    depends_on:
      - postgres
      - rabbitmq
      - taiga-events
    labels:
      - traefik.http.routers.taiga-back.rule=Host(`${DOMAIN}`) && PathPrefix(`/api`)
      - traefik.http.routers.taiga-back.tls=true
      - traefik.http.routers.taiga-back.tls.certresolver=lets-encrypt
      - traefik.http.services.taiga-back.loadbalancer.server.port=8000

  taiga-events:
    image: taigaio/taiga-events:latest
    container_name: taiga-events
    restart: always
    environment:
      - TAIGA_SECRET=${TAIGA_SECRET_KEY}
      - TAIGA_BACK_HOST=http://taiga-back:8000
    networks:
      - taiga

  postgres:
    image: postgres:13
    container_name: taiga-db
    restart: always
    networks:
      - taiga
    environment:
      POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - /pwspool/software/taiga/db:/var/lib/postgresql/data

  rabbitmq:
    image: rabbitmq:3-management
    container_name: taiga-rabbitmq
    restart: always
    networks:
      - taiga
    environment:
      - RABBITMQ_DEFAULT_USER=${RABBITMQ_USER}
      - RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}

