captainVersion: 4
services:
    $$cap_appname:
        image: bitnami/moodle:$$cap_md_version
        volumes:
            - $$cap_appname-moodle:/bitnami/moodle
            - $$cap_appname-moodledata:/bitnami/moodledata
        restart: always
        environment:
            MOODLE_DATABASE_TYPE: $$cap_db_type
            MOODLE_DATABASE_HOST: $$cap_db_host
            MOODLE_DATABASE_PORT_NUMBER: $$cap_db_port
            MOODLE_DATABASE_USER: $$cap_db_user
            MOODLE_DATABASE_NAME: $$cap_db_name
            MOODLE_DATABASE_PASSWORD: $$cap_db_pass
            ALLOW_EMPTY_PASSWORD: 'no'
            MOODLE_USERNAME: admin
            MOODLE_PASSWORD: password
            MOODLE_EMAIL: $$cap_md_admin_email
            MOODLE_SITE_NAME: $$cap_md_sitename
            MOODLE_SKIP_BOOTSTRAP: $$cap_md_bootstrap
            PHP_MAX_INPUT_VARS: '6000'
            PHP_MEMORY_LIMIT: '256M'
            PHP_UPLOAD_MAX_FILESIZE: 100M
            PHP_POST_MAX_SIZE: 100M
            PHP_MAX_INPUT_TIME: '30'
            PHP_MAX_EXECUTION_TIME: '30'
        caproverExtra:
            containerHttpPort: '8080'
caproverOneClickApp:
    variables:
        - description: Valid values mariadb, mysqli
          defaultValue: mariadb
          id: $$cap_db_type
          label: Database type
        - description: Database host
          defaultValue: srv-captain--xxx
          id: $$cap_db_host
          label: Database Host
        - id: $$cap_db_port
          label: Database Port
          defaultValue: '3306'
          description: Default Mysql port will be 3306
          validRegex: /^([^\s^\/])+$/
        - description: Database name
          defaultValue: moodle
          id: $$cap_db_name
          label: DB Name
        - id: $$cap_db_user
          label: Database user
          defaultValue: moodledbuser
          description: Database username
        - id: $$cap_db_pass
          label: Database password
          validRegex: /.{1,}/
        - id: $$cap_md_version
          label: Moodle Version
          defaultValue: latest
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/bitnami/moodle/tags/
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_md_sitename
          label: Moodle Site Name
          defaultValue: New site
          description: Moodle Site name.
        - id: $$cap_md_admin_email
          label: Moodle Admin Email
          defaultValue: user@example.com
          description: Moodle application email.
        - id: $$cap_md_bootstrap
          label: Is moodle exists in db?
          defaultValue: 'no'
          description: Set 'no' for new installation. This is necessary in case you use a database that already has Moodle data.
    instructions:
        start: >-
            Moodle Caprover installation - From Bitnami Docker Image
            Note: You should start by configuring your DB first and then comeback with all the DB Information.
        end: >
            Moodle is deployed and available as $$cap_appname. Username: admin, Password: password
             IMPORTANT: If it is new installation, It will take up to 10 minutes for Moodle to be ready. **Dont update app until it is displayed correctly on frontend** Before that, you might see a 502 error page.
             'Native MYSQL Authentication' should be MYSQL Authentication plugin for the $$cap_db_user db user. Else database wont connect. Check build logs to confirm it is connected properly.
             Visit https://hub.docker.com/r/bitnami/moodle/ for more details and enviornament variables.
    displayName: Moodle LMS
    description: Moodle(TM) is a very popular open source learning management solution (LMS) for the delivery of elearning courses and programs.
    documentation: Taken from https://hub.docker.com/r/bitnami/moodle/. Port mapping removed from Moodle as it is no longer needed
