# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Kan
spec:
    description: Self-hosted open-source Trello alternative for project management, with PostgreSQL on Zeabur.
    coverImage: https://github.com/user-attachments/assets/8490104a-cd5d-49de-afc2-152fd8a93119
    icon: https://kan.bn/favicon.ico
    variables:
        - key: PUBLIC_DOMAIN
          type: DOMAIN
          name: Domain
          description: The domain to bind to your Kan instance.
        - key: BETTER_AUTH_SECRET
          type: STRING
          name: Auth Secret
          description: A random 32+ character string used to encrypt user sessions. You can generate one at https://jwtsecrets.com/
    tags:
        - Tool
        - Productivity
        - Project Management
        - Collaboration
    readme: |-
        # Kan

        This template deploys a self-hosted instance of **Kan** with **PostgreSQL** on Zeabur.

        Kan is an open-source project management tool — a self-hostable alternative to Trello.

        ## Features

        - **Board Visibility**: Control who can view and edit your boards
        - **Workspace Members**: Invite members and collaborate with your team
        - **Trello Imports**: Easily import your Trello boards
        - **Labels & Filters**: Organise and find cards quickly
        - **Comments**: Discuss and collaborate with your team
        - **Activity Log**: Track all card changes with detailed activity history
        - **Templates**: Save time with reusable custom board templates

        ## Services

        This template includes three services:

        - **PostgreSQL** – Persistent database
        - **Kan Migrate** – Runs database migrations once, then can be deleted
        - **Kan** – The main web application

        ## Getting Started

        1. Wait for all three services to start
        2. Check the **Kan Migrate** service logs — once you see the migrations complete successfully, you can **delete the Kan Migrate service** (it has no further purpose and will keep restarting otherwise)
        3. Visit your domain to create your account

        ## Required Environment Variables

        - `NEXT_PUBLIC_BASE_URL` – Base URL of your instance (auto-set from your domain)
        - `BETTER_AUTH_SECRET` – Random 32+ character string for session encryption
        - `POSTGRES_URL` – PostgreSQL connection string (auto-generated from the PostgreSQL service)

        ## Optional Configuration

        You can customize additional settings including:

        - **SMTP email** – Set `EMAIL_FROM`, `SMTP_HOST`, `SMTP_PORT`, `SMTP_USER`, `SMTP_PASSWORD`
        - **Google OAuth** – Set `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET`
        - **GitHub OAuth** – Set `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET`
        - **Discord OAuth** – Set `DISCORD_CLIENT_ID` and `DISCORD_CLIENT_SECRET`
        - **Trello Import** – Set `TRELLO_APP_API_KEY` and `TRELLO_APP_API_SECRET`
        - **Disable sign-up** – Set `NEXT_PUBLIC_DISABLE_SIGN_UP=true`

        For a full list of environment variables, see:
        https://github.com/kanbn/kan#environment-variables-
    services:
        - name: PostgreSQL
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/postgresql.svg
          template: PREBUILT
          spec:
            id: postgresql
            source:
                image: postgres:15
                command:
                    - docker-entrypoint.sh
                    - -c
                    - config_file=/etc/postgresql/postgresql.conf
            ports:
                - id: database
                  port: 5432
                  type: TCP
            volumes:
                - id: data
                  dir: /var/lib/postgresql/data
            instructions:
                - title: Connection String
                  content: postgres://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}
                - title: PostgreSQL Connect Command
                  content: psql "postgres://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}"
                - title: PostgreSQL username
                  content: ${POSTGRES_USERNAME}
                - title: PostgreSQL password
                  content: ${POSTGRES_PASSWORD}
                - title: PostgreSQL database
                  content: ${POSTGRES_DATABASE}
                - title: PostgreSQL host
                  content: ${PORT_FORWARDED_HOSTNAME}
                - title: PostgreSQL port
                  content: ${DATABASE_PORT_FORWARDED_PORT}
            env:
                PGDATA:
                    default: /var/lib/postgresql/data/pgdata
                POSTGRES_CONNECTION_STRING:
                    default: postgres://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE}
                    expose: true
                POSTGRES_DATABASE:
                    default: ${POSTGRES_DB}
                    expose: true
                POSTGRES_DB:
                    default: kan_db
                POSTGRES_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                POSTGRES_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                POSTGRES_PORT:
                    default: "5432"
                    expose: true
                POSTGRES_URI:
                    default: ${POSTGRES_CONNECTION_STRING}
                    expose: true
                POSTGRES_USER:
                    default: kan
                POSTGRES_USERNAME:
                    default: ${POSTGRES_USER}
                    expose: true
            configs:
                - path: /etc/postgresql/postgresql.conf
                  template: |
                    listen_addresses = '*'
                    max_connections = 100
                    shared_buffers = 128MB
                    dynamic_shared_memory_type = posix
                    max_wal_size = 1GB
                    min_wal_size = 80MB
                    log_timezone = 'Etc/UTC'
                    datestyle = 'iso, mdy'
                    timezone = 'Etc/UTC'
                    lc_messages = 'en_US.utf8'
                    lc_monetary = 'en_US.utf8'
                    lc_numeric = 'en_US.utf8'
                    lc_time = 'en_US.utf8'
                    default_text_search_config = 'pg_catalog.english'
                  permission: null
                  envsubst: null
            healthCheck:
                type: TCP
                port: database
        - name: Kan Migrate
          icon: https://kan.bn/favicon.ico
          template: PREBUILT
          spec:
            id: kan-migrate
            source:
                image: ghcr.io/kanbn/kan-migrate:latest
            env:
                POSTGRES_URL:
                    default: ${POSTGRES_CONNECTION_STRING}
        - name: Kan
          icon: https://kan.bn/favicon.ico
          template: PREBUILT
          spec:
            id: kan
            source:
                image: ghcr.io/kanbn/kan:latest
            ports:
                - id: web
                  port: 3000
                  type: HTTP
            env:
                BETTER_AUTH_SECRET:
                    default: ${BETTER_AUTH_SECRET}
                NEXT_PUBLIC_ALLOW_CREDENTIALS:
                    default: "true"
                NEXT_PUBLIC_BASE_URL:
                    default: https://${PUBLIC_DOMAIN}.zeabur.app
                POSTGRES_URL:
                    default: ${POSTGRES_CONNECTION_STRING}
          domainKey: PUBLIC_DOMAIN
localization:
    zh-CN:
        description: 开源的自托管 Trello 替代方案，搭配 PostgreSQL，一键部署到 Zeabur。
        variables:
            - key: PUBLIC_DOMAIN
              type: DOMAIN
              name: 域名
              description: 想要绑定在 Kan 上的域名。
            - key: BETTER_AUTH_SECRET
              type: STRING
              name: 验证密钥
              description: 用于加密用户 Session 的 32 字符以上随机字符串。可以到 https://jwtsecrets.com/ 生成。
        readme: |-
            # Kan

            本模板将在 Zeabur 上部署一个自托管的 **Kan**，并搭配 **PostgreSQL** 数据库。

            Kan 是一个开源的项目管理工具，可作为 Trello 的自托管替代方案。

            ## 功能特色

            - **看板可见性**：控制谁可以查看和编辑你的看板
            - **工作区成员**：邀请成员并与团队协作
            - **Trello 导入**：轻松导入 Trello 看板
            - **标签与筛选**：快速整理和查找卡片
            - **评论功能**：与团队讨论和协作
            - **活动记录**：追踪所有卡片变更的详细历史记录
            - **模板功能**：使用可复用的自定义看板模板节省时间

            ## 服务说明

            本模板包含三个服务：

            - **PostgreSQL** – 持久化数据库
            - **Kan Migrate** – 执行一次数据库迁移后即可删除
            - **Kan** – 主要的 Web 应用程序

            ## 快速开始

            1. 等待所有三个服务启动
            2. 查看 **Kan Migrate** 服务的日志 — 确认迁移成功完成后，可以**删除 Kan Migrate 服务**（它已无后续用途，否则会持续重启）
            3. 访问你的域名创建账号

            ## 重要环境变量

            - `NEXT_PUBLIC_BASE_URL`：Kan 的对外 Base URL（由域名自动设置）
            - `BETTER_AUTH_SECRET`：用于加密 Session 的 32 字符以上随机字符串
            - `POSTGRES_URL`：PostgreSQL 连接字符串（由 PostgreSQL 服务自动生成）

            ## 进阶配置

            你可以进一步调整以下设置：

            - **SMTP 电子邮件** – 设置 `EMAIL_FROM`、`SMTP_HOST`、`SMTP_PORT`、`SMTP_USER`、`SMTP_PASSWORD`
            - **Google OAuth** – 设置 `GOOGLE_CLIENT_ID` 和 `GOOGLE_CLIENT_SECRET`
            - **GitHub OAuth** – 设置 `GITHUB_CLIENT_ID` 和 `GITHUB_CLIENT_SECRET`
            - **Discord OAuth** – 设置 `DISCORD_CLIENT_ID` 和 `DISCORD_CLIENT_SECRET`
            - **Trello 导入** – 设置 `TRELLO_APP_API_KEY` 和 `TRELLO_APP_API_SECRET`
            - **禁用注册** – 设置 `NEXT_PUBLIC_DISABLE_SIGN_UP=true`

            完整环境变量列表请参考：
            https://github.com/kanbn/kan#environment-variables-
    zh-TW:
        description: 開源的自架版 Trello 替代方案，搭配 PostgreSQL，一鍵部署到 Zeabur。
        variables:
            - key: PUBLIC_DOMAIN
              type: DOMAIN
              name: 網域
              description: 想要綁定在 Kan 上的網域。
            - key: BETTER_AUTH_SECRET
              type: STRING
              name: 驗證密鑰
              description: 用於加密使用者 Session 的 32 字元以上隨機字串。可以到 https://jwtsecrets.com/ 生成。
        readme: |-
            # Kan

            這個模板會在 Zeabur 上部署一個自架的 **Kan**，並搭配 **PostgreSQL** 資料庫。

            Kan 是一個開源的專案管理工具，可作為 Trello 的自架替代方案。

            ## 功能特色

            - **看板可見性**：控制誰可以查看和編輯你的看板
            - **工作區成員**：邀請成員並與團隊協作
            - **Trello 匯入**：輕鬆匯入 Trello 看板
            - **標籤與篩選**：快速組織和查找卡片
            - **留言功能**：與團隊討論和協作
            - **活動記錄**：追蹤所有卡片變更的詳細歷史紀錄
            - **模板功能**：使用可重複使用的自訂看板模板節省時間

            ## 服務說明

            這個模板包含三個服務：

            - **PostgreSQL** – 持久化資料庫
            - **Kan Migrate** – 執行一次資料庫遷移後即可刪除
            - **Kan** – 主要的網頁應用程式

            ## 快速上手

            1. 等待所有三個服務啟動
            2. 查看 **Kan Migrate** 服務的日誌 — 確認遷移成功完成後，可以**刪除 Kan Migrate 服務**（它已無後續用途，否則會持續重啟）
            3. 前往你的網域建立帳號

            ## 重要環境變數

            - `NEXT_PUBLIC_BASE_URL`：Kan 的對外 Base URL（由網域自動設定）
            - `BETTER_AUTH_SECRET`：用於加密 Session 的 32 字元以上隨機字串
            - `POSTGRES_URL`：PostgreSQL 連線字串（由 PostgreSQL 服務自動產生）

            ## 進階設定

            你可以進一步調整以下設定：

            - **SMTP 電子郵件** – 設定 `EMAIL_FROM`、`SMTP_HOST`、`SMTP_PORT`、`SMTP_USER`、`SMTP_PASSWORD`
            - **Google OAuth** – 設定 `GOOGLE_CLIENT_ID` 和 `GOOGLE_CLIENT_SECRET`
            - **GitHub OAuth** – 設定 `GITHUB_CLIENT_ID` 和 `GITHUB_CLIENT_SECRET`
            - **Discord OAuth** – 設定 `DISCORD_CLIENT_ID` 和 `DISCORD_CLIENT_SECRET`
            - **Trello 匯入** – 設定 `TRELLO_APP_API_KEY` 和 `TRELLO_APP_API_SECRET`
            - **停用註冊** – 設定 `NEXT_PUBLIC_DISABLE_SIGN_UP=true`

            完整環境變數列表請參考：
            https://github.com/kanbn/kan#environment-variables-
