# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Logto (without DB)
spec:
    description: For users to test the latest Logto (please read the instructions)
    icon: https://dev-to-uploads.s3.amazonaws.com/uploads/organization/profile_image/6720/caee4597-8613-4fdc-902a-955dea9855b4.png
    variables:
        - key: ENDPOINT_DOMAIN
          type: DOMAIN
          name: Logto API URL
          description: The URL of the Logto API
        - key: ADMIN_ENDPOINT_DOMAIN
          type: DOMAIN
          name: Logto Admin Console URL
          description: The URL of the Logto Admin Console
    tags:
        - Website
        - Database
        - API
    readme: |
        # Logto (without DB)
        > For users wanting to test the latest Logto version

        To make the container running for users to perform the DB upgrade process, the command was changed into
        ```sh
        sh -c "tail -f /dev/null"
        ```

        To deploy the DB alteration
        ```sh
        npx @logto/cli db alteration deploy
        ```

        Change the command back to
        ```sh
        sh -c "npm run cli db seed -- --swe && npm start"
        ```
        to start using the latest version of the Logto.

        The upgrade of Logto should be *careful*. [Check Logto's documentation for more information](https://docs.logto.io/logto-oss/deployment-and-configuration). Learn more about [db alteration](https://docs.logto.io/logto-oss/using-cli/database-alteration).
    services:
        - name: logto-latest
          icon: https://dev-to-uploads.s3.amazonaws.com/uploads/organization/profile_image/6720/caee4597-8613-4fdc-902a-955dea9855b4.png
          template: PREBUILT_V2
          spec:
            id: logto-latest
            source:
                image: docker.io/svhd/logto:latest
                command:
                    - sh
                args:
                    - -c
                    - tail -f /dev/null
            ports:
                - id: web
                  port: 3001
                  type: HTTP
                - id: console
                  port: 3002
                  type: HTTP
            env:
                ADMIN_ENDPOINT:
                    default: ${ZEABUR_CONSOLE_URL}
                DB_URL:
                    default: postgres://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE}
                ENDPOINT:
                    default: ${ZEABUR_WEB_URL}
                TRUST_PROXY_HEADER:
                    default: "true"
            configs: []
            healthCheck:
                type: HTTP
                port: web
                http:
                    path: /api/status
            portForwarding:
                enabled: false
          domainKey:
            - port: web
              variable: ENDPOINT_DOMAIN
            - port: console
              variable: ADMIN_ENDPOINT_DOMAIN
localization:
    zh-TW:
        description: 供使用者測試最新的 Logto（請閱讀說明）
        readme: |
            # Logto（無資料庫）
            > 適用於想要測試最新 Logto 版本的使用者

            為了讓容器持續執行，方便使用者進行資料庫升級流程，命令已改為
            ```sh
            sh -c "tail -f /dev/null"
            ```

            若要部署資料庫變更
            ```sh
            npx @logto/cli db alteration deploy
            ```

            再將命令改回
            ```sh
            sh -c "npm run cli db seed -- --swe && npm start"
            ```

            以開始使用最新版本的 Logto。

            Logto 的升級應該要*謹慎*進行。[請查看 Logto 文件以取得更多資訊](https://docs.logto.io/zh-TW/logto-oss/deployment-and-configuration)。深入了解 [資料庫變更](https://docs.logto.io/zh-TW/logto-oss/using-cli/database-alteration)。
