Commit 8d78662e69a11dc82916793d97aba36dacae1440

Authored by Jacob Vosmaer
1 parent 0d3ba71b

Give the Rails cache its own Redis namespace

Before this change, Rails cache data was stored in a global Redis
namespace. As a consequence, clearing the Rails cache (`rake
cache:clear`) would also delete all Sidekiq queue data and session
storage. This change puts all Rails cache data in a `cache:gitlab`
namespace, making `rake cache:clear` safe again.
CHANGELOG
... ... @@ -17,6 +17,7 @@ v 6.8.0
17 17 - Fix download link for huge MR diffs
18 18 - Expose event and mergerequest timestamps in API
19 19 - Fix emails on push service when only one commit is pushed
  20 + - Store Rails cache data in the Redis `cache:gitlab` namespace
20 21  
21 22 v 6.7.3
22 23 - Fix the merge notification email not being sent (Pierre de La Morinerie)
... ...
config/environments/production.rb
... ... @@ -53,7 +53,7 @@ Gitlab::Application.configure do
53 53 else
54 54 "redis://localhost:6379"
55 55 end
56   - config.cache_store = :redis_store, resque_url
  56 + config.cache_store = :redis_store, resque_url, {namespace: 'cache:gitlab'}
57 57  
58 58 # Enable serving of images, stylesheets, and JavaScripts from an asset server
59 59 # config.action_controller.asset_host = "http://assets.example.com"
... ...
config/initializers/session_store.rb
... ... @@ -2,7 +2,7 @@
2 2  
3 3 Gitlab::Application.config.session_store(
4 4 :redis_store, # Using the cookie_store would enable session replay attacks.
5   - servers: Gitlab::Application.config.cache_store.last, # re-use the Redis config from the Rails cache store
  5 + servers: Gitlab::Application.config.cache_store[1], # re-use the Redis config from the Rails cache store
6 6 key: '_gitlab_session',
7 7 secure: Gitlab.config.gitlab.https,
8 8 httponly: true,
... ...