Skip to content

Migrate SONiC from Redis to Valkey#6

Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1765906957-redis-to-valkey-migration
Open

Migrate SONiC from Redis to Valkey#6
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1765906957-redis-to-valkey-migration

Conversation

@devin-ai-integration
Copy link

Why I did it

Migrate SONiC's database infrastructure from Redis to Valkey. Valkey is a Redis-compatible fork that maintains protocol compatibility, allowing the swsscommon library to continue working without changes.

Work item tracking
  • Microsoft ADO (number only):

How I did it

Updated all Redis references to Valkey across the following components:

Core Infrastructure:

  • dockers/docker-database/Dockerfile.j2: Changed package installation from redis-tools/redis-server to valkey-tools/valkey-server, updated config path to /etc/valkey/valkey.conf
  • dockers/docker-database/supervisord.conf.j2: Updated server binary, config paths, socket paths, pidfile paths, and user from redis to valkey
  • dockers/docker-database/database_config.json.j2: Renamed all instances (redis→valkey, redis_chassis→valkey_chassis, redis_bmp→valkey_bmp, remote_redis→remote_valkey) and updated socket paths
  • dockers/docker-database/docker-database-init.sh: Updated all directory paths and user ownership from redis to valkey

Platform-Specific:

  • platform/vs/docker-sonic-vs/Dockerfile.j2: Updated package and config paths
  • platform/vs/docker-sonic-vs/database_config.json: Updated instance names and socket paths
  • platform/p4/docker-sonic-p4/Dockerfile.j2: Updated config path

Utility Scripts:

  • dockers/docker-database/flush_unused_database: Updated error message

How to verify it

  1. Build the docker-database container and verify valkey-server starts correctly
  2. Verify database connectivity through swsscommon
  3. Test warm boot restoration with the new valkey paths
  4. Test multi-ASIC and chassis configurations

Human Review Checklist:

  • Verify valkey-tools and valkey-server packages exist in Debian repositories with these exact names
  • Verify valkey package creates valkey user/group (required for chown commands)
  • Verify /etc/valkey/valkey.conf exists and has compatible format with the sed commands
  • Search codebase for any remaining redis references that may need updating

Which release branch to backport (provide reason below if selected)

  • 202205
  • 202211
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

Tested branch (Please provide the tested image version)

Description for the changelog

Migrate SONiC database infrastructure from Redis to Valkey for improved performance and community support.

Link to config_db schema for YANG module changes

N/A - No YANG model changes

A picture of a cute animal (not mandatory but encouraged)


Link to Devin run: https://cisco-demo.devinenterprise.com/sessions/d3987284456146bfb37715f4ed56312a
Requested by: Arthur Poon (arthur.poon@cognition.ai) / @arthurkkp-cog

This commit migrates the SONiC buildimage codebase from Redis to Valkey.
Valkey maintains Redis protocol compatibility, so the swsscommon library
continues to work without changes.

Changes include:
- Update Docker Database Container (Dockerfile.j2, supervisord.conf.j2)
  - Replace redis-tools/redis-server with valkey-tools/valkey-server
  - Update configuration paths from /etc/redis/ to /etc/valkey/
  - Update socket/pidfile paths from /var/run/redis/ to /var/run/valkey/

- Update Database Configuration (database_config.json.j2)
  - Rename instance 'redis' to 'valkey'
  - Rename instance 'redis_chassis' to 'valkey_chassis'
  - Rename instance 'redis_bmp' to 'valkey_bmp'
  - Rename instance 'remote_redis' to 'remote_valkey'
  - Update all socket paths accordingly

- Update Virtual Switch Platform (database_config.json, Dockerfile.j2)
  - Apply same redis->valkey naming changes
  - Update configuration paths

- Update P4 Platform (Dockerfile.j2)
  - Update configuration paths from /etc/redis/ to /etc/valkey/

- Update Database Initialization Script (docker-database-init.sh)
  - Rename REDIS_DIR to VALKEY_DIR
  - Update all path references from redis to valkey
  - Update user ownership from redis:redis to valkey:valkey

- Update Utility Scripts (flush_unused_database)
  - Update error message to reference Valkey instead of Redis

Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants