Commit 93bfff7b authored by Chris's avatar Chris Committed by Chr1831

Added remote redis support to gitlab_update.rb

parent ff484e65
...@@ -14,3 +14,11 @@ repos_path: "/home/git/repositories" ...@@ -14,3 +14,11 @@ repos_path: "/home/git/repositories"
# File used as authorized_keys for gitlab user # File used as authorized_keys for gitlab user
auth_file: "/home/git/.ssh/authorized_keys" auth_file: "/home/git/.ssh/authorized_keys"
# Redis settings used for pushing commit notices to gitlab
redis:
bin: /usr/bin/redis-cli
host: 127.0.0.1
port: 6379
namespace: resque:gitlab
...@@ -22,4 +22,8 @@ class GitlabConfig ...@@ -22,4 +22,8 @@ class GitlabConfig
def http_settings def http_settings
@config['http_settings'] ||= {} @config['http_settings'] ||= {}
end end
def redis
@config['redis'] ||= {}
end
end end
...@@ -15,6 +15,8 @@ class GitlabUpdate ...@@ -15,6 +15,8 @@ class GitlabUpdate
@oldrev = ARGV[1] @oldrev = ARGV[1]
@newrev = ARGV[2] @newrev = ARGV[2]
@redis = GitlabConfig.new.redis
end end
def exec def exec
...@@ -49,7 +51,9 @@ class GitlabUpdate ...@@ -49,7 +51,9 @@ class GitlabUpdate
end end
def update_redis def update_redis
command = "env -i redis-cli rpush 'resque:gitlab:queue:post_receive' '{\"class\":\"PostReceive\",\"args\":[\"#{@repo_path}\",\"#{@oldrev}\",\"#{@newrev}\",\"#{@refname}\",\"#{@key_id}\"]}' > /dev/null 2>&1" command = "#{@redis['bin']} -h #{@redis['host']} -p #{@redis['port']} rpush '#{@redis['namespace']}:queue:post_receive' "+
"'{\"class\":\"PostReceive\",\"args\":[\"#{@repo_path}\",\"#{@oldrev}\",\"#{@newrev}\",\"#{@refname}\",\"#{@key_id}\"]}' > /dev/null 2>&1"
system(command) system(command)
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment