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
.└── DockerfileSample Dockerfile
FROM valkey/valkey:latest
# Default Valkey portEXPOSE 6379
CMD ["valkey-server", "/etc/valkey/valkey.conf"]Recommended environment variables
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
requirepassandsavein your customvalkey.confor 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 to6379inside the container.
Health check (recommended)
valkey-cli -h 127.0.0.1 -p 6379 -a "$VALKEY_PASSWORD" pingDeployment on Klutch.sh
- Push your Dockerfile and any custom
valkey.confto GitHub. - In klutch.sh/app, create a new app and select GitHub as the source.
- Klutch.sh automatically detects the Dockerfile in the repository root.
- Choose TCP traffic and set the internal port to
6379. - Add environment variables for
VALKEY_PASSWORD, snapshot settings, and any config toggles. Mark secrets as sensitive. - Attach a persistent volume at
/datasized for your snapshots/AOF files. - 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 worldvalkey-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
/datavolume if storing persistence files.