Forgejo Valkey Information
Overview
This document covers everything you need to know about the production-ready 6-node Valkey cluster used by Forgejo (and any other application).
Contact Information
- Owner
-
Fedora Infrastructure Team
- Contact
-
#fedora-admin, sysadmin-main, sysadmin-forge
- Purpose
-
Provide basic orientation and introduction to the sysadmin group
Requirements
-
Administration of Forgejo requires group
sysadmin-openshiftand alsosysadmin-mainaccess in order to access theos-controlmachines.
Cluster Overview
The installation of the Valkey cluster is handled via a task/config contained inside the Forgejo ansible role. It might be worth breaking this out to its own role if Valkey is useful elsewhere in infra.
3 master nodes + 3 replica nodes (one replica per master)
-
Full slot coverage (16384 slots)
-
Automatic failover (replica → master promotion in < 30 s)
-
No single point of failure
valkey-0.forgejo.default.svc.cluster.local:6379 (master) valkey-1.forgejo.default.svc.cluster.local:6379 (master) valkey-2.forgejo.default.svc.cluster.local:6379 (master) valkey-3.forgejo.default.svc.cluster.local:6379 (replica of 0) valkey-4.forgejo.default.svc.cluster.local:6379 (replica of 1) valkey-5.forgejo.default.svc.cluster.local:6379 (replica of 2)
Why all 6 nodes? → Maximum resilience at application startup and during rolling restarts.
Forgejo app.ini Example
These values are edited in the file roles/openshift-apps/forgejo/templates/values.yml. Run the playbooks/openshift-apps/forgejo.yml playbook to roll out the changes.
cache:
TYPE: redis
CONN_STR: "redis+cluster://:{{ (env == 'production') | ternary(forgejo_valkey_password, forgejo_stg_valkey_password) }}@valkey-0.forgejo.default.svc.cluster.local:6379,valkey-1.forgejo.default.svc.cluster.local:6379,valkey-2.forgejo.default.svc.cluster.local:6379,valkey-3.forgejo.default.svc.cluster.local:6379,valkey-4.forgejo.default.svc.cluster.local:6379,valkey-5.forgejo.default.svc.cluster.local:6379/0"
Quick Health Checks
# One-liner status
redis-cli -c -h valkey-0.forgejo.default.svc.cluster.local -p 6379 -a MySuperSecret123 cluster info | grep -E 'cluster_state|cluster_known_nodes'
# Full node list
redis-cli -c -h valkey-0.forgejo.default.svc.cluster.local -p 6379 -a MySuperSecret123 cluster nodes
# Write/read test
redis-cli -c -h valkey-0.forgejo.default.svc.cluster.local -p 6379 -a MySuperSecret123 set grokky:test "meow" EX 60
redis-cli -c -h valkey-5.forgejo.default.svc.cluster.local -p 6379 -a MySuperSecret123 get grokky:test
Compatibility Note
Valkey is 100% wire-compatible with Redis 7.2/8.0. All Redis tools (redis-cli, redis-benchmark, StackExchange.Redis, ioredis, go-redis, etc.) work unchanged.
Want to help? Learn how to contribute to Fedora Docs ›