Forgejo Valkey Information

Information related to the Valkey cluster backing the Fedora deploy of the Forgejo gitforge.

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-openshift and also sysadmin-main access in order to access the os-control machines.

Cluster Overview

Installation

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.

Topology
3 master nodes + 3 replica nodes (one replica per master)
High Availability
  • Full slot coverage (16384 slots)

  • Automatic failover (replica → master promotion in < 30 s)

  • No single point of failure

Nodes (Openshift internal DNS)
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.