Browse documentation

FyroDB documentation

Docker

Run FyroDB with Docker and Docker Compose — KV engine and DB cache proxy.

Quick start

Start FyroDB with its data stored in a named Docker volume:

docker run -d --name fyrodb \
  -p 127.0.0.1:8000:8000 \
  -v fyrodb-data:/data \
  -e FYRODB_RDB_PATH=/data/fyrodb.rdb \
  rana718/fyrodb:latest

Check that it is ready and try a key using the Redis-compatible client inside the container:

docker exec fyrodb redis-cli -p 8000 PING
docker exec fyrodb redis-cli -p 8000 SET greeting "Hello from FyroDB"
docker exec fyrodb redis-cli -p 8000 GET greeting

Expected replies are PONG, OK, and Hello from FyroDB. The port mapping binds to localhost. For other machines to connect, choose a suitable network interface and access controls.

Save the current dataset and inspect logs when needed:

docker exec fyrodb redis-cli -p 8000 SAVE
docker logs -f fyrodb

Restart the container with docker restart fyrodb. The named volume retains /data across container replacement. To build the image from this checkout, run docker build -t fyrodb:local . and substitute fyrodb:local in the commands above.

Optional io_uring sends

The Linux image built from this checkout uses ordinary socket writes by default. To request io_uring batched sends, set this environment variable on the FyroDB service and recreate the container:

services:
  fyrodb:
    build: .
    ports:
      - "127.0.0.1:8000:8000"
    environment:
      FYRODB_IO_URING: "true"

Each worker checks a socket send through its ring at startup. If the kernel or container policy prevents setup or submission, the worker logs the reason and uses ordinary writes. Docker’s default seccomp profile blocks ring setup. If your deployment uses a profile that permits io_uring_setup and io_uring_enter, select that file under the service’s security_opt with seccomp=./your-profile.json. Docker seccomp documentation

Omit the variable or set it to "false" to disable ring setup.

Limit CPU and memory

For an isolated one-worker test, use a different container name and host port:

docker run -d --name fyrodb-limited \
  --cpus=1 --memory=512m \
  -p 127.0.0.1:8001:8000 \
  -e FYRODB_WORKERS=1 \
  rana718/fyrodb:latest
 
docker exec fyrodb-limited redis-cli -p 8000 PING

The --cpus quota limits total CPU time. Add --cpuset-cpus with a CPU available on your host if you also need to pin execution to a specific core.

With Persistent Data

docker run -d --name fyrodb \
  -p 8000:8000 \
  -v fyrodb-data:/data \
  -e FYRODB_RDB_PATH=/data/fyrodb.rdb \
  rana718/fyrodb:latest

Docker Compose (KV Only)

services:
  fyrodb:
    image: rana718/fyrodb:latest
    ports:
      - "8000:8000"
    environment:
      FYRODB_PORT: "8000"
      FYRODB_MAX_KEYS: "5000000"
      FYRODB_RDB_INTERVAL: "60"
      FYRODB_RDB_PATH: "/data/fyrodb.rdb"
    volumes:
      - fyrodb-data:/data
    restart: unless-stopped
    deploy:
      resources:
        limits:
          memory: 512M
 
volumes:
  fyrodb-data:

Docker Compose with DB Cache Proxy

Point your app at FyroDB's proxy port instead of directly at PostgreSQL. The first query for each pattern goes to Postgres; every subsequent identical query is served from memory — no database involved.

services:
  app:
    build: .
    depends_on:
      - fyrodb
      - postgres
    environment:
      # KV / Redis-compatible port for sessions, queues, rate limits
      REDIS_URL: redis://fyrodb:8000
      # Proxy port — identical PostgreSQL wire protocol, cached automatically
      DATABASE_URL: postgres://appuser:secret@fyrodb:5432/mydb
 
  fyrodb:
    image: rana718/fyrodb:latest
    ports:
      - "8000:8000"    # KV / Redis-compatible
      - "5432:5432"    # DB Cache Proxy (PostgreSQL wire protocol)
    environment:
      # KV engine
      FYRODB_PORT: "8000"
      FYRODB_MAX_KEYS: "5000000"
      FYRODB_RDB_PATH: /data/fyrodb.rdb
      # DB Cache Proxy
      FYRODB_PROXY_ENABLED: "true"
      FYRODB_PROXY_PORT: "5432"
      FYRODB_PROXY_UPSTREAM_URL: postgres://appuser:secret@postgres:5432/mydb
      FYRODB_PROXY_CACHE_TTL_MS: "30000"
      FYRODB_PROXY_TRUST_AUTH: "true"
    volumes:
      - fyrodb-data:/data
    restart: unless-stopped
 
  postgres:
    image: postgres:16
    environment:
      POSTGRES_USER: appuser
      POSTGRES_PASSWORD: secret
      POSTGRES_DB: mydb
    volumes:
      - pg-data:/var/lib/postgresql/data
 
volumes:
  fyrodb-data:
  pg-data:

Your app's DATABASE_URL changes from postgres://appuser:secret@postgres:5432/mydb to postgres://appuser:secret@fyrodb:5432/mydb. That is the entire migration — no code changes.

Cache-Only Mode (no upstream)

Use this when your application pre-warms the cache at startup and you want cache misses to be explicit errors rather than slow upstream fallbacks:

services:
  fyrodb:
    image: rana718/fyrodb:latest
    ports:
      - "8000:8000"
      - "5432:5432"
    environment:
      FYRODB_PROXY_ENABLED: "true"
      FYRODB_PROXY_PORT: "5432"
      FYRODB_PROXY_MODE: "cache-only"
      FYRODB_PROXY_TRUST_AUTH: "true"
      FYRODB_PROXY_CACHE_TTL_MS: "0"   # never expire — app controls invalidation

Custom Port (Redis-compatible 6379)

docker run -p 6379:6379 -e FYRODB_PORT=6379 rana718/fyrodb:latest

Standard Redis clients connect without specifying a port:

redis-cli
127.0.0.1:6379> SET key value
OK

Docker Compose with Your App (KV Only)

services:
  app:
    build: .
    depends_on:
      - fyrodb
    environment:
      REDIS_URL: "redis://fyrodb:8000"
 
  fyrodb:
    image: rana718/fyrodb:latest
    ports:
      - "8000:8000"
    volumes:
      - fyrodb-data:/data
    environment:
      FYRODB_RDB_PATH: "/data/fyrodb.rdb"
 
volumes:
  fyrodb-data:

Health Check

Both engines respond to standard health probes:

healthcheck:
  # KV engine
  test: ["CMD", "redis-cli", "-p", "8000", "PING"]
  # Or proxy engine (requires psql or pg_isready in the image)
  # test: ["CMD", "pg_isready", "-h", "localhost", "-p", "5432"]
  interval: 10s
  timeout: 5s
  retries: 3