Databases, Storage & Backups

Stravia stores relational metadata in SQLite or PostgreSQL, runtime cache in memory or Redis, and uploaded/generated media artifacts on local disk or S3-compatible object storage. Instance settings are managed in server.toml and System → Settings (/settings, organized into General, Network, Data, Account, and Advanced groups via ?view=).

Stravia Settings page showing system configuration sections

Prerequisites

  • For PostgreSQL deployments: A reachable PostgreSQL database and a dedicated Redis ≥ 6.2 instance configured with noeviction (and protected with network isolation, ACLs, and TLS).

Steps

1. Choose SQLite (default) or PostgreSQL + Redis

  • SQLite (default): Stores data at <data-dir>/db/gateway.db with WAL mode (32 MiB auto-checkpoint threshold, synchronous=FULL, 8 MiB per-connection page cache, 128 MiB mmap_size, FIFO write lease queue for writers while reads run concurrently) and an in-process 16 MiB TinyUFO runtime cache. No Redis is needed.
  • PostgreSQL + Redis: Server requires [cache] redis_url when backend = "postgres". If redis_url is missing, invalid, or unreachable at startup, Server fails immediately without falling back to SQLite. Before running /setup, pre-populate [cache] in <data-dir>/server.toml (or write the full [database] + [cache] config for existing deployments):
[database]
backend = "postgres"
url = "postgresql://stravia@127.0.0.1:5432/stravia"
max_connections = 10
min_connections = 1

[cache]
capacity_mb = 16
redis_url = "redis://127.0.0.1:6379/0"
toml
Redis boundary

Redis serves only as a runtime cache (not a durable history backup, cluster store, or multi-instance coordinator). Under PostgreSQL mode, Credential Protection mapping snapshots also enter Redis—isolate and secure Redis accordingly.

2. Configure Artifact storage (Local vs. S3)

Uploaded files and generated images are stored under <data-dir>/artifacts by default, or in an external S3-compatible bucket configured under Settings → Data → Artifacts:

  • Configure Endpoint, Region, Bucket, Access key / Secret key (and optional session token), plus Client base URL (client_base_url).
  • S3 requests bypass outbound proxies (outbound_proxy).
  • When enabling External signed downloads, clients or upstream providers must be able to reach the S3 endpoint directly (saving settings does not verify S3 reachability). Changing S3 settings records new location metadata for new artifacts; existing artifacts remain tied to their recorded storage origin and are not auto-migrated.

3. Configure Outbound proxies, Updates, Platform tasks, Currency, and Retention

  • Outbound proxies (Settings → Network → Proxy):
    • outbound_proxy stores a named list {"proxies": [{"id", "name", "url"}]} accepting http://, https://, socks5://, and socks5h:// (explicit non-zero port required; no path, query, or fragment; Core resolves DNS locally for socks5:// and proxy-side for socks5h://). Legacy bypass and force_http1 fields were removed in v0.7.8.
    • System proxy detection (GET /api/v1/settings/outbound-proxy/system): Displays the sanitized detected proxy—OS proxy settings on Desktop (os) or process proxy environment variables on Server (env).
    • Exit IP probe (POST /api/v1/settings/outbound-proxy/probe): Click Probe IP on System proxy or any saved proxy to check exit IPs across 10 AI service domains (anthropic.com, claude.ai, chatgpt.com, openai.com, sora.com, grok.com, pixpix.com, perplexity.ai, midjourney.com, mistral.ai; 6-second timeout) grouped by exit IP.
    • Per-consumer selection (proxy_mode): Each Provider, Web Provider, and the Updater (update_proxy_mode) independently selects Use system proxy (system, default for new connections), No proxy (none), or a saved proxy ID. Deleting a proxy that is still referenced by any consumer is rejected until those consumers switch away.
  • Updates (Settings → General → Updates):
    • Update channel (PUT /api/v1/updates/channel): Switch between Release (release, stable builds only) and Beta (beta, includes prereleases). The default is inferred from the installed version and persisted across upgrades; switching back to Release clears cached prerelease metadata and staged prerelease packages. The official plugin marketplace source follows this channel automatically.
    • Update proxy (update_proxy_mode): Select system, none, or a saved proxy for update checks and downloads.
  • Platform tasks (Settings → General, GET/PUT /api/v1/platform-llm): Choose an enabled inference route (with at least one enabled target) as the Platform task model for internal tasks such as automatic Console Chat conversation title generation.
  • Currency (Settings → General, GET/PUT /api/v1/currency): Configure a custom display currency and exchange rate once; subsequent rates do not retroactively reprice frozen historical attempt costs.
  • History retention (Settings → Data, log_retention_days, default 7 days, minimum 1 day): Governs Interaction Observations, Turn Chains, Rejected Requests, Credential Protection mapping expiration, and public tool-execution records (counted independently from each record's terminal time). Changing this setting triggers background batch cleanup—it does not erase 15-minute Usage analytics (/stats) or Debug traces/archives prematurely.
  • About (Settings → General → About): Shows edition/license status (GET /api/v1/capabilities), plus links to the official website, documentation, GitHub repository, Bilibili, QQ group (1125500160), and WeChat Official Account (Stravia).

4. Back up consistently

Stop the running Stravia instance (or ensure consistent DB snapshots) before backing up:

  1. <data-dir>/db/gateway.db (or pg_dump for PostgreSQL).
  2. <data-dir>/server.toml, <data-dir>/plugins/, and <data-dir>/artifacts/ (plus your S3 bucket if external).
  3. Exclude <data-dir>/cache/ (wasmtime-images, plugin-admissions)—caches are rebuilt automatically.

Verify

  1. Open System → Settings and confirm your saved proxies, system proxy detection, update channel, artifact base URL, and retention days (≥ 1).
  2. Confirm /readyz returns 200 after restarting with your database/cache configuration.

Troubleshooting

  • Cannot delete a saved proxy: Stravia refuses deletion while any provider, web provider, or Update proxy references it (Cannot delete proxy "<name>": currently used by ...). Switch those consumers to system, none, or another proxy first.
  • PostgreSQL startup error PostgreSQL requires cache.redis_url: Add [cache] redis_url = "..." to server.toml and verify Redis ≥ 6.2 connectivity.
  • Content missing after migrating data directory: Remember content-addressed bodies in SQL contents (stravia.content.v1) are shared across Turn Chains and Observations within a principal; always back up the entire database rather than exporting isolated tables.

Next