Configuration

Runtime Files & State

Complete directory inventory of runtime files, locks, persistence schemas, and file permissions.

Runtime Files & Persistence Reference

HTTP PostgreSQL Gateway coordinates persistent state between local filesystem files and the administrative PostgreSQL database.


Filesystem State Inventory

All runtime files are placed relative to the gateway root directory:

PathPurposeBackup Policy
data/data.jsonStores admin password hash, API key metadata, database bindings, and role credential seeds.Essential. Encrypt and back up regularly.
data/data.json.lockSQLite lock file coordinating concurrent JsonDB writers.Ephemeral. Automatically managed by OS.
data/analytics/analytics.sqliteSQLite database storing query metrics and sanitized failed queries.Optional. Contains observability metrics.
logs/current.logSymlink to the active error log file.Audit/monitoring retention.
logs/failed.<date>.logError-level and fatal log events. Rotated daily or at 20 MiB.Audit/monitoring retention.
logs/api-keys.logAudit trail of API key creation, revocation, and scope edits.Retain according to security compliance.
Filesystem Permissions: The gateway creates runtime directories and files with restricted POSIX mode 0600 (readable/writable only by the service account). Never commit data/ or logs/ to version control.

SQLite Locking Semantics (data.json.lock)

When multiple gateway processes or workers access data/data.json:

  • Writers acquire an exclusive POSIX lock via data/data.json.lock.
  • Writers wait up to 5,000 ms before timing out with an error.
  • Updates use atomic rename (write to temp file -> rename) to prevent partial file corruption during sudden power loss or process kill.

PostgreSQL Internal Schema (http_postgres_gateway)

The gateway stores durable operational records inside the administrative PostgreSQL database under the dedicated schema http_postgres_gateway:

1. http_postgres_gateway.async_queries

Stores background query jobs submitted with type: "async".

  • Columns: id, api_key_id, database_name, status, created_at, finalized_at, outcome_payload.
  • Pruned automatically based on transactions.retentionDays.

2. http_postgres_gateway.transactions

Stores multi-statement atomic transactions submitted to POST /transaction/execute.

  • Columns: id, api_key_id, database_name, idempotency_key, fingerprint, status, completed_count, total_count, outcome_payload.
  • Retains idempotency tombstones after deletion for transactions.retentionDays.

Provisioning the Schema

The gateway automatically creates this schema on startup if the administrative user has database CREATE privilege. Alternatively, a DBA can pre-provision it:

CREATE SCHEMA http_postgres_gateway AUTHORIZATION gateway_admin;
Copyright © 2026