captainVersion: 4
services:
    $$cap_appname-db:
        image: mysql:$$cap_mysql_version
        volumes:
            - $$cap_appname-db-data:/var/lib/mysql
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: $$cap_db_pass
            MYSQL_DATABASE: guacamole
            MYSQL_USER: guacamole
            MYSQL_PASSWORD: $$cap_db_pass
        caproverExtra:
            notExposeAsWebApp: 'true'
    $$cap_appname-guacd:
        image: guacamole/guacd:$$cap_guacd_version
        restart: always
        caproverExtra:
            notExposeAsWebApp: 'true'
    $$cap_appname:
        image: guacamole/guacamole:$$cap_guacamole_version
        restart: always
        depends_on:
            - $$cap_appname-db
            - $$cap_appname-guacd
        environment:
            GUACD_HOSTNAME: srv-captain--$$cap_appname-guacd
            MYSQL_HOSTNAME: srv-captain--$$cap_appname-db
            MYSQL_DATABASE: guacamole
            MYSQL_USER: guacamole
            MYSQL_PASSWORD: $$cap_db_pass
        caproverExtra:
            containerHttpPort: '8080'
caproverOneClickApp:
    variables:
        - id: $$cap_db_pass
          label: Database password
          description: ''
          validRegex: /.{1,}/
        - id: $$cap_guacamole_version
          label: Guacamole Version
          defaultValue: '1.3.0'
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/guacamole/guacamole/tags
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_guacd_version
          label: Guacd Version
          defaultValue: '1.3.0'
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/guacamole/guacd/tags
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_mysql_version
          label: MySQL Version
          defaultValue: '8.0.26'
          description: Check out their Docker page for the valid tags https://hub.docker.com/_/mysql?tab=tags
          validRegex: /^([^\s^\/])+$/
    instructions:
        start: Guacamole is an HTML5 Remote Desktop application.
        end: Guacamole is deployed and available as srv-captain--$$cap_appname. In order to use Guacamole, you must enable websockets and setup the MySQL database. For instructions on how to setup the database, check out https://github.com/christopher-kapic/caprover-guacamole
    displayName: Guacamole
    isOfficial: false
    description: An HTML5 remote access application.
    documentation: 'https://guacamole.apache.org/'
