captainVersion: 4
services:
    # Lychee
    $$cap_appname:
        depends_on:
            - $$cap_appname-mariadb
        image: lycheeorg/lychee:$$cap_lychee_version
        restart: unless-stopped
        environment:
            TZ: $$cap_tz
            PUID: $$cap_puid
            PGID: $$cap_guid
            DB_CONNECTION: mysql
            DB_HOST: srv-captain--$$cap_appname-mariadb
            DB_PORT: '3306'
            DB_DATABASE: $$cap_mariadb-db
            DB_USERNAME: $$cap_mariadb-user
            DB_PASSWORD: $$cap_mariadb-password
            STARTUP_DELAY: '30'
        ports:
            - $$cap_webui_port:80
        volumes:
            - $$cap_appname-conf:/conf
            - $$cap_appname-uploads:/uploads
            - $$cap_appname-sym:/sym
    # MariaDB
    $$cap_appname-mariadb:
        image: mariadb:$$cap_mariadb_version
        environment:
            MYSQL_RANDOM_ROOT_PASSWORD: '1'
            MYSQL_DATABASE: $$cap_mariadb-db
            MYSQL_USER: $$cap_mariadb-user
            MYSQL_PASSWORD: $$cap_mariadb-password
        volumes:
            - $$cap_appname-db-data:/var/lib/mysql
        restart: unless-stopped
        caproverExtra:
            notExposeAsWebApp: 'true'
caproverOneClickApp:
    variables:
        - id: $$cap_tz
          label: Timezone
          description: This is the timezone for the application, find yours at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
          defaultValue: Europe/Brussels
        - id: $$cap_lychee_version
          label: Lychee Version
          defaultValue: 'v4.0.7'
          description: Checkout their docker page for the valid tags https://hub.docker.com/r/lycheeorg/lychee/tags
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_puid
          label: User ID
          defaultValue: '1000'
          description: User ID that the process uses, run (id $user) in your instance to see the id
          validRegex: /.{1,}/
        - id: $$cap_guid
          label: Group ID
          defaultValue: '1000'
          description: Group ID that the process uses, run (id $user) in your instance to see the id
          validRegex: /.{1,}/
        - id: $$cap_webui_port
          label: Lychee WebUI Port
          description: The port used to access Lychee
          defaultValue: '90'
        - id: $$cap_mariadb_version
          label: MariaDB Version
          defaultValue: '10.5.6'
          description: Checkout their docker page for the valid tags https://hub.docker.com/r/library/mariadb/tags/
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_mariadb-db
          label: MariaDB Database
          description: Database for Lychee
          defaultValue: 'lychee'
        - id: $$cap_mariadb-user
          label: MariaDB User
          description: Database User for Lychee
          defaultValue: 'lychee'
        - id: $$cap_mariadb-password
          label: MariaDB database user password
          description: Super secret database user password
    instructions:
        start: >-
            A great looking and easy-to-use photo-management-system.
        end: >-
            Aaaand you're done! 😄
            Your service is available at http://$$cap_appname.$$cap_root_domain
    displayName: 'Lychee'
    isOfficial: true
    description: A great looking and easy-to-use photo-management-system.
    documentation: Taken from https://github.com/lycheeorg/lychee
