captainVersion: 4
version: '2.0'
services:
    $$cap_appname-db:
        image: mariadb:$$cap_mariadb_version
        environment:
            MYSQL_ROOT_PASSWORD: '$$cap_mariadb_root_pswd' # Requested, set the root's password of MySQL service.
            MYSQL_LOG_CONSOLE: 'true'
        volumes:
            - $$cap_appname-db-data:/var/lib/mysql # Requested, specifies the path to MySQL data persistent store.
        caproverExtra:
            notExposeAsWebApp: true

    $$cap_appname:
        image: seafileltd/seafile-mc:$$cap_seafile_version
        volumes:
            - $$cap_appname-data:/shared # Requested, specifies the path to Seafile data persistent store.
        environment:
            DB_HOST: 'srv-captain--$$cap_appname-db'
            DB_ROOT_PASSWD: '$$cap_mariadb_root_pswd'
            TIME_ZONE: '$$cap_timezone'
            SEAFILE_ADMIN_EMAIL: '$$cap_admin_email' # Specifies Seafile admin user, default is 'me@example.com'.
            SEAFILE_ADMIN_PASSWORD: '$$cap_admin_pswd'
            SEAFILE_SERVER_HOSTNAME: '$$cap_seafile_hostname'
        depends_on:
            - $$cap_appname-db

caproverOneClickApp:
    variables:
        - id: '$$cap_seafile_version'
          label: Seafile Version
          defaultValue: '8.0.7'
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/seafileltd/seafile-mc/tags
          validRegex: '/.{1,}/'
        - id: '$$cap_mariadb_version'
          label: MariaDB Version
          defaultValue: '10.6.4'
          description: Check out their Docker page for the valid tags https://hub.docker.com/_/mariadb?tab=tags
          validRegex: '/.{1,}/'
        - id: '$$cap_mariadb_root_pswd'
          label: MariaDB Root Password
          defaultValue: '$$cap_gen_random_hex(10)'
          description: Default password for root user of MariaDB. Must have at least 8 chars, 1 letter and 1 number
          validRegex: '/.{8,}/'
        - id: '$$cap_timezone'
          label: 'Seafile Timezone'
          defaultValue: 'Etc/UTC'
          description: Timezone that Seafile should use
        - id: '$$cap_admin_email'
          label: Seafile Admin Email
          description: Email for admin user of Seafile
          defaultValue: 'admin@seafile.com'
          validRegex: '/.{1,}/'
        - id: '$$cap_admin_pswd'
          label: Seafile Admin Password
          description: Password for admin user of Seafile. Must have at least 8 chars, 1 letter and 1 number
          defaultValue: '$$cap_gen_random_hex(10)'
          validRegex: '/.{8,}/'
        - id: '$$cap_seafile_hostname'
          label: Seafile Hostname
          description: Hostname of Seafile instance (that will be used by it in future)
          validRegex: '/.{3,}/'

    instructions:
        start: |-
            Seafile is an open source file sync&share solution designed for high reliability, performance and productivity. 
            Sync, share and collaborate across devices and teams. 
            Build your team's knowledge base with Seafile's built-in Wiki feature.
        end: |-
            Congratulations, you have successfully deployed Seafile instance!

            Your app will soon be available at http://$$cap_appname.$$cap_root_domain/

            Don't forget to add specified hostname to Seafile domains!
    displayName: Seafile (no memcached)
    isOfficial: true
    description: Reliable and Performant File Sync and Share Solution
    documentation: Taken from https://manual.seafile.com/
