Skip to content

Deploying a Valkey App

Introduction

Valkey is a high-performance, Redis-compatible in-memory data store. This guide shows how to containerize Valkey with a Dockerfile, secure it with a password, persist snapshots, and deploy it to Klutch.sh using TCP traffic.

Prerequisites

  • GitHub repository containing your Dockerfile.
  • Klutch.sh project ready in klutch.sh/app.

Project structure

.
└── Dockerfile

Sample Dockerfile

FROM valkey/valkey:latest
# Default Valkey port
EXPOSE 6379
CMD ["valkey-server", "/etc/valkey/valkey.conf"]
  • VALKEY_PASSWORD – strong password for client authentication.
  • VALKEY_PORT=6379 – internal port (default).
  • VALKEY_SAVE – snapshot policy, e.g., 900 1 300 10 60 10000.

Configure requirepass and save in your custom valkey.conf or pass them as environment variables and template the config.

Persistence

Persist RDB/AOF files to survive restarts:

  • Mount path: /data
  • Size: based on key volume and snapshot/AOF size

Networking

  • Protocol: TCP
  • Internal port: 6379
  • Clients connect to your TCP endpoint (e.g., example-app.klutch.sh:8000) while Klutch.sh routes to 6379 inside the container.
Terminal window
valkey-cli -h 127.0.0.1 -p 6379 -a "$VALKEY_PASSWORD" ping

Deployment on Klutch.sh

  1. Push your Dockerfile and any custom valkey.conf to GitHub.
  2. In klutch.sh/app, create a new app and select GitHub as the source.
  3. Klutch.sh automatically detects the Dockerfile in the repository root.
  4. Choose TCP traffic and set the internal port to 6379.
  5. Add environment variables for VALKEY_PASSWORD, snapshot settings, and any config toggles. Mark secrets as sensitive.
  6. Attach a persistent volume at /data sized for your snapshots/AOF files.
  7. Deploy. Connect from your applications using the TCP endpoint and VALKEY_PASSWORD.

Verification

  • Ping check from outside:

    Terminal window
    valkey-cli -h example-app.klutch.sh -p 8000 -a "$VALKEY_PASSWORD" ping
  • Write/read test:

    Terminal window
    valkey-cli -h example-app.klutch.sh -p 8000 -a "$VALKEY_PASSWORD" set hello world
    valkey-cli -h example-app.klutch.sh -p 8000 -a "$VALKEY_PASSWORD" get hello

Next steps

  • Tune snapshot policy or enable AOF for durability requirements.
  • Restrict network access to trusted clients.
  • Schedule backups of the /data volume if storing persistence files.