Skip to content

[RFC]: Docker Support for Valkey Admin #204

@robmarlow

Description

@robmarlow

[RFC] Docker Support for Valkey Admin

Summary

This RFC proposes adding Docker support to Valkey Admin, enabling deployment as a containerized web application. The primary use case is running Valkey Admin in Kubernetes clusters to connect to in-cluster Valkey nodes, replacing Redis Insights as the cluster management interface.

Motivation

We need to deploy Valkey Admin in our Kubernetes environment to connect to in-cluster Valkey nodes. This will replace our current Redis Insights deployment, providing a modern web-based interface for managing Valkey clusters directly from within the cluster.

Design Proposal

Architecture

The Docker implementation will provide the web-based subset of Valkey Admin features (as mentioned in the README, some features like hotkeys and commandlogs require Electron). The container will run:

  1. WebSocket Server (port 8080): The backend server that handles Valkey connections
  2. Frontend Server (port 5173): Static file server for the React frontend

Technical Approach

Multi-Stage Docker Build

The Dockerfile will use a multi-stage build pattern for optimal image size and build efficiency:

Stage 1: Builder

  • Base: node:22-bookworm-slim
  • Copies package files first (for better layer caching)
  • Installs all dependencies via npm ci
  • Copies source code
  • Builds all components using npm run build:all

Stage 2: Production

  • Base: node:22-bookworm-slim (minimal runtime)
  • Installs serve globally for static file serving
  • Copies only built artifacts from builder stage:
    • apps/server/dist (server bundle)
    • apps/frontend/dist (frontend build)
    • apps/metrics/dist (metrics build)
    • apps/metrics/config.yml (metrics config)
  • Copies only necessary runtime dependencies:
    • @valkey/* (Valkey client libraries)
    • ws (WebSocket library)
    • long, protobufjs, @protobufjs (protobuf dependencies)
    • p-limit, ramda (utility dependencies)

Entrypoint Script

A shell script (docker-entrypoint.sh) will:

  • Start the WebSocket server in the background
  • Start the frontend static file server in the background
  • Handle graceful shutdown via signal trapping (TERM, INT)
  • Wait for both processes and clean up on exit

Docker Best Practices

  • .dockerignore file to exclude unnecessary files from build context
  • Optimized layer caching (package files copied before source)
  • Minimal production image (only runtime dependencies)
  • Proper signal handling for graceful container shutdown
  • Non-root user consideration (can be added in future if needed)

Files to Add

  1. Dockerfile: Multi-stage build configuration
  2. docker-entrypoint.sh: Startup and signal handling script
  3. .dockerignore: Exclude patterns for build context optimization
  4. README.docker.md (optional): Docker-specific documentation

Usage Example

# Build the image
docker build -t valkey-admin .

# Run the container
docker run -d \
  --name valkey-admin \
  -p 8080:8080 \
  -p 5173:5173 \
  valkey-admin

# Access the web interface
open http://localhost:5173

Kubernetes Deployment

The containerized version is designed to run in Kubernetes, connecting to in-cluster Valkey nodes via their service endpoints. This enables cluster operators to manage Valkey instances without requiring desktop application access.

Ports

  • 8080: WebSocket server (backend)
  • 5173: Frontend web server

Limitations

As noted in the README, the web version provides a subset of features. The following Electron-specific features will not be available:

  • Hotkeys
  • Commandlogs
  • Full desktop integration

This is expected and documented behavior.

Impact

Positive

  • ✅ Enables Kubernetes deployment for in-cluster Valkey management
  • ✅ Replaces Redis Insights with a modern Valkey-native interface
  • ✅ No breaking changes to existing functionality

Considerations

  • ⚠️ Web version has limited features (already documented - no hotkeys/commandlogs)
  • ⚠️ Additional maintenance for Docker-related files
  • ⚠️ Need to keep Dockerfile in sync with build process changes

Implementation Plan

  1. Create Dockerfile with multi-stage build
  2. Create docker-entrypoint.sh for process management
  3. Create .dockerignore for build optimization
  4. Test build and runtime behavior
  5. Update documentation (if needed)

Questions for Review

  1. Should we add health check endpoints for Kubernetes liveness/readiness probes?
  2. Should we support environment variables for configuration (e.g., default connection endpoints)?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions