Skip to content

Commit

Permalink
Merge pull request gitlabhq#1496 from tsigo/custom_redis
Browse files Browse the repository at this point in the history
Add initializer for customizing Resque's Redis connection
  • Loading branch information
dzaporozhets committed Sep 19, 2012
2 parents 4ecf23d + 259ca98 commit 6d8d32c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions config/initializers/resque.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
rails_env = ENV['RAILS_ENV'] || 'development'
config_file = File.join(rails_root, 'config', 'resque.yml')

if File.exists?(config_file)
resque_config = YAML.load_file(config_file)
Resque.redis = resque_config[rails_env]
end
3 changes: 3 additions & 0 deletions config/resque.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
development: localhost:6379
test: localhost:6379
production: redis.example.com:6379
9 changes: 8 additions & 1 deletion doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ You can login via web using admin generated with setup:
# if you run this as root /home/gitlab/gitlab/tmp/pids/resque_worker.pid will be owned by root
# causing the resque worker not to start via init script on next boot/service restart

## Customizing Resque's Redis connection

If you'd like Resque to connect to a Redis server on a non-standard port or on
a different host, you can configure its connection string in the
**config/resque.yml** file:

production: redis.example.com:6379

**Ok - we have a working application now. **
**But keep going - there are some things that should be done **

Expand All @@ -276,7 +284,6 @@ You can login via web using admin generated with setup:
# of the host serving GitLab.
sudo vim /etc/nginx/sites-enabled/gitlab


# Restart nginx:
/etc/init.d/nginx restart

Expand Down

0 comments on commit 6d8d32c

Please sign in to comment.