# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Garage
spec:
    description: An open-source distributed object storage service tailored for self-hosting
    coverImage: https://garagehq.deuxfleurs.fr/images/map.svg
    icon: https://git.deuxfleurs.fr/Deuxfleurs/garage/raw/commit/070a8ad110cb75dd2df7ddc9ecbb5c814291ac89/doc/logo/garage-notext.svg
    readme: |
        Garage is an S3-compatible distributed object storage service designed for self-hosting at a small-to-medium scale.

        Garage is designed for storage clusters composed of nodes running at different physical locations, in order to easily provide a storage service that replicates data at these different locations and remains available even when some servers are unreachable. Garage also focuses on being lightweight, easy to operate, and highly resilient to machine failures.

        ## Usage

        This template is designed for out-of-the-box usage. However, you still need to configure a few things before everything works.

        1. **Set your domain in the "Domain" tab after deployment**. The S3 API can be accessed from the `api` port, and the web UI can be accessed from the `web` port.
        2. **Change the secret key of the RPC service**. Run `openssl rand -hex 32` to generate a new secret key and paste it into the `GARAGE_RPC_SECRET` environment variable. It is strongly recommended to change the secret key before making the service public to ensure the security of the service, even if you are not going to use the RPC function.
        3. **Update `root_domain` in your configuration**. It should be `.<your-domain>`.

        If you need to connect other Garage instances from outside the network, you may need to configure the RPC public address. Edit the RPC public address in the config (Settings → Config Editor) to [the forwarded hostname and port](https://zeabur.com/docs/deploy/customize-prebuilt#ports) of the `rpc` port of this Garage instance.

        ## Upgrading

        To upgrade Garage to a newer version, change the image tag of the `garage` service. Remember to check the [release notes](https://git.deuxfleurs.fr/Deuxfleurs/garage/releases) before switching to a new version.
    services:
        - name: garage
          icon: https://git.deuxfleurs.fr/Deuxfleurs/garage/raw/commit/070a8ad110cb75dd2df7ddc9ecbb5c814291ac89/doc/logo/garage-notext.svg
          template: PREBUILT
          spec:
            id: garage
            source:
                image: dxflrs/garage:070a8ad110cb75dd2df7ddc9ecbb5c814291ac89
            ports:
                - id: api
                  port: 3900
                  type: HTTP
                - id: rpc
                  port: 3901
                  type: TCP
                - id: web
                  port: 3902
                  type: HTTP
            volumes:
                - id: metadata
                  dir: /var/lib/garage/meta
                - id: data
                  dir: /var/lib/garage/data
            env:
                GARAGE_RPC_SECRET:
                    default: b88dda626440ee3d6a3e7ac1a2ee234193c0cae4dea6ea033c6e7c1fffe45c27
            configs:
                - path: /etc/garage.toml
                  template: |
                    metadata_dir = "/var/lib/garage/meta"
                    data_dir = "/var/lib/garage/data"
                    db_engine = "lmdb"
                    metadata_auto_snapshot_interval = "6h"

                    replication_factor = 3

                    compression_level = 2

                    rpc_bind_addr = "[::]:3901"
                    # rpc_public_addr = "<rpc-forwarded-host>:<rpc-forwarded-port>"

                    [s3_api]
                    s3_region = "garage"
                    api_bind_addr = "[::]:3900"
                    root_domain = ".s3.garage"  # update it to your domain

                    [s3_web]
                    bind_addr = "[::]:3902"
                    root_domain = ".web.garage"  # update it to your domain
                  permission: null
                  envsubst: null
localization:
    ja-JP:
        description: セルフホスティング用に設計されたオープンソースの分散オブジェクトストレージサービス
        readme: |
            Garage は、S3 と互換性のある分散オブジェクトストレージサービスで、小規模から中規模のセルフホスティング向けに設計されています。

            Garage は、異なる場所にあるノードで構成されるストレージクラスターを構築し、軽量で操作が簡単で、エラーから自動的に回復することができます。これにより、ノード間でデータを簡単に複製し、部分的なサーバーダウン時でもストレージサービスを提供します。

            ## 使用法

            このテンプレートは即座に使用できるように設計されています。しかし、すべてが正常に動作する前に、いくつかの設定を行う必要があります。

            1. **デプロイ後の「ドメイン」ページでドメインを設定する**。S3 API は `api` ポートから、Web UI は `web` ポートからアクセスできます。
            2. **RPC サービスのキーを変更する**。`openssl rand -hex 32` を実行してキーを生成し、それを `GARAGE_RPC_SECRET` 環境変数に貼り付けます。RPC 機能を有効にするかどうかにかかわらず、サービスを公開する前にキーを変更してセキュリティを確保することをお勧めします。
            3. **設定の `root_domain` ブロックを更新する**。形式は `.<your-domain>` とします。

            ネットワーク外部から他の Garage インスタンスに接続する必要がある場合は、RPC パブリックアドレスを設定する必要があるかもしれません。設定で RPC パブリックアドレスを編集し（設定 → Config Editor）、この部分をこの Garage インスタンスの `rpc` ポートの[転送されるホスト名とポート](https://zeabur.com/docs/deploy/customize-prebuilt#ports)に設定します。

            ## アップグレード

            Garage の新しいバージョンにアップグレードするには、`garage` サービスのイメージタグを変更します。新しいバージョンに切り替える前に、[リリースノート](https://git.deuxfleurs.fr/Deuxfleurs/garage/releases)を確認してください。
    zh-CN:
        description: 一个专为自我讬管量身打造的开源分布式对象存储服务
        readme: |
            Garage 是一个与 S3 兼容的分布式对象存储服务，专为小至中型规模的自我讬管而设计。

            Garage 由位于不同地点的节点组成的存储集群所打造，轻量、易于操作，且能自行从错误恢复，使其能简单地在节点间复制数据并提供存储服务，即使是在部分服务器断线时。

            ## 使用

            此模板设计为开箱即用。但是，在一切正常运行之前，您仍需要配置一些内容。

            1. **在部署后的「域名」页签中设置您的域名**。S3 API 可从 `api` 连接端口取用，而 Web UI 可从 `web` 连接端口取用。
            2. **更改 RPC 服务的密钥**。执行 `openssl rand -hex 32` 生成一组密钥，并将其粘贴到 `GARAGE_RPC_SECRET` 环境变量中。无论是否开启 RPC 功能，都建议在将服务公开之前更改密钥，确保服务的安全。
            3. **更新设置中的 `root_domain` 区块**。格式应为 `.<your-domain>`。

            如果需要从网络外部连接其他 Garage 实体，您可能需要设置 RPC 公共地址。在设置中编辑 RPC 公共地址（设置 → Config Editor），将这部分设置成这个 Garage 实体的 `rpc` 连接端口[转发的主机名和连接端口](https://zeabur.com/docs/deploy/customize-prebuilt#ports)。

            ## 升级

            要升级到更新版本的 Garage，请更改 `garage` 服务的镜像标签。在切换到新版本之前，请记得查看[版本说明](https://git.deuxfleurs.fr/Deuxfleurs/garage/releases)。
    zh-TW:
        description: 一個專為自我寄存量身打造的開源分佈式物件儲存服務
        readme: |
            Garage 是一個與 S3 相容的分佈式物件儲存服務，專為小至中型規模的自我寄存而設計。

            Garage 為由位於不同地點的節點組成的儲存叢集所打造，輕量、易於操作，且能自行從錯誤恢復，使其能簡單地在節點間複製資料並提供儲存服務，即使是在部分伺服器斷線時。

            ## 使用

            此模板設計為開箱即用。但是，在一切正常運行之前，您仍需要配置一些內容。

            1. **在部署後的「網域」分頁中設定您的網域**。S3 API 可從 `api` 連線埠取用，而 Web UI 可從 `web` 連線埠取用。
            2. **更改 RPC 服務的金鑰**。執行 `openssl rand -hex 32` 產生一組金鑰，並將其貼到 `GARAGE_RPC_SECRET` 環境變數中。無論是否開啟 RPC 功能，都建議在將服務公開之前更改金鑰，確保服務的安全。
            3. **更新設定中的 `root_domain` 區塊**. 格式應為 `.<your-domain>`。

            如果需要從網路外部連接其他 Garage 實體，您可能需要設定 RPC 公用地址。在設定中編輯 RPC 公用地址（設定 → Config Editor），將這部分設定成這個 Garage 實體的 `rpc` 連線埠[轉送的主機名稱和連線埠](https://zeabur.com/docs/deploy/customize-prebuilt#ports)。

            ## 升級

            要升級到更新版本的 Garage，請更改 `garage` 服務的映像標籤。在切換到新版本之前，請記得查看[版本說明](https://git.deuxfleurs.fr/Deuxfleurs/garage/releases)。
