# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Valkey
spec:
    description: Valkey is a high-performance in-memory database compatible with Redis.
    icon: https://cdn.zeabur.com/valkey.svg
    tags:
        - Database
    readme: |-
        ## What is Valkey?

        Valkey is a community-driven fork of Redis, offering the same powerful in-memory data structures with open governance. It's designed to be fast, reliable, and fully compatible with Redis clients and protocols.

        ## Environment Variables

        - `${VALKEY_CONNECTION_STRING}`: The connection string for the Valkey service.
        - `${VALKEY_HOST}`: The hostname of the Valkey service.
        - `${VALKEY_PORT}`: The port of the Valkey service.
        - `${VALKEY_PASSWORD}`: The password for the Valkey service.

        After you deploy the Valkey service, Zeabur will automatically inject the relevant environment variables into other services.

        You can also find the connection information in the “Instructions” section on the console.

        ## Connecting to the Database

        - [Redis CLI](https://docs.redis.com/latest/rs/references/cli-utilities/redis-cli/)

        ### redis-cli

        [redis-cli](https://docs.redis.com/latest/rs/references/cli-utilities/redis-cli/) is a command-line tool that allows you to interact with the Valkey database. Using redis-cli, you can execute Redis-compatible commands in the terminal or interactive mode.

        After downloading and installing according to the documentation, return to Zeabur. Click on the Instructions tab in the Valkey service, and click the copy button for `Command to connect to your Valkey` to copy the connection address.

        Paste the copied command into the terminal and enter `PING` to test if the connection is successful:

        ```
        PONG
        ```

        At this point, you can start operating Valkey.
    services:
        - name: valkey
          icon: https://cdn.zeabur.com/valkey.svg
          template: PREBUILT
          spec:
            source:
                image: zeabur/bitnami-valkey:8.1.3
            ports:
                - id: database
                  port: 6379
                  type: TCP
            volumes:
                - id: data
                  dir: /data
            instructions:
                - title: Command to connect to your Valkey
                  content: redis-cli -h ${PORT_FORWARDED_HOSTNAME} -p ${DATABASE_PORT_FORWARDED_PORT} -a ${VALKEY_PASSWORD}
                - title: Valkey Connection String
                  content: redis://:${VALKEY_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}
                - title: Valkey password
                  content: ${VALKEY_PASSWORD}
                - title: Valkey host
                  content: ${PORT_FORWARDED_HOSTNAME}
                - title: Valkey port
                  content: ${DATABASE_PORT_FORWARDED_PORT}
            env:
                VALKEY_CONNECTION_STRING:
                    default: redis://:${VALKEY_PASSWORD}@${VALKEY_HOST}:${VALKEY_PORT}
                    expose: true
                VALKEY_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                VALKEY_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                VALKEY_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
                VALKEY_URI:
                    default: ${VALKEY_CONNECTION_STRING}
                    expose: true
localization:
    zh-CN:
        description: Valkey 是一个由社区维护的 Redis 兼容型高性能内存数据库。
        readme: |
            ## 什么是 Valkey？

            Valkey 是一个由 Redis 分支出来的开源项目，提供与 Redis 完全兼容的数据结构和协议，致力于建立一个开放治理、社区驱动的替代方案。它是一款高性能、可靠的内存数据库，适用于缓存、消息队列、会话存储等多种场景。

            ## 环境变量

            - `${VALKEY_CONNECTION_STRING}`：Valkey 服务的连接字符串。
            - `${VALKEY_HOST}`：Valkey 服务的主机名。
            - `${VALKEY_PORT}`：Valkey 服务的端口号。
            - `${VALKEY_PASSWORD}`：Valkey 服务的密码。

            部署 Valkey 服务后，Zeabur 会自动将相关环境变量注入到其他服务中。

            你也可以在控制台的“操作指南”中查看完整的连接信息。

            ## 连接到数据库

            你可以使用任何 Redis 兼容的客户端（命令行或程序库）连接到 Valkey。

            ### redis-cli

            [redis-cli](https://docs.redis.com/latest/rs/references/cli-utilities/redis-cli/) 是一个命令行工具，允许你与 Redis 或 Valkey 数据库进行交互。使用 redis-cli，你可以在命令行终端中输入指令来查询或修改数据。

            ```
            redis-cli -h ${PORT_FORWARDED_HOSTNAME} -p ${DATABASE_PORT_FORWARDED_PORT} -a ${VALKEY_PASSWORD}
            ```

            输入 `PING` 来测试是否连接成功：

            ```
            PONG
            ```
    zh-TW:
        description: Valkey 是一個由社群主導的 Redis 相容型高效能記憶體資料庫。
        readme: |-
            ## Valkey 是什麼？

            Valkey 是 Redis 的一個開源分支，提供與 Redis 完全相容的協定與資料結構，致力於建立一個開放治理、社群參與的替代方案。它是一款快速、穩定的記憶體資料庫，廣泛應用於快取、訊息佇列、工作階段儲存等場景。

            ## 環境變數

            - `${VALKEY_CONNECTION_STRING}`：Valkey 服務的連線字串。
            - `${VALKEY_HOST}`：Valkey 服務的主機名稱。
            - `${VALKEY_PORT}`：Valkey 服務的連接埠。
            - `${VALKEY_PASSWORD}`：Valkey 服務的密碼。

            當你部署 Valkey 服務後，Zeabur 會自動將相關的環境變數注入到其他服務中。

            ## 連線到資料庫

            你可以使用任何支援 Redis 協定的客戶端（命令列工具或程式庫）來連線 Valkey。

            ### redis-cli

            [redis-cli](https://docs.redis.com/latest/rs/references/cli-utilities/redis-cli/) 是一款命令列工具，可讓你與 Redis 或 Valkey 資料庫互動。

            ```
            redis-cli -h ${PORT_FORWARDED_HOSTNAME} -p ${DATABASE_PORT_FORWARDED_PORT} -a ${VALKEY_PASSWORD}
            ```

            執行 `PING` 檢查連線是否成功：

            ```
            PONG
            ```

            若成功回應，即表示你可以開始使用 Valkey。
