captainVersion: 4
services:
    $$cap_appname-db:
        image: mcr.microsoft.com/mssql/server:$$cap_server_version
        volumes:
            - $$cap_appname-db-data:/var/opt/mssql
        restart: always
        environment:
            ACCEPT_EULA: $$cap_accept_eula
            MSSQL_PID: $$cap_pid
            MSSQL_SA_PASSWORD: $$cap_sa_pass
            MSSQL_TCP_PORT: $$cap_container_port
        ports:
            - $$cap_host_port:$$cap_container_port
        caproverExtra:
            notExposeAsWebApp: 'true'
caproverOneClickApp:
    variables:
        - id: $$cap_server_version
          label: Version
          defaultValue: 2017-CU12-ubuntu
          description: Checkout this page for the valid tags https://mcr.microsoft.com/v2/mssql/server/tags/list
        - id: $$cap_host_port
          label: Host Port
          defaultValue: '1433'
          description: Sets the TCP port that the host exposes. This is also used for creating the port mapping.
          validRegex: /^([0-9])+$/
        - id: $$cap_container_port
          label: Container TCP Port
          defaultValue: '1433'
          description: Sets the TCP port that SQL Server container listens to. This is also used for creating the port mapping.
          validRegex: /^([0-9])+$/
        - id: $$cap_sa_pass
          label: SA Password
          description: "The database system administrator (userid = 'sa') password used to connect to SQL Server once the container is running. Important note: This password needs to include at least 8 characters of at least three of these four categories: uppercase letters, lowercase letters, numbers and non-alphanumeric symbols."
        - id: $$cap_pid
          label: PID
          description: 'Set the SQL Server edition or product key. This will run the container with the edition that is associated with the PID. This the Product ID (PID) or Edition that the container will run with. Acceptable values: Developer, Express, Standard, Enterprise, EnterpriseCore : More info here: https://hub.docker.com/_/microsoft-mssql-server'
          defaultValue: Developer
        - id: $$cap_accept_eula
          label: Accept EULA (Y/N)
          description: >-
              Confirms your acceptance of the End-User Licensing Agreement https://go.microsoft.com/fwlink/?linkid=857698. 
               By passing the value "Y", you are expressing that you have a valid and existing license for the edition and version of SQL Server that you intend to use. You also agree that your use of SQL Server software running in a Docker container image will be governed by the terms of your SQL Server license.
          validRegex: /^Y{1}$/
    instructions:
        start: >-
            SQL Server is a central part of the Microsoft data platform. SQL Server is an industry leader in operational database management systems (ODBMS).  


            SQL Server Developer edition lets developers build any kind of application on top of SQL Server. 

             It includes all the functionality of Enterprise edition, but is licensed for use as a development and test system, not as a production server. 

             SQL Server Developer Edition cannot be used in a production environment. 

             The SQL Server 2017 Developer Edition license terms are located here: https://go.microsoft.com/fwlink/?linkid=857698 .

             After installation on CapRover, it will be available as srv-captain--YOUR_CONTAINER_NAME at the port specified for "Container TCP Port" field to other apps.

            Enter your SQL Server Configuration parameters and click on next. It will take about a minute for the process to finish.
        end: SQL Server is deployed and available as srv-captain--$$cap_appname-db:$$cap_container_port to other apps.
    displayName: Microsoft SQL
    isOfficial: true
    description: Microsoft SQL Server is a relational database management system developed by Microsoft
    documentation: Taken from https://hub.docker.com/_/microsoft-mssql-server
