# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: OxiCloud
spec:
    description: |
        Self-hosted cloud storage written in Rust.
    coverImage: https://raw.githubusercontent.com/DioCrafts/OxiCloud/main/doc/images/Captura%20de%20pantalla%202025-03-23%20230739.png
    icon: https://raw.githubusercontent.com/DioCrafts/OxiCloud/main/static/oxicloud-logo.svg
    variables:
        - key: PUBLIC_DOMAIN
          type: DOMAIN
          name: Domain
          description: The domain you want to bind to your OxiCloud instance.
    tags:
        - Tool
        - Storage
        - Productivity
    readme: |
        # OxiCloud

        Self-hosted cloud storage — blazingly fast. Built with Rust for minimal resource usage.

        ## Features

        ### Storage & Files

        - **Upload / download / organise** — drag-and-drop, multi-file, grid & list views
        - **Chunked uploads** — TUS-like protocol, parallel chunks, resumable, MD5 integrity
        - **File deduplication** — SHA-256 content-addressable blobs with automatic ref-counting
        - **Adaptive compression** — zstd / gzip selected per MIME type
        - **Trash bin** — soft-delete, restore, auto-purge by retention policy
        - **Favourites & recent files**
        - **Full-text search** — by name, type, date range, size, recursive subtree (ltree)
        - **MIME magic-byte detection** — infer file type, not just extension guessing
        - **Inline preview** — images, PDF, text, audio & video player modal
        - **Thumbnails & transcoding** — WebP / AVIF on-the-fly via image crate

        ### Protocols

        - **WebDAV** — RFC 4918, streaming PROPFIND, locking, compatible with all major clients
        - **CalDAV** — calendar sync (Thunderbird, GNOME Calendar, iOS, DAVx⁵, and more)
        - **CardDAV** — contacts sync with vCard support
        - **WOPI** — edit Office docs in Collabora Online or OnlyOffice
        - **REST API** — complete JSON API for all operations

        ### Security & Auth

        - **JWT authentication** with refresh tokens
        - **Argon2id** password hashing
        - **OIDC / SSO** — Keycloak, Authentik, Authelia, Google, Azure AD, and more
        - **Role-based access** — admin / user, per-folder permissions
        - **Storage quotas** per user
        - **Shared links** with optional password protection

        ## Default Credentials

        On first launch, OxiCloud will prompt you to create an admin account through the web UI.

        For more details, see the [official documentation](https://github.com/DioCrafts/OxiCloud).
    services:
        - name: postgresql
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/postgresql.svg
          template: PREBUILT
          spec:
            id: postgresql
            source:
                image: postgres:16-alpine
                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: oxicloud
                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: postgres
                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: oxicloud
          icon: https://raw.githubusercontent.com/DioCrafts/OxiCloud/main/static/oxicloud-logo.svg
          dependencies:
            - postgresql
          template: GIT
          spec:
            id: oxicloud
            source:
                source: GITHUB
                repo: 939308212
                branch: main
            ports:
                - id: web
                  port: 8086
                  type: HTTP
            volumes:
                - id: storage
                  dir: /app/storage
            env:
                OXICLOUD_BASE_URL:
                    default: https://${PUBLIC_DOMAIN}.zeabur.app
                OXICLOUD_DB_CONNECTION_STRING:
                    default: postgres://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE}
          domainKey: PUBLIC_DOMAIN
localization:
    zh-CN:
        description: |
            以 Rust 打造的自托管云端存储平台
        variables:
            - key: PUBLIC_DOMAIN
              type: DOMAIN
              name: 域名
              description: 你想要绑定到 OxiCloud 的域名。
        readme: |
            # OxiCloud

            自托管云端存储 — 以 Rust 打造，性能极快、资源占用极低。

            ## 功能特色

            ### 存储与文件

            - **上传 / 下载 / 整理** — 支持拖放、多文件操作、网格与列表视图
            - **分块上传** — 类 TUS 协议、并行分块、可续传、MD5 完整性校验
            - **文件去重** — 基于 SHA-256 内容寻址 blob 与自动引用计数
            - **自适应压缩** — 按 MIME 类型自动选择 zstd / gzip
            - **回收站** — 软删除、恢复、按保留策略自动清除
            - **收藏与最近文件**
            - **全文搜索** — 可按名称、类型、日期范围、大小与递归子树（ltree）搜索
            - **MIME 魔数字节检测** — 根据文件内容推断类型，不只靠扩展名
            - **内联预览** — 支持图片、PDF、文本、音频与视频播放器弹窗
            - **缩略图与转码** — 通过 image crate 即时生成 WebP / AVIF

            ### 协议支持

            - **WebDAV** — RFC 4918、流式 PROPFIND、锁定机制，兼容所有主流客户端
            - **CalDAV** — 日历同步（Thunderbird、GNOME Calendar、iOS、DAVx⁵ 等）
            - **CardDAV** — 联系人同步，支持 vCard
            - **WOPI** — 通过 Collabora Online 或 OnlyOffice 编辑 Office 文档
            - **REST API** — 提供完整 JSON API 覆盖所有操作

            ### 安全与认证

            - **JWT 认证** — 支持 refresh token
            - **Argon2id** 密码哈希
            - **OIDC / SSO** — 支持 Keycloak、Authentik、Authelia、Google、Azure AD 等
            - **角色权限控制** — admin / user、文件夹级权限
            - **每位用户存储配额**
            - **分享链接** — 可选密码保护

            ## 默认账号

            首次启动时，OxiCloud 会在网页界面提示你创建管理员账号。

            更多详情请参阅 [官方文档](https://github.com/DioCrafts/OxiCloud)。
    zh-TW:
        description: |
            以 Rust 打造的自架雲端儲存平台
        variables:
            - key: PUBLIC_DOMAIN
              type: DOMAIN
              name: 網域
              description: 你想要綁定到 OxiCloud 的網域。
        readme: |
            # OxiCloud

            自架雲端儲存 — 以 Rust 打造，效能極快、資源佔用極低。

            ## 功能特色

            ### 儲存與檔案

            - **上傳 / 下載 / 整理** — 支援拖放、多檔操作、網格與清單檢視
            - **分塊上傳** — 類 TUS 協定、平行分塊、可續傳、MD5 完整性驗證
            - **檔案去重** — 以 SHA-256 內容位址 blob 搭配自動引用計數
            - **自適應壓縮** — 依 MIME 類型自動選擇 zstd / gzip
            - **回收站** — 軟刪除、還原、依保留策略自動清除
            - **收藏與近期檔案**
            - **全文搜尋** — 可依名稱、類型、日期範圍、大小與遞迴子樹（ltree）搜尋
            - **MIME 魔術位元偵測** — 根據檔案內容推斷類型，不只靠副檔名
            - **內嵌預覽** — 支援圖片、PDF、文字、音訊與影片播放器彈窗
            - **縮圖與轉碼** — 透過 image crate 即時產生 WebP / AVIF

            ### 協定支援

            - **WebDAV** — RFC 4918、串流 PROPFIND、鎖定機制，支援所有主流客戶端
            - **CalDAV** — 行事曆同步（Thunderbird、GNOME Calendar、iOS、DAVx⁵ 等）
            - **CardDAV** — 聯絡人同步，支援 vCard
            - **WOPI** — 透過 Collabora Online 或 OnlyOffice 編輯 Office 文件
            - **REST API** — 提供完整 JSON API 涵蓋所有操作

            ### 安全與驗證

            - **JWT 驗證** — 支援 refresh token
            - **Argon2id** 密碼雜湊
            - **OIDC / SSO** — 支援 Keycloak、Authentik、Authelia、Google、Azure AD 等
            - **角色權限控制** — admin / user、資料夾層級權限
            - **每位使用者儲存配額**
            - **分享連結** — 可選擇密碼保護

            ## 預設帳號

            首次啟動時，OxiCloud 會在網頁介面提示你建立管理員帳號。

            更多詳情請參閱 [官方文件](https://github.com/DioCrafts/OxiCloud)。
