Commit 6d8d32c2448cf4d321b1e3f0916b808532cd7e60

Authored by Dmitriy Zaporozhets
2 parents 4ecf23d2 259ca982

Merge pull request #1496 from tsigo/custom_redis

Add initializer for customizing Resque's Redis connection
config/initializers/resque.rb 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
  2 +rails_env = ENV['RAILS_ENV'] || 'development'
  3 +config_file = File.join(rails_root, 'config', 'resque.yml')
  4 +
  5 +if File.exists?(config_file)
  6 + resque_config = YAML.load_file(config_file)
  7 + Resque.redis = resque_config[rails_env]
  8 +end
... ...
config/resque.yml.example 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +development: localhost:6379
  2 +test: localhost:6379
  3 +production: redis.example.com:6379
... ...
doc/installation.md
... ... @@ -251,6 +251,14 @@ You can login via web using admin generated with setup:
251 251 # if you run this as root /home/gitlab/gitlab/tmp/pids/resque_worker.pid will be owned by root
252 252 # causing the resque worker not to start via init script on next boot/service restart
253 253  
  254 +## Customizing Resque's Redis connection
  255 +
  256 +If you'd like Resque to connect to a Redis server on a non-standard port or on
  257 +a different host, you can configure its connection string in the
  258 +**config/resque.yml** file:
  259 +
  260 + production: redis.example.com:6379
  261 +
254 262 **Ok - we have a working application now. **
255 263 **But keep going - there are some things that should be done **
256 264  
... ... @@ -276,7 +284,6 @@ You can login via web using admin generated with setup:
276 284 # of the host serving GitLab.
277 285 sudo vim /etc/nginx/sites-enabled/gitlab
278 286  
279   -
280 287 # Restart nginx:
281 288 /etc/init.d/nginx restart
282 289  
... ...