captainVersion: 4
services:
    $$cap_appname-db:
        documentation: Taken from https://hub.docker.com/_/percona
        image: percona/percona-server:$$cap_percona_version
        volumes:
            - $$cap_appname-db-data:/var/lib/mysql
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: $$cap_db_pass
            MYSQL_DATABASE: mautic
            MYSQL_USER: $$cap_db_user
            MYSQL_PASSWORD: $$cap_db_pass
        caproverExtra:
            notExposeAsWebApp: 'true'
    $$cap_appname:
        depends_on:
            - $$cap_appname-db
        image: mautic/mautic:$$cap_mautic_version
        volumes:
            - $$cap_appname-data:/var/www/html
        restart: always
        environment:
            MAUTIC_DB_HOST: srv-captain--$$cap_appname-db
            MYSQL_PORT_3306_TCP: '3306'
            MAUTIC_DB_USER: $$cap_db_user
            MAUTIC_DB_PASSWORD: $$cap_db_pass
            MAUTIC_DB_NAME: mautic
            MAUTIC_RUN_CRON_JOBS: 'true'
caproverOneClickApp:
    variables:
        - id: $$cap_db_user
          label: Database user
          defaultValue: mauticuser
          description: ''
          validRegex: /^([a-zA-Z0-9])+$/
        - id: $$cap_db_pass
          label: Database password
          description: ''
          validRegex: /.{1,}/
        - id: $$cap_mautic_version
          label: Mautic Version
          defaultValue: v3.0.0-beta
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/mautic/mautic/tags. Please be aware, this is a beta version.
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_percona_version
          label: Percona Version (database)
          defaultValue: '5.7'
          description: Check out their Docker page for the valid tags https://hub.docker.com/_/percona?tab=tags
          validRegex: /^([^\s^\/])+$/
    instructions:
        start: >-
            Mautic is an online,marketing automation tool.

            The process will deploy a database and the App.

            The process will take about a minute for the process to finish.
        end: >-
            Mautic is deployed and available as $$cap_appname.


            IMPORTANT: It will take up to 1-2 minutes for Mautic to be ready. Before that, you might see 502 error page.

            If you dont have any SMTP server, I recommend you to install 'poste.io' one click app version.
    displayName: Mautic beta
    isOfficial: true
    description: Mautic is an open source marketing automation platform.
