Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ WORKDIR /app
COPY Cargo.toml Cargo.lock ./
COPY pyproject.toml uv.lock setup.py README.md ./
COPY build_support/ build_support/
COPY bot/ bot/
COPY crates/ crates/
COPY openviking/ openviking/
COPY openviking_cli/ openviking_cli/
Expand All @@ -50,13 +51,13 @@ COPY third_party/ third_party/
RUN --mount=type=cache,target=/root/.cache/uv,id=uv-${TARGETPLATFORM} \
case "${UV_LOCK_STRATEGY}" in \
locked) \
uv sync --locked --no-editable \
uv sync --locked --no-editable --extra bot \
;; \
auto) \
if ! uv lock --check; then \
uv lock; \
fi; \
uv sync --locked --no-editable \
uv sync --locked --no-editable --extra bot \
;; \
*) \
echo "Unsupported UV_LOCK_STRATEGY: ${UV_LOCK_STRATEGY}" >&2; \
Expand All @@ -76,14 +77,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
WORKDIR /app

COPY --from=py-builder /app/.venv /app/.venv
COPY docker/openviking-console-entrypoint.sh /usr/local/bin/openviking-console-entrypoint
RUN chmod +x /usr/local/bin/openviking-console-entrypoint
ENV PATH="/app/.venv/bin:$PATH"
ENV OPENVIKING_CONFIG_FILE="/app/ov.conf"

EXPOSE 1933
EXPOSE 1933 8020

HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
CMD curl -fsS http://127.0.0.1:1933/health || exit 1

# Default runs server; override command to run CLI, e.g.:
# Default runs server + console; override command to run CLI, e.g.:
# docker run --rm <image> -v "$HOME/.openviking/ovcli.conf:/root/.openviking/ovcli.conf" openviking --help
CMD ["openviking-server"]
ENTRYPOINT ["openviking-console-entrypoint"]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,8 @@ openviking-server --with-bot
ov chat
```

If you use the official Docker image, `vikingbot` is already bundled in the image and starts by default together with the OpenViking server and console UI. You can disable it at runtime with either `--without-bot` or `-e OPENVIKING_WITH_BOT=0`.

---

## Server Deployment Details
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
container_name: openviking
ports:
- "1933:1933"
- "8020:8020"
volumes:
# Mount the configuration and data directory to persist state
- /var/lib/openviking/ov.conf:/app/ov.conf
Expand Down
102 changes: 102 additions & 0 deletions docker/openviking-console-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/bin/sh
set -eu

SERVER_URL="http://127.0.0.1:1933"
SERVER_HEALTH_URL="${SERVER_URL}/health"
CONSOLE_PORT="${OPENVIKING_CONSOLE_PORT:-8020}"
CONSOLE_HOST="${OPENVIKING_CONSOLE_HOST:-0.0.0.0}"
WITH_BOT="${OPENVIKING_WITH_BOT:-1}"
SERVER_PID=""
CONSOLE_PID=""

normalize_with_bot() {
case "$1" in
1|true|TRUE|yes|YES|on|ON)
WITH_BOT="1"
;;
0|false|FALSE|no|NO|off|OFF)
WITH_BOT="0"
;;
*)
echo "[openviking-console-entrypoint] invalid OPENVIKING_WITH_BOT=${1}" >&2
exit 2
;;
esac
}

if [ "$#" -gt 0 ]; then
for arg in "$@"; do
case "${arg}" in
--with-bot)
WITH_BOT="1"
;;
--without-bot)
WITH_BOT="0"
;;
*)
exec "$@"
;;
esac
done
fi

normalize_with_bot "${WITH_BOT}"

forward_signal() {
if [ -n "${SERVER_PID}" ] && kill -0 "${SERVER_PID}" 2>/dev/null; then
kill "${SERVER_PID}" 2>/dev/null || true
fi
if [ -n "${CONSOLE_PID}" ] && kill -0 "${CONSOLE_PID}" 2>/dev/null; then
kill "${CONSOLE_PID}" 2>/dev/null || true
fi
}

trap 'forward_signal' INT TERM

if [ "${WITH_BOT}" = "1" ]; then
openviking-server --with-bot &
else
openviking-server &
fi
SERVER_PID=$!

attempt=0
until curl -fsS "${SERVER_HEALTH_URL}" >/dev/null 2>&1; do
attempt=$((attempt + 1))
if ! kill -0 "${SERVER_PID}" 2>/dev/null; then
echo "[openviking-console-entrypoint] openviking-server exited before becoming healthy" >&2
wait "${SERVER_PID}" || true
exit 1
fi
if [ "${attempt}" -ge 120 ]; then
echo "[openviking-console-entrypoint] timed out waiting for ${SERVER_HEALTH_URL}" >&2
forward_signal
wait "${SERVER_PID}" || true
exit 1
fi
sleep 1
done

python -m openviking.console.bootstrap \
--host "${CONSOLE_HOST}" \
--port "${CONSOLE_PORT}" \
--openviking-url "${SERVER_URL}" &
CONSOLE_PID=$!

while kill -0 "${SERVER_PID}" 2>/dev/null && kill -0 "${CONSOLE_PID}" 2>/dev/null; do
sleep 1
done

if ! kill -0 "${SERVER_PID}" 2>/dev/null; then
wait "${SERVER_PID}" || SERVER_STATUS=$?
SERVER_STATUS=${SERVER_STATUS:-1}
forward_signal
wait "${CONSOLE_PID}" || true
exit "${SERVER_STATUS}"
fi

wait "${CONSOLE_PID}" || CONSOLE_STATUS=$?
CONSOLE_STATUS=${CONSOLE_STATUS:-0}
forward_signal
wait "${SERVER_PID}" || true
exit "${CONSOLE_STATUS}"
4 changes: 4 additions & 0 deletions docs/en/getting-started/02-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ If you prefer to run OpenViking as a standalone service, Docker is recommended.
container_name: openviking
ports:
- "1933:1933"
- "8020:8020"
volumes:
- ~/.openviking/ov.conf:/app/ov.conf
- ~/.openviking/data:/app/data
Expand All @@ -50,6 +51,8 @@ If you prefer to run OpenViking as a standalone service, Docker is recommended.
docker-compose up -d
```

By default, the container starts the OpenViking API server on `1933`, the Console UI on `8020`, and the bundled `vikingbot` gateway. If you need to disable `vikingbot`, add either `command: ["--without-bot"]` or `environment: ["OPENVIKING_WITH_BOT=0"]`.

> **💡 Mac Local Network Access Tip (Connection reset error):**
>
> By default, OpenViking only listens to `127.0.0.1` for security reasons. If you are using Docker on a Mac, your host machine may not be able to access it directly via `localhost:1933`.
Expand All @@ -61,6 +64,7 @@ If you prefer to run OpenViking as a standalone service, Docker is recommended.
> openviking:
> image: ghcr.io/volcengine/openviking:main
> ports:
> - "8020:8020"
> - "1933:1934" # Map host 1933 to container 1934
> volumes:
> - ~/.openviking/ov.conf:/app/ov.conf
Expand Down
36 changes: 36 additions & 0 deletions docs/en/guides/03-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,38 @@ OpenViking provides pre-built Docker images published to GitHub Container Regist
docker run -d \
--name openviking \
-p 1933:1933 \
-p 8020:8020 \
-v ~/.openviking/ov.conf:/app/ov.conf \
-v /var/lib/openviking/data:/app/data \
--restart unless-stopped \
ghcr.io/volcengine/openviking:main
```

By default, the Docker image starts:
- OpenViking HTTP server on `1933`
- OpenViking Console on `8020`
- `vikingbot` gateway

If you want to disable `vikingbot` for a specific container run, use either of the following:

```bash
docker run -d \
--name openviking \
-p 1933:1933 \
-p 8020:8020 \
-v ~/.openviking/ov.conf:/app/ov.conf \
-v /var/lib/openviking/data:/app/data \
--restart unless-stopped \
ghcr.io/volcengine/openviking:main \
--without-bot
```

```bash
docker run -d \
--name openviking \
-e OPENVIKING_WITH_BOT=0 \
-p 1933:1933 \
-p 8020:8020 \
-v ~/.openviking/ov.conf:/app/ov.conf \
-v /var/lib/openviking/data:/app/data \
--restart unless-stopped \
Expand All @@ -211,6 +243,10 @@ You can also use Docker Compose with the `docker-compose.yml` provided in the pr
docker compose up -d
```

After startup, you can access:
- API server: `http://localhost:1933`
- Console UI: `http://localhost:8020`

To build the image yourself: `docker build -t openviking:latest .`

### Kubernetes + Helm
Expand Down
4 changes: 4 additions & 0 deletions docs/zh/getting-started/02-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pip install openviking --upgrade --force-reinstall
container_name: openviking
ports:
- "1933:1933"
- "8020:8020"
volumes:
- ~/.openviking/ov.conf:/app/ov.conf
- ~/.openviking/data:/app/data
Expand All @@ -50,6 +51,8 @@ pip install openviking --upgrade --force-reinstall
docker-compose up -d
```

默认情况下,容器会同时启动 OpenViking API 服务(`1933`)、Console 界面(`8020`)以及内置的 `vikingbot` gateway。如果你需要关闭 `vikingbot`,可以在 Compose 里增加 `command: ["--without-bot"]`,或者设置 `environment: ["OPENVIKING_WITH_BOT=0"]`。

> **💡 Mac 本地网络访问提示 (Connection reset 报错):**
>
> 默认情况下,OpenViking 为了安全仅监听 `127.0.0.1`。如果你在 Mac 上使用 Docker,宿主机可能无法直接通过 `localhost:1933` 访问。
Expand All @@ -61,6 +64,7 @@ pip install openviking --upgrade --force-reinstall
> openviking:
> image: ghcr.io/volcengine/openviking:main
> ports:
> - "8020:8020"
> - "1933:1934" # 将宿主机 1933 映射到容器 1934
> volumes:
> - ~/.openviking/ov.conf:/app/ov.conf
Expand Down
36 changes: 36 additions & 0 deletions docs/zh/guides/03-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,38 @@ OpenViking 提供预构建的 Docker 镜像,发布在 GitHub Container Registr
docker run -d \
--name openviking \
-p 1933:1933 \
-p 8020:8020 \
-v ~/.openviking/ov.conf:/app/ov.conf \
-v /var/lib/openviking/data:/app/data \
--restart unless-stopped \
ghcr.io/volcengine/openviking:main
```

Docker 镜像默认会同时启动:
- OpenViking HTTP 服务,端口 `1933`
- OpenViking Console,端口 `8020`
- `vikingbot` gateway

如果你希望本次容器启动时关闭 `vikingbot`,可以使用下面任一方式:

```bash
docker run -d \
--name openviking \
-p 1933:1933 \
-p 8020:8020 \
-v ~/.openviking/ov.conf:/app/ov.conf \
-v /var/lib/openviking/data:/app/data \
--restart unless-stopped \
ghcr.io/volcengine/openviking:main \
--without-bot
```

```bash
docker run -d \
--name openviking \
-e OPENVIKING_WITH_BOT=0 \
-p 1933:1933 \
-p 8020:8020 \
-v ~/.openviking/ov.conf:/app/ov.conf \
-v /var/lib/openviking/data:/app/data \
--restart unless-stopped \
Expand All @@ -209,6 +241,10 @@ docker run -d \
docker compose up -d
```

启动后可以访问:
- API 服务:`http://localhost:1933`
- Console 界面:`http://localhost:8020`

如需自行构建镜像:`docker build -t openviking:latest .`

### Kubernetes + Helm
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ exclude = ["tests*", "docs*", "examples*"]
[tool.setuptools.package-data]
openviking = [
"prompts/templates/**/*.yaml",
"console/static/**/*",
"bin/agfs-server",
"bin/agfs-server.exe",
"lib/libagfsbinding.so",
Expand All @@ -199,7 +200,6 @@ vikingbot = [
"**/*.mjs",
"skills/**/*.md",
"skills/**/*.sh",
"console/static/**/*",
"bridge/**/*",
]

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ def finalize_options(self):
"lib/libagfsbinding.dll",
"bin/ov",
"bin/ov.exe",
"console/static/**/*",
"storage/vectordb/engine/*.abi3.so",
"storage/vectordb/engine/*.pyd",
],
Expand Down
Loading