Commit 648d316300ba2dbed85bfdc749100b8a8c80c42c
1 parent
9b9ff9cb
Exists in
master
and in
4 other branches
Support external Redis instances
Showing
7 changed files
with
28 additions
and
3 deletions
Show diff stats
README.md
... | ... | @@ -548,6 +548,18 @@ If you do do not want to use the packaged Postgres server you can configure an e |
548 | 548 | Configuring a PostgreSQL server is possible both with GitLab Community Edition and Enterprise Edition packages. |
549 | 549 | Please see the upstream GitLab for a [PostgreSQL configuration example][database.yml.postgresql]. |
550 | 550 | |
551 | +## Using a non-packaged Redis instance | |
552 | + | |
553 | +If you want to use your own Redis instance instead of the bundled Redis, you | |
554 | +can use the `gitlab.rb` settings below. Run `gitlab-ctl reconfigure` for the | |
555 | +settings to take effect. | |
556 | + | |
557 | +```ruby | |
558 | +redis['enable'] = false | |
559 | +gitlab_rails['redis_host'] = redis.example.com | |
560 | +gitlab_rails['redis_port'] = 6380 # defaults to 6379 | |
561 | +``` | |
562 | + | |
551 | 563 | ## Building your own package |
552 | 564 | |
553 | 565 | See [the separate build documentation](doc/build.md). | ... | ... |
files/gitlab-cookbooks/gitlab/attributes/default.rb
... | ... | @@ -128,6 +128,9 @@ default['gitlab']['gitlab-rails']['db_host'] = nil |
128 | 128 | default['gitlab']['gitlab-rails']['db_port'] = 5432 |
129 | 129 | default['gitlab']['gitlab-rails']['db_socket'] = nil |
130 | 130 | |
131 | +default['gitlab']['gitlab-rails']['redis_host'] = "127.0.0.1" | |
132 | +default['gitlab']['gitlab-rails']['redis_port'] = 6379 | |
133 | + | |
131 | 134 | default['gitlab']['gitlab-rails']['smtp_enable'] = false |
132 | 135 | default['gitlab']['gitlab-rails']['smtp_address'] = nil |
133 | 136 | default['gitlab']['gitlab-rails']['smtp_port'] = nil | ... | ... |
files/gitlab-cookbooks/gitlab/libraries/gitlab.rb
... | ... | @@ -139,6 +139,13 @@ module Gitlab |
139 | 139 | end |
140 | 140 | end |
141 | 141 | |
142 | + def parse_redis_settings | |
143 | + # No need to check redis['host'] because that setting is not configurable. | |
144 | + if redis['port'] | |
145 | + Gitlab['gitlab_rails']['redis_port'] ||= redis['port'] | |
146 | + end | |
147 | + end | |
148 | + | |
142 | 149 | def generate_hash |
143 | 150 | results = { "gitlab" => {} } |
144 | 151 | [ |
... | ... | @@ -166,6 +173,7 @@ module Gitlab |
166 | 173 | parse_external_url |
167 | 174 | parse_git_data_dir |
168 | 175 | parse_udp_log_shipping |
176 | + parse_redis_settings | |
169 | 177 | # The last step is to convert underscores to hyphens in top-level keys |
170 | 178 | generate_hash |
171 | 179 | end | ... | ... |
files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb
files/gitlab-cookbooks/gitlab/recipes/gitlab-shell.rb
... | ... | @@ -82,7 +82,8 @@ template_symlink File.join(gitlab_shell_var_dir, "config.yml") do |
82 | 82 | :api_url => api_url, |
83 | 83 | :repositories_path => repositories_path, |
84 | 84 | :authorized_keys => authorized_keys, |
85 | - :redis_port => node['gitlab']['redis']['port'], | |
85 | + :redis_host => node['gitlab']['gitlab-rails']['redis_host'], | |
86 | + :redis_port => node['gitlab']['gitlab-rails']['redis_port'], | |
86 | 87 | :log_file => File.join(log_directory, "gitlab-shell.log") |
87 | 88 | ) |
88 | 89 | end | ... | ... |
files/gitlab-cookbooks/gitlab/templates/default/gitlab-shell-config.yml.erb
... | ... | @@ -27,7 +27,7 @@ auth_file: "<%= @authorized_keys %>" |
27 | 27 | # Redis settings used for pushing commit notices to gitlab |
28 | 28 | redis: |
29 | 29 | bin: /opt/gitlab/embedded/bin/redis-cli |
30 | - host: 127.0.0.1 | |
30 | + host: <%= @redis_host %> | |
31 | 31 | port: <%= @redis_port %> |
32 | 32 | # socket: /tmp/redis.socket # Only define this if you want to use sockets |
33 | 33 | namespace: resque:gitlab | ... | ... |
files/gitlab-cookbooks/gitlab/templates/default/resque.yml.erb