# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: ZProxy
spec:
    description: ZProxy is a SOCKS5 proxy that helps you access services deployed on Zeabur Dedicated Server without exposing them to the public Internet.
    variables:
        - key: ZEABUR_API_KEY
          type: STRING
          name: Zeabur API Key
          description: Get from https://zeabur.com/account/api-keys
        - key: ZEABUR_SERVER_ID
          type: STRING
          name: Zeabur Server ID
          description: Visit https://zeabur.com/servers, choose your server, and copy the id from the bottom-left corner
    tags:
        - Tool
        - Networking
        - Proxy
    readme: "# ZProxy\n\n[ZProxy](https://github.com/ImSingee/zproxy) is a SOCKS5 proxy that helps you access services deployed on **Zeabur Dedicated Server** without exposing them to the public Internet.  \n\n## Key environment variables\n- `AUTH_USERNAME`, `AUTH_PASSWORD`: SOCKS5 authentication  \n  - Default username: `zeabur`  \n  - Default password: generated randomly during deployment\n- `ZEABUR_API_KEY`: Zeabur API Key\n- `ZEABUR_SERVER_ID`: Zeabur Dedicated Server ID\n- `ZEABUR_UPDATE_INTERVAL`: Mapping refresh interval (default `5m`)\n\n## Usage examples\nAccess internal services via:  \n  `{service-name}.{project-name}.zeabur.cluster.local`  \n  **Note:** Domains must be **lowercase**.\n\n- Example 1 — LobeChat with a `logto` service (admin panel on port `3002`):  \n  Instead of exposing the admin panel to the Internet, configure the proxy and open:  \n  `logto.lobechat.zeabur.cluster.local:3002`\n\n- Example 2 — a `postgres` database inside the LobeChat project:  \n  With the proxy configured, connect locally via:  \n  `psql -h postgres.lobechat.zeabur.cluster.local`"
    services:
        - name: zproxy
          template: PREBUILT
          spec:
            id: zproxy
            source:
                image: ghcr.io/imsingee/zproxy:latest
            ports:
                - id: socks5
                  port: 1080
                  type: TCP
            instructions:
                - title: Proxy String
                  content: socks5h://${AUTH_USERNAME}:${AUTH_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${SOCKS5_PORT_FORWARDED_PORT}
                - title: SOCKS5 Addr
                  content: ${PORT_FORWARDED_HOSTNAME}:${SOCKS5_PORT_FORWARDED_PORT}
                - title: Auth Username
                  content: ${AUTH_USERNAME}
                - title: Auth Password
                  content: ${AUTH_PASSWORD}
            env:
                AUTH_PASSWORD:
                    default: ${PASSWORD}
                AUTH_USERNAME:
                    default: zeabur
                ZEABUR_UPDATE_INTERVAL:
                    default: 5m
localization:
    zh-CN:
        description: ZProxy 是一个 SOCKS5 代理，帮你访问部署在 Zeabur Dedicated Server 上的服务（无需暴露到公网）。
        variables:
            - key: ZEABUR_API_KEY
              type: STRING
              name: Zeabur API Key
              description: 访问 https://zeabur.com/account/api-keys 生成
            - key: ZEABUR_SERVER_ID
              type: STRING
              name: Zeabur 服务器 ID
              description: 访问 https://zeabur.com/servers，并选择你要部署本服务的服务器，然后从左下角复制
        readme: "# ZProxy\n\n[ZProxy](https://github.com/ImSingee/zproxy) 是一个 SOCKS5 代理，帮助你在不将服务暴露到公网的情况下访问部署在 **Zeabur Dedicated Server** 上的服务。  \n配置 `ZEABUR_API_KEY` 与 `ZEABUR_SERVER_ID` 可启用 Zeabur 服务映射与定期更新。\n\n## 关键环境变量\n- `AUTH_USERNAME`、`AUTH_PASSWORD`：SOCKS5 认证  \n  - 默认用户名：`zeabur`  \n  - 默认密码：部署时随机生成\n- `ZEABUR_API_KEY`：Zeabur API Key\n- `ZEABUR_SERVER_ID`：所部署到的 Zeabur Dedicated Server 的 Server ID\n- `ZEABUR_UPDATE_INTERVAL`：映射刷新间隔（默认 `5m`）\n\n## 使用示例\n通过以下域名直接访问内部服务：  \n  `{service-name}.{project-name}.zeabur.cluster.local`  \n  **注意：域名必须为小写**。\n\n- 示例 1 —— LobeChat 项目中的 `logto` 服务（管理面板端口 `3002`）：  \n  现在无需暴露到公网，配置好代理后直接访问：  \n  `logto.lobechat.zeabur.cluster.local:3002`\n\n- 示例 2 —— LobeChat 项目中的 `postgres` 数据库：  \n  配置好代理后，本地即可：  \n  `psql -h postgres.lobechat.zeabur.cluster.local`"
