Bencher Compose
部署 Bencher 自托管 的最简单方法是使用 bencher
CLI 子命令的三联副本:
bencher up
:启动 Bencher 自托管容器。 这类似于运行docker compose up
。bencher logs
:查看 Bencher 自托管容器的输出, 如果bencher up
是使用 the--detach
flag 运行的。 这类似于运行docker compose logs
。bencher down
:停止并移除 Bencher 自托管容器, 如果bencher up
是使用 the--detach
flag 运行的。 这类似于运行docker compose down
。
bencher up
创建并启动 Bencher 自托管容器。
这类似于运行 docker compose up
。
bencher up [OPTIONS] [SERVICE]
服务
选择要运行的容器。可能的选项有:all
、api
和 console
。默认选择 all
。类似于 docker compose up
的 SERVICE
参数。
选项
--detach
以分离模式运行。
容器将在后台运行。
类似于docker compose up
的 --detach
标志。
--pull <WHEN>
在运行之前拉取镜像。
可能的选项有:always
、missing
和 never
。
默认情况下选择 always
。
类似于 docker compose up
的 --pull
选项。
--tag <TAG>
指定容器的镜像标签。
默认情况下,镜像标签与 bencher
CLI 版本匹配。
最新的 bencher
CLI 版本是 v0.4.36
。
--console-port <PORT>
为控制台服务器容器指定一个端口号。
默认情况下,使用端口 3000
。
类似于 docker run
的--expose
选项的仅端口形式。
--api-port <PORT>
为 API 服务器容器指定一个端口号。
默认情况下,使用端口 61016
。
类似于 docker run
的 --expose
选项 的仅端口形式。
--console-env <KEY_VALUE>
将环境变量传递给控制台服务器容器。预期格式为 KEY=value
。这在使用控制台服务器配置时很有用。类似于 docker run
的--env
选项。
--api-env <KEY_VALUE>
将环境变量传递给 API 服务器容器。
预期格式为 KEY=value
。
这在使用 API 服务器配置 时很有用。
类似于 docker run
的 --env
选项。
--console-volume <HOST_CONTAINER>
将挂载卷传递给控制台服务器容器。
预期格式为 /host/path:/container/path
。
这在使用控制台服务器配置时可能很有用。
类似于 docker run
的--volume
选项。
--api-volume <HOST_CONTAINER>
将挂载卷传递给 API 服务器容器。
预期格式为 /host/path:/container/path
。
这在使用 API 服务器配置 时很有用。
类似于 docker run
的 --volume
选项。
--help
打印帮助。
bencher logs
查看 Bencher 自托管容器的输出,
如果 bencher up
是与--detach
选项一起运行的。
这类似于运行 docker compose logs
。
bencher up [OPTIONS] [SERVICE]
服务
选择要运行的容器。
可能的选择有:all
、api
和 console
。
默认选择是 all
。
类似于docker compose logs
的 SERVICE
参数。
选项
--help
打印帮助。
bencher down
停止并移除 Bencher 自托管的容器,
如果 bencher up
时使用了 --detach
标志。
这类似于运行 docker compose down
。
bencher down [OPTIONS] [SERVICE]
服务
选择要运行的容器。
可以选择的项有:all
、api
和 console
。
默认选择all
。
类似于 docker compose down
的 SERVICE
参数。
选项
--help
打印帮助。
Docker Compose
services: bencher_api_compose: image: ghcr.io/bencherdev/bencher-api:latest container_name: bencher_api ports: - 61016:61016 volumes: # Mount the configuration directory - "./services/api/etc:/etc/bencher" # Mount the database directory - "./services/api/data:/var/lib/bencher/data" # environment: # Set configuration string or file path # - BENCHER_CONFIG= # - BENCHER_CONFIG_PATH=
bencher_console_compose: image: ghcr.io/bencherdev/bencher-console:latest container_name: bencher_console ports: - 3000:3000 environment: # Set the API URL to the localhost IPv4 address - BENCHER_API_URL=http://127.0.0.1:61016 # This is needed for Docker-to-Docker communication when using a local `BENCHER_API_URL` # Do not set this when using a remote `BENCHER_API_URL`, such as https://bencher.example.com - INTERNAL_API_URL=http://host.docker.internal:61016 depends_on: - bencher_api_compose