SKEG · OPERATE

Deployment

Choose storage and network boundaries for a deployment.

Skeg 0.8 · Development documentation

Run Skeg on a single node with a local filesystem that supports advisory locks. Assign each writable instance its own data directory and keep that directory on persistent storage. Use the Skeg server to make changes to the store. NFS and SMB are outside the supported storage setup.

Look up startup options and environment precedence in server configuration. For an existing store that needs conversion, follow upgrade a store.

Skeg does not provide replication or automatic failover. Multiple read-only processes over a completed store do not form a replicated service.

Plan for shutdown and recovery

A normal shutdown stops admission, drains accepted work and synchronises the shards. Give the supervisor time to complete that sequence. The setting SKEG_SHUTDOWN_TIMEOUT_MS bounds connection draining; it does not bound disk I/O or the total shutdown time. See operations for service examples.

Check the exit status and final logs. A non-zero exit means shutdown could not certify all its barriers. An acknowledgement during normal operation should not be confused with a successful final filesystem sync: recovery after a process crash and survival of power loss depend on the operation’s durability policy.

Follow backup and restore to copy a stopped store and check it before switching traffic. Keep the original binary with the backup; a newer on-disk format may not be readable by an older executable.

Container health

The image’s health check connects to the address on which Skeg is listening. The listener opens only after the shards have opened and recovery has finished. A successful check therefore tells you the listener is reachable after startup; it does not check every index or certify data integrity.

The server records its bound address in SKEG_LISTEN_FILE, set to /tmp/skeg.listen in the image. The check uses that address, falling back to SKEG_ADDR when the file is absent. This also handles an address supplied by --addr and IPv4 or IPv6 loopback.

The image allows a 120-second startup period before failed checks count towards its unhealthy status. Large stores may need longer to recover. Set your supervisor’s startup allowance accordingly.

Run an authenticated container

Download compose.yaml into a deployment directory. Place an existing account store at ./auth/auth.kdb beside it. Create an application login in its own tenant and an operator login in the ops tenant before starting the server. Edit SKEG_ADMIN_TENANT if your admin tenant has another name.

services:
  skeg:
    image: "ghcr.io/skegdb/skeg:${SKEG_VERSION:?Set SKEG_VERSION to a tested image tag}"
    environment:
      SKEG_ADDR: "0.0.0.0:6379"
      SKEG_DATA_DIR: /var/lib/skeg
      SKEG_TENANT_AUTH: /auth/auth.kdb
      SKEG_TENANT_STRICT: "1"
      SKEG_ADMIN_TENANT: ops
    volumes:
      - skeg-data:/var/lib/skeg
      - ./auth:/auth
    stop_grace_period: 2m

volumes:
  skeg-data:

The image runs as UID/GID 1000. Make the account file readable by that service user and keep the auth directory private. The directory must allow quota sidecar updates when you manage quotas. See authentication and tenants.

Set SKEG_VERSION to the image tag you have verified for your deployment. Then validate the Compose file and start the service:

docker compose config --quiet
docker compose up -d skeg
docker compose ps skeg

Expect the service to report healthy once the TCP check succeeds. If it stays unhealthy or exits, inspect docker compose logs skeg for startup or recovery errors. The named volume keeps the data when the container is replaced. Keep that volume when stopping or replacing the service.

An application in the same Compose network connects to skeg:6379 and authenticates each connection. The example leaves the database port unpublished on the host. In the application’s service definition, add this dependency if both services run in the same Compose project:

depends_on:
  skeg:
    condition: service_healthy

The dependency waits for the TCP check. Have the application confirm login and read a known key or index before routing traffic to it. See startup and recovery.

Stop the service with docker compose stop skeg. The grace period shown is an example. Set it from observed shutdown time on your deployment so the server can drain connections, join maintenance and sync its files. See graceful shutdown.

Tenant exposure and resource limits

Enable tenant authentication with --tenant-auth /auth/auth.kdb, --tenant-strict and --admin-tenant admin. Use unique production credentials, never example credentials. Restrict the auth store to its service account. The native listener is an unauthenticated single-tenant interface and belongs only on a trusted network. Bind the RESP3 backend to loopback when terminating TLS on the same host. Do not publish its plaintext port externally. A server configured with a tenant backend refuses to start on the native protocol.

Password checks use a bounded blocking pool shared by listeners and reserve their working set against the same memory governor as requests and maintenance. Saturation returns BACKPRESSURE before hashing; clients should use bounded backoff with a request deadline, not unbounded retries. Per-IP failed-login limits remain active. A TCP proxy makes its own source IP visible to the server, so apply connection limits at the proxy as well and account for shared-IP limits.

max_vectors and max_disk_bytes are enforced logical quotas. Set both for each tenant. Set a separate volume limit and monitor free space for graph files, logs, obsolete records and temporary maintenance files. On Linux, set and monitor the process memory limit through cgroups.

TLS proxy example

The HAProxy configuration terminates TLS on port 6380 and forwards to loopback port 6379. Install a certificate and its private key in the configured PEM file, restrict its permissions, and arrange certificate renewal. Run HAProxy in the same network namespace as the backend, or change the upstream to a private service address protected by firewall rules. Validate the installed configuration with haproxy -c -f /etc/haproxy/haproxy.cfg before reloading.

The proxy terminates TLS and limits concurrent connections. Keep strict tenant authentication enabled in Skeg. The proxy’s TCP check covers listener reachability. Use SKEG.CHECK <index> for index consistency diagnostics and SKEG.HEALTH <index> for maintenance state from an authenticated connection. Neither replaces application data checks; see index inspection.