captainVersion: 4
services:
    $$cap_appname-postgres:
        image: postgres:12-alpine
        volumes:
            - $$cap_appname-postgres-data:/var/lib/postgresql/data
        restart: always
        environment:
            POSTGRES_USER: kutt
            POSTGRES_PASSWORD: $$cap_kutt_postgres_password
            POSTGRES_DB: kutt
        caproverExtra:
            notExposeAsWebApp: 'true'
    $$cap_appname-redis:
        image: redis:6.0-alpine
        volumes:
            - $$cap_appname-redis:/data
        caproverExtra:
            notExposeAsWebApp: 'true'
    $$cap_appname-kutt:
        depends_on:
            - $$cap_appname-postgres
            - $$cap_appname-redis
        image: kutt/kutt:$$cap_kutt_version
        restart: always
        caproverExtra:
            containerHttpPort: '3000'
        environment:
            DB_HOST: srv-captain--$$cap_appname-postgres
            DB_NAME: kutt
            DB_USER: kutt
            DB_PASSWORD: $$cap_kutt_postgres_password
            REDIS_HOST: srv-captain--$$cap_appname-redis
            SITE_NAME: $$cap_appname URL Shortener
            DEFAULT_DOMAIN: $$cap_appname-kutt.$$cap_root_domain
            JWT_SECRET: $$cap_gen_random_hex(64)
            MAIL_HOST: $$cap_kutt_mail_host
            MAIL_PORT: $$cap_kutt_mail_port
            MAIL_USER: $$cap_kutt_mail_user
            MAIL_PASSWORD: $$cap_kutt_mail_password
caproverOneClickApp:
    variables:
        - id: $$cap_kutt_version
          label: Kutt Version
          defaultValue: 'v2.7.3'
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/kutt/kutt/tags
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_kutt_postgres_password
          label: Postgres Password
          description: Password must be at least 12 characters.  Please use a random string.
          validRegex: /^[^\@]{12,}$/
        - id: $$cap_kutt_mail_host
          label: Kutt Mail Host
          defaultValue: 'smtp.gmail.com'
          description: STMP mail host for Kutt
        - id: $$cap_kutt_mail_port
          label: Kutt Mail Port
          defaultValue: 587
        - id: $$cap_kutt_mail_user
          label: Kutt Mail User
          defaultValue: smtp
        - id: $$cap_kutt_mail_password
          label: Kutt Mail Password
    instructions:
        start: >-
            Kutt is a modern URL shortener with support for custom domains. Shorten URLs, manage your links and view the click rate statistics.

        end: >
            Kutt is deployed and available as $$cap_appname-kutt . 

            IMPORTANT: It will take up to 2 minutes for the application to be ready. Before that, you might see a 502 error page.
    displayName: Kutt
    isOfficial: true
    description: Kutt is a modern URL shortener with support for custom domains. Shorten URLs, manage your links and view the click rate statistics.
    documentation: Taken from https://github.com/thedevs-network/kutt
