summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-08-28 15:03:22 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-08-28 15:03:22 +0300
commitc1d2640b2ea5aec67401ef17ae8e637677aa5d7f (patch)
tree4e043ee0dcf2ee1e982fbb1807e369762345048c
parentdb88190636456a84db747a3f9335a55ca9819274 (diff)
parentfc62664146458f023c5573d7e6dead5f11c6fd4b (diff)
downloadgitlab-ce-c1d2640b2ea5aec67401ef17ae8e637677aa5d7f.tar.gz
Merge branch 'redis_settings'
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Conflicts: CHANGELOG
-rw-r--r--CHANGELOG2
-rw-r--r--config/environments/production.rb10
-rw-r--r--config/initializers/7_cache_settings.rb20
-rw-r--r--config/initializers/session_store.rb2
4 files changed, 23 insertions, 11 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 97e66cd5a21..bff2bf993f9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,8 @@ v 7.3.0
- Better search with filtering, pagination etc
- Added a checkbox to toggle line wrapping in diff (Yuriy Glukhov)
- Prevent project stars duplication when fork project
+ - Support Unix domain sockets for Redis
+ - Store session Redis keys in 'session:gitlab:' namespace
v 7.2.0
- Explore page
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 2450d5719eb..78bf543402b 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -45,16 +45,6 @@ Gitlab::Application.configure do
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
- # Use a different cache store in production
- config_file = Rails.root.join('config', 'resque.yml')
-
- resque_url = if File.exists?(config_file)
- YAML.load_file(config_file)[Rails.env]
- else
- "redis://localhost:6379"
- end
- config.cache_store = :redis_store, resque_url, {namespace: 'cache:gitlab'}
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
diff --git a/config/initializers/7_cache_settings.rb b/config/initializers/7_cache_settings.rb
new file mode 100644
index 00000000000..5367a4d431c
--- /dev/null
+++ b/config/initializers/7_cache_settings.rb
@@ -0,0 +1,20 @@
+Gitlab::Application.configure do
+ redis_config_file = Rails.root.join('config', 'resque.yml')
+
+ redis_url_string = if File.exists?(redis_config_file)
+ YAML.load_file(redis_config_file)[Rails.env]
+ else
+ "redis://localhost:6379"
+ end
+
+ # Redis::Store does not handle Unix sockets well, so let's do it for them
+ redis_config_hash = Redis::Store::Factory.extract_host_options_from_uri(redis_url_string)
+ redis_uri = URI.parse(redis_url_string)
+ if redis_uri.scheme == 'unix'
+ redis_config_hash[:path] = redis_uri.path
+ end
+
+ redis_config_hash[:namespace] = 'cache:gitlab'
+
+ config.cache_store = :redis_store, redis_config_hash
+end
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index b3fa648f2a6..b2d59f1c4b7 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -2,7 +2,7 @@
Gitlab::Application.config.session_store(
:redis_store, # Using the cookie_store would enable session replay attacks.
- servers: Gitlab::Application.config.cache_store[1], # re-use the Redis config from the Rails cache store
+ servers: Gitlab::Application.config.cache_store[1].merge(namespace: 'session:gitlab'), # re-use the Redis config from the Rails cache store
key: '_gitlab_session',
secure: Gitlab.config.gitlab.https,
httponly: true,