# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: LinkStack
spec:
    description: |
        Self-hosted, open-source Linktree alternative. Deploys the official LinkStack Docker image on Zeabur. By default this template does not configure any persistent volumes; all data is stored inside the container filesystem. If you need persistence, you can manually attach volumes after deployment.
    coverImage: https://i.meee.com.tw/RFvU4Pu.png
    icon: https://linkstack.org/favicon.ico
    variables:
        - key: PUBLIC_DOMAIN
          type: DOMAIN
          name: Domain
          description: Domain for your LinkStack instance.
        - key: ADMIN_EMAIL
          type: STRING
          name: Admin email
          description: Email address used as Apache ServerAdmin.
    tags:
        - Tool
        - Link-in-bio
        - Personal
        - Website
    readme: "# LinkStack on Zeabur\n\nThis template deploys the official Docker image `linkstackorg/linkstack`\non Zeabur with a minimal configuration.\n\n## What this template sets up\n\n- A single LinkStack service using the official Docker image\n- HTTP endpoint exposed on port 80\n- Basic configuration via environment variables:\n  - `SERVER_ADMIN`\n  - `HTTP_SERVER_NAME`\n  - `HTTPS_SERVER_NAME`\n  - `TZ` (defaults to UTC)\n  - `LOG_LEVEL`\n  - `PHP_MEMORY_LIMIT`\n  - `UPLOAD_MAX_FILESIZE`\n  - `APP_KEY` (preconfigured)\n\n## Persistence\n\n**By default, this template does not configure any persistent volumes.**\n\n- All application code, configuration, and data are stored inside the\n  container filesystem under `/htdocs`.\n- If you rebuild or redeploy the service, the container filesystem will be\n  recreated and your LinkStack data will be reset.\n\n### If you need long-term persistence\n\n1. After deployment and initial setup, go to the Zeabur dashboard for this\n   service and add a persistent volume.\n2. Choose a mount path such as `/htdocs` (for full persistence) or\n   specific subdirectories like:\n   - `/htdocs/storage`\n   - `/htdocs/uploads`\n   - `/htdocs/themes`\n3. Make sure the volume is initialized with the current contents of\n   `/htdocs` (for example, by copying data into the volume using a one-off\n   maintenance container or SSH).  \n   Mounting an **empty** volume directly onto `/htdocs` or its subpaths\n   will hide the existing files from the image and LinkStack may fail to\n   start.\n\n## After deployment\n\n1. Open your bound domain.\n2. Follow the LinkStack setup flow to create the first user.\n3. Configure your profile, links, and themes from the admin panel."
    services:
        - name: LinkStack
          icon: https://linkstack.org/favicon.ico
          template: PREBUILT
          spec:
            source:
                image: linkstackorg/linkstack:latest
            ports:
                - id: web
                  port: 80
                  type: HTTP
            env:
                APP_KEY:
                    default: base64:O2rKvVt8pJq1wqYx+qGOLf5gQdP6YBq7O8U2Pz7Zx0w=
                HTTP_SERVER_NAME:
                    default: ${PUBLIC_DOMAIN}
                HTTPS_SERVER_NAME:
                    default: ${PUBLIC_DOMAIN}
                LOG_LEVEL:
                    default: info
                PHP_MEMORY_LIMIT:
                    default: 256M
                SERVER_ADMIN:
                    default: ${ADMIN_EMAIL}
                TZ:
                    default: UTC
                UPLOAD_MAX_FILESIZE:
                    default: 8M
          domainKey: PUBLIC_DOMAIN
localization:
    zh-TW:
        description: |
            自架的開源 Linktree 替代方案。此模板使用官方 LinkStack Docker 映像檔， 預設不掛載任何持久化 Volume，所有資料都存在容器檔案系統中。 若希望長久保存資料，可在部署完成後自行於 Zeabur 後台手動掛載硬碟。
        variables:
            - key: PUBLIC_DOMAIN
              type: DOMAIN
              name: 網域
              description: 部署 LinkStack 時要綁定的網域名稱。
            - key: ADMIN_EMAIL
              type: STRING
              name: 管理員 Email
              description: Apache ServerAdmin 會使用的管理員電子郵件位址。
        readme: |-
            # 在 Zeabur 部署 LinkStack

            這個模板會：

            - 部署官方映像檔 `linkstackorg/linkstack`
            - 對外開放 HTTP 80 連接埠
            - 透過環境變數設定：
              - `SERVER_ADMIN`
              - `HTTP_SERVER_NAME`
              - `HTTPS_SERVER_NAME`
              - `TZ`（預設 `UTC`）
              - `LOG_LEVEL`
              - `PHP_MEMORY_LIMIT`
              - `UPLOAD_MAX_FILESIZE`
              - `APP_KEY`（已預設一組可用的金鑰）

            ## 關於持久化

            本模板 **預設不掛載任何 Volume**：

            - 所有程式、設定與資料都存放在容器內的 `/htdocs`。
            - 一旦你在 Zeabur 中「重新部署」、「重建映像」，
              容器檔案系統會被重置，LinkStack 也會回到初始狀態。

            ### 若你之後希望資料長久保存

            1. 在完成安裝與基本設定後，前往 Zeabur 專案中的該服務頁面。
            2. 手動新增一個持久化硬碟（Volume），並掛載到：
               - `/htdocs`（整個站台完整持久化），或
               - `/htdocs/storage`、`/htdocs/uploads`、`/htdocs/themes` 等子目錄。
            3. 注意：若將「空的 Volume」直接掛到 `/htdocs` 或上述子目錄，
               會把原本映像檔裡的檔案遮蔽掉，可能導致 LinkStack 無法啟動。
               建議先用一次性容器或 SSH 將現有 `/htdocs` 的內容複製到 Volume，
               再改掛載 Volume 以確保站台正常運作。

            ## 部署完成後

            1. 在瀏覽器中開啟你的網域。
            2. 依照 LinkStack 首次安裝流程建立第一位使用者。
            3. 視需要再到 Zeabur 後台手動設定 Volume，以達成長期持久化。
