# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Microsoft SQL Server (MSSQL)
spec:
    description: A powerful relational database management system developed by Microsoft.
    coverImage: https://radiant.in/wp-content/uploads/2022/11/Microsoft-sql-server-logo-for-bottom-1.png
    icon: https://svgl.app/library/sql-server.svg
    variables:
        - key: MSSQL_SA_PASSWORD
          type: STRING
          name: MSSQL 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.'
    tags:
        - Database
        - Tool
    readme: "# Microsoft SQL Server (MSSQL)\nA powerful relational database management system developed by Microsoft.\n\n## Usage  \nDeploy the template and navigate to the `Networking` tab. Copy the domain and port, then connect using your SQL management tool. The connection URL should be in the format `domain:port`. Use the admin username `sa` along with your password to log in. If you forget your password, you can find it in the `Variable` tab under the `MSSQL_SA_PASSWORD` variable.\n\n## Environment Variable\n- ACCEPT_EULA: Confirms your acceptance of the End-User Licensing Agreement⁠\n  - Default Value: Y\n- MSSQL_SA_PASSWORD: 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.\n- MSSQL_PID: \n  - Default Value: Evaluation\n  - Developer : This will run the container using the Developer Edition (this is the default if no MSSQL_PID environment variable is supplied)\n  - Express : This will run the container using the Express Edition\n  - Standard : This will run the container using the Standard Edition\n  - Enterprise : This will run the container using the Enterprise Edition\n  - EnterpriseCore : This will run the container using the Enterprise Edition Core : This will run the container with the edition that is associated with the PID"
    services:
        - name: MSSQL
          icon: https://svgl.app/library/sql-server.svg
          template: PREBUILT
          spec:
            id: mssql
            source:
                image: mcr.microsoft.com/mssql/server
            ports:
                - id: database
                  port: 1433
                  type: TCP
            volumes:
                - id: data
                  dir: /var/opt/mssql
            instructions:
                - title: JDBC Connect String
                  content: jdbc:sqlserver://;serverName=${PORT_FORWARDED_HOSTNAME};port=${DATABASE_PORT_FORWARDED_PORT};"
                - title: Host
                  content: ${PORT_FORWARDED_HOSTNAME}
                - title: Port
                  content: ${DATABASE_PORT_FORWARDED_PORT}
                - title: System Administrator Password
                  content: ${MSSQL_SA_PASSWORD}
            env:
                ACCEPT_EULA:
                    default: "Y"
                    expose: true
                MSSQL_PID:
                    default: Evaluation
                    expose: true
                MSSQL_SA_PASSWORD:
                    default: ${MSSQL_SA_PASSWORD}
                    expose: true
localization:
    zh-TW:
        description: Microsoft SQL Server 是一個由微軟開發的強大關聯式資料庫管理系統。
        variables:
            - key: MSSQL_SA_PASSWORD
              type: STRING
              name: MSSQL SA 密碼
              description: 當容器啟動後，此密碼將作為系統管理員帳號（使用者名稱為 'sa'）的登入密碼。注意：密碼至少需 8 個字元，並包含以下四種字元類型中的三種：大寫字母、小寫字母、數字、特殊符號。
        readme: "# Microsoft SQL Server (MSSQL)\n微軟開發的強大關聯式資料庫管理系統。\n\n## 使用方式  \n部署後請前往「Networking」分頁，複製網域與連接埠，使用你的 SQL 管理工具（如 Azure Data Studio、DBeaver、SQL Server Management Studio）來連線。連線格式為 `網域:連接埠`，使用 `sa` 作為帳號並輸入你的密碼。若忘記密碼，可於「Variables」分頁中查看 `MSSQL_SA_PASSWORD` 變數。\n\n## 環境變數說明\n- ACCEPT_EULA：接受最終用戶授權協議  \n  - 預設值：`Y`\n- MSSQL_SA_PASSWORD：MSSQL 系統管理員（`sa`）的登入密碼。需包含至少 8 個字元及 3 種字元類型（大小寫、數字、符號）。\n- MSSQL_PID：版本類型（用於指定 SQL Server 版本）\n  - 預設值：`Evaluation`\n  - `Developer`：開發者版（預設）\n  - `Express`：精簡版\n  - `Standard`：標準版\n  - `Enterprise`：企業版\n  - `EnterpriseCore`：企業核心版（需授權）"
