version: "2.1"
services:
  freshrss:
    image: linuxserver/freshrss
    container_name: freshrss
    restart: unless-stopped
    networks:
      - freshrss
      - postgres
      - proxy
    environment:
      - PUID=1000
      - PGID=985
      - TZ=Europe/Helsinki
    depends_on:
      - spotifeed
      - bibliogram
    volumes:
      - /docker/freshrss/freshrss:/config
      - /etc/localtime:/etc/localtime:ro
    labels:
      - "traefik.enable=true"

      - "traefik.http.routers.freshrss-redirect.entrypoints=http"
      - "traefik.http.routers.freshrss-redirect.rule=Host(`rss.korhonen.cc`)"
      - "traefik.http.middlewares.http2https.redirectscheme.scheme=https"
      - "traefik.http.routers.freshrss-redirect.middlewares=http2https"

      - "traefik.http.routers.freshrss.entrypoints=https"
      - "traefik.http.routers.freshrss.rule=Host(`rss.korhonen.cc`)"
      - "traefik.http.routers.freshrss.tls=true"
      - "traefik.http.routers.freshrss.tls.certresolver=http"
      - "traefik.http.routers.freshrss.service=freshrss"
      - "traefik.docker.network=proxy"
      - "traefik.http.services.freshrss.loadbalancer.server.port=80"

  spotifeed:
    build: ./spotifeed
    image: spotifeed
    container_name: spotifeed
    environment:
      - SPOTIFY_CLIENT_ID=${SPOTIFY_CLIENT_ID}
      - SPOTIFY_CLIENT_SECRET=${SPOTIFY_CLIENT_SECRET}
    restart: unless-stopped
    networks:
      - freshrss
      - proxy
    labels:
      - "traefik.enable=true"

      - "traefik.http.routers.spotifeed-redirect.entrypoints=http"
      - "traefik.http.routers.spotifeed-redirect.rule=Host(`spotifeed.korhonen.cc`)"
      - "traefik.http.middlewares.http2https.redirectscheme.scheme=https"
      - "traefik.http.routers.spotifeed-redirect.middlewares=http2https"

      - "traefik.http.routers.spotifeed.entrypoints=https"
      - "traefik.http.routers.spotifeed.rule=Host(`spotifeed.korhonen.cc`)"
      - "traefik.http.routers.spotifeed.tls=true"
      - "traefik.http.routers.spotifeed.tls.certresolver=http"
      - "traefik.http.routers.spotifeed.service=spotifeed"
      - "traefik.docker.network=proxy"
      - "traefik.http.services.spotifeed.loadbalancer.server.port=8083"

  bibliogram:
    image: cloudrac3r/bibliogram
    container_name: bibliogram
    restart: unless-stopped
    volumes:
      - /docker/freshrss/bibliogram/db:/app/db
      - /docker/freshrss/bibliogram/config.js:/app/config.js
    networks:
      - freshrss
      - proxy
    labels:
      - "traefik.enable=true"

      - "traefik.http.routers.bibliogram-redirect.entrypoints=http"
      - "traefik.http.routers.bibliogram-redirect.rule=Host(`bibliogram.korhonen.cc`)"
      - "traefik.http.middlewares.http2https.redirectscheme.scheme=https"
      - "traefik.http.routers.bibliogram-redirect.middlewares=http2https"

      - "traefik.http.routers.bibliogram.entrypoints=https"
      - "traefik.http.routers.bibliogram.rule=Host(`bibliogram.korhonen.cc`)"
      - "traefik.http.routers.bibliogram.tls=true"
      - "traefik.http.routers.bibliogram.tls.certresolver=http"
      - "traefik.http.routers.bibliogram.service=bibliogram"
      - "traefik.docker.network=proxy"
      - "traefik.http.services.bibliogram.loadbalancer.server.port=10407"

networks:
  freshrss:
    external: false
  postgres:
    external: true
  proxy:
    external: true
