Installation & Configuration

Docker Compose deployment, native archives, OpenSSL TLS setup, and full server.json reference.

3 min read Getting Started

Deploy SpydDB (1.0.0) via Docker, prebuilt release binaries, or source compilation. Every protocol listener — SpydWire (5433), PostgreSQL wire (5432), HTTP/1.1 & Web Studio (8080), gRPC (grpc_bind), and Prometheus operational metrics (metrics_bind) — is configured in a single JSON configuration file (server.json).

Single Container Run#

For a first run, use the Docker Hub quickstart to generate the local TLS and authentication files automatically.

For an existing configuration, run these checks from the directory containing server.json and tls/. The container runs as UID/GID 999:999 and needs read access to the configuration and TLS files.

sh
test -f ./server.json && test -s ./tls/server.crt && test -s ./tls/server.key &&
docker run -d --name spyddb \
  --cap-drop ALL --cap-add IPC_LOCK \
  --ulimit memlock=-1:-1 \
  -p 127.0.0.1:5433:5433 -p 127.0.0.1:5432:5432 -p 127.0.0.1:8080:8080 \
  --mount type=volume,src=spyd-data,dst=/var/lib/spyd \
  --mount "type=bind,src=$PWD/server.json,dst=/etc/spyd/server.json,readonly" \
  --mount "type=bind,src=$PWD/tls,dst=/etc/spyd/tls,readonly" \
  nayem7663/spyddb:latest --config /etc/spyd/server.json

Dropping all capabilities and keeping only IPC_LOCK with unlimited memlock allows spyd-server to pin sensitive buffers with mlockall before relinquishing CAP_IPC_LOCK at startup.

Production-Style docker-compose.yml#

yaml
services:
  spyddb:
    image: nayem7663/spyddb:latest
    command: ["--config", "/etc/spyd/server.json"]
    ports:
      - "127.0.0.1:5433:5433"
      - "127.0.0.1:5432:5432"
      - "127.0.0.1:8080:8080"
    volumes:
      - spyd-data:/var/lib/spyd
      - type: bind
        source: ./server.json
        target: /etc/spyd/server.json
        read_only: true
        bind:
          create_host_path: false
      - type: bind
        source: ./tls
        target: /etc/spyd/tls
        read_only: true
        bind:
          create_host_path: false
    cap_drop:
      - ALL
    cap_add:
      - IPC_LOCK
    ulimits:
      memlock:
        soft: -1
        hard: -1
    healthcheck:
      test: ["CMD", "curl", "-fsS", "--cacert", "/etc/spyd/tls/ca.crt", "https://127.0.0.1:8080/v1/health"]
      interval: 10s
      timeout: 3s
      retries: 5

volumes:
  spyd-data:

Option 2: Prebuilt Native Binaries#

SpydDB ships native archives for Linux (x86_64 / aarch64), macOS (arm64 / x86_64), and Windows (x86_64) containing spyd-server and spyd-cli:

sh
# Start the server with an explicit config file
./spyd-server --config /etc/spyd/server.json

# Or run local embedded queries directly without a network listener
./spyd-cli --data-dir ./spyd-data --query 'system | stats catalog'

Option 3: Local Docker Dev Stack (Auto TLS)#

Use the included bootstrap script for local development with self-signed TLS certs (ca.crt, server.crt, server.key) and a generated bearer token:

sh
./docker/dev-up.sh
Environment VariableDefaultPurpose
SPYD_WIRE_PORT5433Host port mapped to SpydWire (SPD2 + TLS)
SPYD_PG_PORT5432Host port mapped to PostgreSQL wire v3
SPYD_HTTP_PORT8080Host port mapped to HTTPS JSON API & /studio
SPYD_CONFIG./docker/server.jsonHost configuration JSON file mounted read-only
SPYD_TLS_DIR./docker/tlsDirectory containing TLS certificates
SPYD_LOGinfoRUST_LOG verbosity level

Generating TLS Certificates (OpenSSL)#

Non-loopback listeners and "environment": "production" refuse to start without TLS:

sh
mkdir -p tls && umask 077
openssl genrsa -out tls/ca.key 4096
openssl req -x509 -new -nodes -key tls/ca.key -sha256 -days 3650 \
  -subj "/CN=SpydDB Local CA" -out tls/ca.crt

openssl genrsa -out tls/server.key 2048
openssl req -new -key tls/server.key -subj "/CN=localhost" -out tls/server.csr
cat > tls/san.ext <<'EOF'
subjectAltName=DNS:localhost,IP:127.0.0.1
keyUsage=digitalSignature,keyEncipherment
extendedKeyUsage=serverAuth
EOF
openssl x509 -req -in tls/server.csr -CA tls/ca.crt -CAkey tls/ca.key -CAcreateserial \
  -out tls/server.crt -days 825 -sha256 -extfile tls/san.ext
chmod 600 tls/*.key

Trusting the Local CA in Chrome / Chromium (Linux)#

To eliminate the browser's Not secure warning when opening https://127.0.0.1:8080/studio/ with your local development CA, import tls/ca.crt into the user NSS certificate store and restart Chrome:

sh
certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n "SpydDB Local CA" -i tls/ca.crt

Complete server.json Reference#

json
{
  "environment": "production",
  "data_dir": "/var/lib/spyd/data",
  "bind_address": "0.0.0.0",
  "port": 5433,
  "pgwire_bind": "0.0.0.0:5432",
  "http_bind": "0.0.0.0:8080",
  "grpc_bind": "0.0.0.0:4317",
  "metrics_bind": "127.0.0.1:9090",
  "tls": {
    "certificate": "/etc/spyd/tls/server.crt",
    "private_key": "/etc/spyd/tls/server.key",
    "client_ca": "/etc/spyd/tls/ca.crt",
    "mtls": false
  },
  "lock_memory": true,
  "max_connections": 512,
  "copy_directory": "/var/lib/spyd/copy",
  "backup_root": "/var/lib/spyd/backups",
  "key_root": "/etc/spyd/keys",
  "wal_archive_dir": "/var/lib/spyd/wal-archive",
  "wal_archive_interval_secs": 5,
  "tiering_interval_secs": 30,
  "hot_cold_threshold_secs": 86400,
  "tiering_batch_rows": 128,
  "materialized_refresh_interval_secs": 60,
  "version_gc_interval_secs": 60,
  "version_retention_secs": 604800,
  "audit_segment_bytes": 67108864,
  "audit_retention_secs": 220752000,
  "audit_min_sealed_segments": 1,
  "columnar_zone_maps": true,
  "columnar_vectorized": true,
  "http_max_body_bytes": 8388608,
  "http_max_response_bytes": 67108864,
  "http_request_timeout_secs": 30,
  "http_cors_origins": ["https://studio.example.com"],
  "cluster_allowed_cidrs": ["10.20.0.0/16"],
  "max_fleet_subscribers": 256,
  "max_cluster_proxy_requests": 32,
  "alert_eval_interval_secs": 15,
  "tail_sampling": {
    "enabled": true,
    "keep_errors": true,
    "min_latency_ms": 250,
    "baseline_rate": 0.1,
    "max_buffered_traces": 4096
  },
  "storage": {
    "encryption_key_path": "env:SPYDDB_STORAGE_KEY"
  },
  "security": {
    "column_encryption_enabled": true,
    "master_key_path": "env:SPYDDB_COLUMN_KEYRING",
    "multi_tenant_enabled": true
  },
  "realtime": {
    "auto_enable_local_journal": true
  },
  "tokens": [
    {
      "token": "env:SPYD_ADMIN_TOKEN",
      "user": "admin",
      "roles": ["admin"]
    }
  ]
}

Key Configuration Fields#

Section / KeyPurpose
bind_address / portSpydWire listener (default 5433)
pgwire_bindPostgreSQL wire v3 listener (typically 5432)
http_bindHTTP/1.1 REST API, OTLP HTTP & Embedded Studio /studio (typically 8080)
grpc_bindOTLP/gRPC (TraceService, MetricsService, LogsService) & gRPC query listener
metrics_bindOperational listener serving /metrics (Prometheus) and /readyz
backup_root / key_root / copy_directoryConfined directory roots required before online backup, key rotation, or COPY file routes become active
http_cors_originsAllowed CORS origins for browser clients calling HTTP endpoints
cluster_allowed_cidrsExplicit CIDR allowlist further constraining linked cluster connections
max_fleet_subscribersCap on concurrent /v1/cluster/telemetry/stream and /v1/cluster/fleet/stream subscribers (256, 1..=100000)
max_cluster_proxy_requestsMaximum concurrent X-Spyd-Cluster proxied requests (32, 1..=10000)
fleet_publishReverse-dial NAT/firewall publishing config (hub_url, token, name, optional ca_cert_pem, certificate_pin) — see Multi-Cluster Fleet & Security Sync
tiering_interval_secs / hot_cold_threshold_secsEnables automatic age-based hot-row to cold-column migration
tail_samplingControls tail-based trace retention for slow and failing OTLP spans
realtime.auto_enable_local_journalAuto-activates the local commit journal on first SSE/gRPC/SpydWire live subscription (required for Studio Live mode; defaults to false)