Skip to content

fix(gateway): keep embedded gateway data in the server workspace - #6064

Open
ZaynJarvis wants to merge 1 commit into
mainfrom
fix/embedded-gateway-storage-in-workspace
Open

ZaynJarvis wants to merge 1 commit into
mainfrom
fix/embedded-gateway-storage-in-workspace

Conversation

@ZaynJarvis

Copy link
Copy Markdown
Collaborator

Problem

The embedded gateway (#5960) stores management.sqlite3 and kernel.sqlite3 in gateway.storage_path, which defaults to ~/.openviking/gateway. That is outside storage.workspace. When a container mounts its persistent volume on the workspace but not on $HOME, every redeploy loses all gateway upstreams, context profiles and gateway keys, while OpenViking's own data survives.

Seen on a Railway deployment: OPENVIKING_CONFIG_FILE=/app/mnt/ov.conf, storage.workspace=/app/mnt/data, volume on /app/mnt/, HOME=/app. The gateway wrote to /app/.openviking/gateway (container filesystem), and an Ark upstream disappeared after the next deploy. Studio's "Enable gateway" flow writes only {"enabled": true}, so it hits this default.

Fix

create_embedded_gateway now resolves the storage directory:

  1. An explicit gateway.storage_path (ov.conf or OPENVIKING_GATEWAY_STORAGE_PATH) always wins.
  2. If ~/.openviking/gateway already holds gateway databases, keep using it and log a warning, so upgrading never hides existing data (the stock Docker layout, HOME=/app with the volume on /app/.openviking, keeps working as before).
  3. Otherwise use {storage.workspace}/gateway.

Standalone gateways are unchanged. The zh/en operations guides describe the new default.

Tests

  • New: test_embedded_gateway_stores_data_in_the_server_workspace, test_embedded_gateway_keeps_data_already_in_the_home_directory, test_explicit_gateway_storage_path_wins (ov.conf value and environment variable).
  • tests/server/test_gateway_embedded.py: 8 passed. tests/gateway: no gateway code changed.

🤖 Generated with Claude Code

The embedded gateway stored its databases in ~/.openviking/gateway, outside
storage.workspace. A container that mounts its volume only on the workspace
(Railway with ov.conf on /app/mnt, for example) lost every upstream, profile
and gateway key on each redeploy, while OpenViking's own data survived.

Without an explicit gateway.storage_path (ov.conf or
OPENVIKING_GATEWAY_STORAGE_PATH), the embedded gateway now uses
{storage.workspace}/gateway. A server whose gateway already wrote to
~/.openviking/gateway keeps using that directory and logs a warning, so an
upgrade never hides existing data. Standalone gateways are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant