services:
  frontend:
    image: git.federspiel.tech/flfeders/fedeo/frontend:dev
    restart: always
    environment:
      - NUXT_PUBLIC_API_BASE=https://app.fedeo.de/backend
      - NUXT_PUBLIC_PDF_LICENSE=eyJkYXRhIjoiZXlKMElqb2laR1YyWld4dmNHVnlJaXdpWVhaMUlqb3hOemt3TmpNNU9UazVMQ0prYlNJNkltRndjQzVtWldSbGJ5NWtaU0lzSW00aU9pSXpOemt3Wm1Vek5UazBZbVU0TlRRNElpd2laWGh3SWpveE56a3dOak01T1RrNUxDSmtiWFFpT2lKemNHVmphV1pwWXlJc0luQWlPaUoyYVdWM1pYSWlmUT09Iiwic2lnbmF0dXJlIjoicWU4K0ZxQUJDNUp5bEJUU094Vkd5RTJMbk9UNmpyc2EyRStsN2tNNWhkM21KK2ZvVjYwaTFKeFdhZGtqSDRNWXZxQklMc0dpdWh5d2pMbUFjRHZuWGxOcTRMcXFLRm53dzVtaG1LK3lTeDRXbzVaS1loK1VZdFBzWUZjV3oyUHVGMmJraGJrVjJ6RzRlTGtRU09wdmJKY3JUZU1rN0N1VkN6Q1UraHF5T0ZVVXllWnRmaHlmcWswZEFFL0RMR1hvTDFSQXFjNkNkYU9FTDRTdC9Idy9DQnFieTE2aisvT3RxQUlLcy9NWTR6SVk3RTI3bWo4RUx5VjhXNkdXNXhqc0VUVzNKN0RRMUVlb3RhVlNLT29kc3pVRlhUYzVlbHVuSm04ZlcwM1ErMUhtSnpmWGoyS1dwM1dnamJDazZYSHozamFML2lOdUYvZFZNaWYvc2FoR3NnPT0ifQ==
    networks:
      - traefik
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik"
      - "traefik.port=3000"
      # Middlewares
      - "traefik.http.middlewares.fedeo-frontend-redirect-web-secure.redirectscheme.scheme=https"
      # Web Entrypoint
      - "traefik.http.routers.fedeo-frontend.middlewares=fedeo-frontend-redirect-web-secure"
      - "traefik.http.routers.fedeo-frontend.rule=Host(`app.fedeo.de`) && PathPrefix(`/`)"
      - "traefik.http.routers.fedeo-frontend.entrypoints=web"
      # Web Secure Entrypoint
      - "traefik.http.routers.fedeo-frontend-secure.rule=Host(`app.fedeo.de`) && PathPrefix(`/`)"
      - "traefik.http.routers.fedeo-frontend-secure.entrypoints=web-secured" #
      - "traefik.http.routers.fedeo-frontend-secure.tls.certresolver=mytlschallenge"
  backend:
    image: git.federspiel.tech/flfeders/fedeo/backend:dev
    restart: always
    environment:
      - INFISICAL_CLIENT_ID=a6838bd6-9983-4bf4-9be2-ace830b9abdf
      - INFISICAL_CLIENT_SECRET=4e3441acc0adbffd324aa50e668a95a556a3f55ec6bb85954e176e35a3392003
      - NODE_ENV=production
    networks:
      - traefik
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik"
      - "traefik.port=3100"
      # Middlewares
      - "traefik.http.middlewares.fedeo-backend-redirect-web-secure.redirectscheme.scheme=https"
      - "traefik.http.middlewares.fedeo-backend-strip.stripprefix.prefixes=/backend"
      # Web Entrypoint
      - "traefik.http.routers.fedeo-backend.middlewares=fedeo-backend-redirect-web-secure"
      - "traefik.http.routers.fedeo-backend.rule=Host(`app.fedeo.de`) && PathPrefix(`/backend`)"
      - "traefik.http.routers.fedeo-backend.entrypoints=web"
      # Web Secure Entrypoint
      - "traefik.http.routers.fedeo-backend-secure.rule=Host(`app.fedeo.de`) && PathPrefix(`/backend`)"
      - "traefik.http.routers.fedeo-backend-secure.entrypoints=web-secured" #
      - "traefik.http.routers.fedeo-backend-secure.tls.certresolver=mytlschallenge"
      - "traefik.http.routers.fedeo-backend-secure.middlewares=fedeo-backend-strip"
  #  db:
  #    image: postgres
  #    restart: always
  #    shm_size: 128mb
  #    environment:
  #      POSTGRES_PASSWORD: abc
  #      POSTGRES_USER: sandelcom
  #      POSTGRES_DB: sensorfy
  #    volumes:
  #      - ./pg-data:/var/lib/postgresql/data
  #    ports:
  #      - "5432:5432"
  traefik:
    image: traefik:v2.11
    restart: unless-stopped
    container_name: traefik
    command:
      - "--api.insecure=false"
      - "--api.dashboard=false"
      - "--api.debug=false"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--providers.docker.network=traefik"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web-secured.address=:443"
      - "--accesslog=true"
      - "--accesslog.filepath=/logs/access.log"
      - "--accesslog.bufferingsize=5000"
      - "--accesslog.fields.defaultMode=keep"
      - "--accesslog.fields.headers.defaultMode=keep"
      - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true" #
      - "--certificatesresolvers.mytlschallenge.acme.email=moin@fedeo.de"
      - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
    ports:
      - 80:80
      - 443:443
    volumes:
      - "./traefik/letsencrypt:/letsencrypt" # <== Volume for certs (TLS)
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./traefik/logs:/logs"
    networks:
      - traefik
networks:
  traefik:
    external: false