Commit 67a61c80d161582aefae82a6784356c910940751

Authored by Pierre GUINOISEAU
1 parent 7b38a0de

Allow connection to Redis via unix socket

Allow connection to Redis via unix socket, using
unix:/var/run/redis/redis.sock for example.

Default behaviour does not change, except that the full Redis URL must
be configured, with redis:// for tcp or unix: for unix socket.
config/initializers/4_sidekiq.rb
... ... @@ -4,19 +4,19 @@ config_file = Rails.root.join('config', 'resque.yml')
4 4 resque_url = if File.exists?(config_file)
5 5 YAML.load_file(config_file)[Rails.env]
6 6 else
7   - "localhost:6379"
  7 + "redis://localhost:6379"
8 8 end
9 9  
10 10 Sidekiq.configure_server do |config|
11 11 config.redis = {
12   - url: "redis://#{resque_url}",
  12 + url: resque_url,
13 13 namespace: 'resque:gitlab'
14 14 }
15 15 end
16 16  
17 17 Sidekiq.configure_client do |config|
18 18 config.redis = {
19   - url: "redis://#{resque_url}",
  19 + url: resque_url,
20 20 namespace: 'resque:gitlab'
21 21 }
22 22 end
... ...
config/resque.yml.example
1   -development: localhost:6379
2   -test: localhost:6379
3   -production: redis.example.com:6379
  1 +development: redis://localhost:6379
  2 +test: redis://localhost:6379
  3 +production: redis://redis.example.com:6379
... ...
doc/install/installation.md
... ... @@ -288,7 +288,7 @@ a different host, you can configure its connection string via the
288 288 `config/resque.yml` file.
289 289  
290 290 # example
291   - production: redis.example.tld:6379
  291 + production: redis://redis.example.tld:6379
292 292  
293 293 ## Custom SSH Connection
294 294  
... ...