{
    "captainVersion": "2",
    "documentation": "Taken from https://docs.firefly-iii.org/installation/docker",
    "description": "Firefly III - A free and open source personal finance manager",
    "displayName": "Firefly III",
    "dockerCompose": {
        "version": "3.8",
        "services": {
            "$$cap_appname": {
                "image": "jc5x/firefly-iii:$$cap_firefly_version",
                "containerHttpPort": "8080",
                "volumes": [
                    "$$cap_appname-export:/var/www/firefly-iii/storage/export",
                    "$$cap_appname-upload:/var/www/firefly-iii/storage/upload"
                ],
                "restart": "always",
                "depends_on": ["$$cap_appname-db"],
                "environment": {
                    "SITE_OWNER": "$$cap_firefly_site-owner",
                    "TZ": "$$cap_firefly_time-zone",
                    "TRUSTED_PROXIES": "**",
                    "DB_CONNECTION": "mysql",
                    "DB_PORT": 3306,
                    "DB_DATABASE": "firefly",
                    "DB_USERNAME": "firefly",
                    "DB_HOST": "srv-captain--$$cap_appname-db",
                    "DB_PASSWORD": "$$cap_mariadb_password",
                    "APP_KEY": "$$cap_firefly_app-key"
                }
            },
            "$$cap_appname-db": {
                "image": "mariadb:$$cap_mariadb_version",
                "notExposeAsWebApp": "true",
                "volumes": ["$$cap_appname-db-data:/var/lib/mysql"],
                "restart": "always",
                "environment": {
                    "MYSQL_ROOT_PASSWORD": "$$cap_mariadb_password",
                    "MYSQL_DATABASE": "firefly",
                    "MYSQL_USER": "firefly",
                    "MYSQL_PASSWORD": "$$cap_mariadb_password"
                }
            }
        },
        "volumes": {
            "$$cap_appname-db-data": {},
            "$$cap_appname-export": {},
            "$$cap_appname-upload": {}
        }
    },

    "instructions": {
        "start": "Enter your Firefly III Configuration parameters and click on next. It will take about a minute for the process to finish.",
        "end": "Firefly III is deployed and available from the url http://$$cap_appname.$$cap_root_domain"
    },
    "variables": [
        {
            "id": "$$cap_mariadb_version",
            "label": "Mariadb Version Tag",
            "description": "Check out their Docker page for the valid tags https://hub.docker.com/_/mariadb?tab=tags",
            "defaultValue": "10.5.4",
            "validRegex": "/^([^\\s^\\/])+$/"
        },
        {
            "id": "$$cap_mariadb_password",
            "label": "Mariadb Password",
            "description": "The password of the Mariadb Database\"",
            "validRegex": "/.{1,}/"
        },
        {
            "id": "$$cap_firefly_version",
            "label": "Firefly Version Tag",
            "description": "Check out their Docker page for the valid tags https://hub.docker.com/r/jc5x/firefly-iii/tags",
            "defaultValue": "release-5.3.0",
            "validRegex": "/^([^\\s^\\/])+$/"
        },
        {
            "id": "$$cap_firefly_site-owner",
            "label": "Firefly Site Owner Mail",
            "description": "The email address of the owner of the app.",
            "validRegex": "/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/"
        },
        {
            "id": "$$cap_firefly_time-zone",
            "label": "Time zone",
            "description": "The preferred time zone. Check out the available time zone on https://en.wikipedia.org/wiki/List_of_tz_database_time_zones",
            "defaultValue": "Europe/Brussels",
            "validRegex": "/.{1,}/"
        },
        {
            "id": "$$cap_firefly_app-key",
            "label": "Firefly APP KEY",
            "description": "The key from which everything is encrypted. Generate one on https://passwordsgenerator.net/?length=32&symbols=0&numbers=1&lowercase=1&uppercase=1&similar=0&ambiguous=0&client=1&autoselect=0",
            "defaultValue": "qSAY3tVhAHgz87gusKFoPbg9hpCnMVTR",
            "validRegex": "/^[A-Za-z0-9]{32}$/"
        }
    ]
}
