services:
    mariadb:
        container_name: firefly_mariadb
        env_file:
            - .env
        image: mariadb
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik:
                ipv4_address: 172.27.1.55
        restart: always
        volumes:
            - db:/var/lib/mysql

    server:
        container_name: firefly_server
        depends_on: 
            - 'mariadb'
        env_file:
            - .env
        image: fireflyiii/core:latest
        labels:
            traefik.docker.network: traefik
            traefik.enable: true
            traefik.http.routers.firefly.entrypoints: websecure
            traefik.http.routers.firefly.rule: Host(`firefly.alexlebens.net`)
            traefik.http.routers.firefly.service: firefly
            traefik.http.services.firefly.loadbalancer.server.port: 8080
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik:
                ipv4_address: 172.27.1.56
        restart: always
        volumes:
            - upload:/var/www/html/storage/upload

    plaid_connector:
        container_name: firefly_plaid
        depends_on:
            - 'server'
        image: registry.gitlab.com/georgehahn/firefly-plaid-connector:latest
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik:
                ipv4_address: 172.27.1.57
        restart: always
        volumes:
            - config:/config

networks:
    traefik:
        name: traefik
        external: true

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

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

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