Database Reference
p2pstream stores server state in SQLite unless DATABASE_URL points somewhere else.
Exact Fields And Defaults
When DATABASE_URL is unset, the database path is:
${CONFIG_DIR}/p2pstream.dbDocker sets:
CONFIG_DIR=/dataSo the default Compose database path is:
/data/p2pstream.dbSQLite is opened with WAL journal mode, synchronous normal, busy timeout 10000 ms, foreign keys enabled, and private cache.
Validation Rules
- Backups should include
p2pstream.db,p2pstream.db-wal, andp2pstream.db-shm. - Do not edit the database by hand while the server is running.
- If
DATABASE_URLis empty, p2pstream createsCONFIG_DIRand the certs directory with0700permissions.
Runtime Effects
Conceptual table groups:
| Area | Tables |
|---|---|
| Auth | users, sessions, management_access_tokens |
| Agents | agents, connections, agent_stats |
| Environments | environments |
| Public proxy | public_listeners, public_routes, public_route_targets, public_agent_labels, public_response_templates |
| Target headers | public_route_target_upstream_headers, public_route_target_response_headers |
| TLS | public_tls_certificates, public_tls_dns_credentials |
| Controls | public_rate_limit_rules, public_waf_captcha_providers, public_waf_rules, public_waf_settings, public_traffic_shaper_rules, public_cache_settings, public_cache_rules, public_cache_entries |
| Observability | proxy_request_events |
Upgrades migrate old public backend configuration into route targets and then drop the old backend config tables. public_waf_settings stores the cookie signing secret used for WAF pass, admission, and queue cookies. proxy_request_events includes WAF, cache, route, route target, agent, byte, status, and duration fields. The route-target-only migration resets proxy request events and proxy rollups instead of retaining legacy backend IDs. agent_stats includes reported agent CPU percentage for dashboard summaries and automatic WAF activation, and agent stats history is not reset by that proxy observability migration.
Examples
Backup files:
p2pstream.db
p2pstream.db-wal
p2pstream.db-shm
certs/Explicit SQLite URL for local recovery commands:
p2pstream users reset-password admin \
--database-url 'file:/var/lib/p2pstream/p2pstream.db?mode=rwc'