captainVersion: 4
services:
    $$cap_appname:
        image: mongo:$$cap_mongo_version
        volumes:
            - $$cap_appname-db-data:/data/db
            - $$cap_appname-db-config:/data/configdb
        restart: always
        environment:
            MONGO_INITDB_ROOT_USERNAME: $$cap_mongo_username
            MONGO_INITDB_ROOT_PASSWORD: $$cap_mongo_password
        caproverExtra:
            notExposeAsWebApp: 'true'
caproverOneClickApp:
    variables:
        - id: $$cap_mongo_version
          label: MongoDB Version
          defaultValue: '4'
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/library/mongo/tags/
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_mongo_username
          label: MongoDB RootUsername
          defaultValue: root
          description: Only use alphanumeric chars.
          validRegex: /^([a-zA-Z0-9])+$/
        - id: $$cap_mongo_password
          label: MongoDB password
          validRegex: /^\s*\S.*$/
    instructions:
        start: >-
            MongoDB is a cross-platform document-oriented database. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. 

             After installation on CapRover, it will be available as srv-captain--YOUR_CONTAINER_NAME at port 27017 to other CapRover apps.

             Enter your MongoDB Configuration parameters and click on next. It will take about a minute for the process to finish.
        end: "MongoDB is deployed and available as srv-captain--$$cap_appname:27017 to other apps. For example with NodeJS: mongoose.connect('mongodb://srv-captain--$$cap_appname/mydatabase?authSource=admin', {userMongoClient: true});"
    displayName: MongoDB
    isOfficial: true
    description: MongoDB is a cross-platform document-oriented database program. Classified as a NoSQL database program
    documentation: Taken from https://hub.docker.com/r/mongo/
