# 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/docs/recipes/deployment/#how-can-i-upgrade-logto-safely). 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:
            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
