[18.7] Only check optional ActionCable Redis instance if necessary

What does this MR do and why?

This backports !219019 (merged) to 18-7-stable-ee.

!214008 (merged) added Gitlab::Redis::ActionCable to ALL_CLASSES, which caused the Admin Dashboard to fail with a Redis connection error when redis.action_cable.yml is not configured.

On an Omnibus instance, it's possible to configure Redis-specific instances and disable the default Redis server:

redis['enable'] = false
gitlab_rails['redis_cache_instance'] = 'redis://localhost'
gitlab_rails['redis_queues_instance'] = 'redis://localhost'
gitlab_rails['redis_actioncable_instance'] = 'redis://localhost'
gitlab_rails['redis_shared_state_instance'] = 'redis://localhost'

Prior to GitLab 18.7.0, this configuration worked fine. However, after !214008 (merged) gitlab_rails['redis_host'] must be configured or the /admin page would throw a 500 error because the default Redis server was not available.

To avoid this error, introduce an active? method to determine if a Redis instance is configured and available:

  • Wrapper base class: Returns true by default (all Redis instances are active)
  • ActionCable: Returns false if redis.action_cable.yml doesn't exist
  • Dashboard & Health Checks: Only include active Redis instances when collecting versions or creating health checks

This allows ActionCable to be optional without breaking deployments where it's not configured.

References

Relates to https://gitlab.com/gitlab-com/request-for-help/-/work_items/4037

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

  • This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch.
  • The MR that fixed the bug on the default branch has been deployed to GitLab.com (not applicable for documentation or spec changes).
  • The MR title is descriptive (e.g. "Backport of 'title of default branch MR'"). This is important, since the title will be copied to the patch blog post.
  • Required labels have been applied to this merge request
  • This MR has been approved by a maintainer (only one approval is required).
  • Ensure the e2e:test-on-omnibus-ee job has succeeded, or if it has failed, investigate the failures. If you determine the failures are unrelated, you may proceed. If you need assistance investigating, reach out to a Software Engineer in Test in #s_developer_experience.

Note to the merge request author and maintainer

If you have questions about the patch release process, please:

Edited by Stan Hu

Merge request reports

Loading