services:
    n8n:
        container_name: n8n
        env_file:
            - .env
        image: n8nio/n8n:latest
        labels:
            traefik.docker.network: traefik
            traefik.enable: true
            traefik.http.routers.n8n.entrypoints: websecure
            traefik.http.routers.n8n.rule: Host(`n8n.alexlebens.net`)
            traefik.http.routers.n8n.service: n8n
            traefik.http.routers.n8n.middlewares: authentik@file
            traefik.http.services.n8n.loadbalancer.server.port: 5678
            traefik.http.middlewares.n8n.headers.SSLRedirect: true
            traefik.http.middlewares.n8n.headers.STSSeconds: 315360000
            traefik.http.middlewares.n8n.headers.browserXSSFilter: true
            traefik.http.middlewares.n8n.headers.contentTypeNosniff: true
            traefik.http.middlewares.n8n.headers.forceSTSHeader: true
            traefik.http.middlewares.n8n.headers.SSLHost: alexlebens.net
            traefik.http.middlewares.n8n.headers.STSIncludeSubdomains: true
            traefik.http.middlewares.n8n.headers.STSPreload: true
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik: null
        restart: unless-stopped
        volumes:
            - n8n:/home/node

networks:
    traefik:
        name: traefik
        external: true

volumes:
    n8n:
        driver: local
        driver_opts:
            type: none
            o: bind
            device: /var/lib/docker/volumes/partition/n8n
