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,6 +548,18 @@ If you do do not want to use the packaged Postgres server you can configure an e | ||
548 | Configuring a PostgreSQL server is possible both with GitLab Community Edition and Enterprise Edition packages. | 548 | Configuring a PostgreSQL server is possible both with GitLab Community Edition and Enterprise Edition packages. |
549 | Please see the upstream GitLab for a [PostgreSQL configuration example][database.yml.postgresql]. | 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 | ## Building your own package | 563 | ## Building your own package |
552 | 564 | ||
553 | See [the separate build documentation](doc/build.md). | 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,6 +128,9 @@ default['gitlab']['gitlab-rails']['db_host'] = nil | ||
128 | default['gitlab']['gitlab-rails']['db_port'] = 5432 | 128 | default['gitlab']['gitlab-rails']['db_port'] = 5432 |
129 | default['gitlab']['gitlab-rails']['db_socket'] = nil | 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 | default['gitlab']['gitlab-rails']['smtp_enable'] = false | 134 | default['gitlab']['gitlab-rails']['smtp_enable'] = false |
132 | default['gitlab']['gitlab-rails']['smtp_address'] = nil | 135 | default['gitlab']['gitlab-rails']['smtp_address'] = nil |
133 | default['gitlab']['gitlab-rails']['smtp_port'] = nil | 136 | default['gitlab']['gitlab-rails']['smtp_port'] = nil |
files/gitlab-cookbooks/gitlab/libraries/gitlab.rb
@@ -139,6 +139,13 @@ module Gitlab | @@ -139,6 +139,13 @@ module Gitlab | ||
139 | end | 139 | end |
140 | end | 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 | def generate_hash | 149 | def generate_hash |
143 | results = { "gitlab" => {} } | 150 | results = { "gitlab" => {} } |
144 | [ | 151 | [ |
@@ -166,6 +173,7 @@ module Gitlab | @@ -166,6 +173,7 @@ module Gitlab | ||
166 | parse_external_url | 173 | parse_external_url |
167 | parse_git_data_dir | 174 | parse_git_data_dir |
168 | parse_udp_log_shipping | 175 | parse_udp_log_shipping |
176 | + parse_redis_settings | ||
169 | # The last step is to convert underscores to hyphens in top-level keys | 177 | # The last step is to convert underscores to hyphens in top-level keys |
170 | generate_hash | 178 | generate_hash |
171 | end | 179 | end |
files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb
@@ -84,6 +84,7 @@ template_symlink File.join(gitlab_rails_etc_dir, "resque.yml") do | @@ -84,6 +84,7 @@ template_symlink File.join(gitlab_rails_etc_dir, "resque.yml") do | ||
84 | owner "root" | 84 | owner "root" |
85 | group "root" | 85 | group "root" |
86 | mode "0644" | 86 | mode "0644" |
87 | + variables(node['gitlab']['gitlab-rails'].to_hash) | ||
87 | restarts dependent_services | 88 | restarts dependent_services |
88 | end | 89 | end |
89 | 90 |
files/gitlab-cookbooks/gitlab/recipes/gitlab-shell.rb
@@ -82,7 +82,8 @@ template_symlink File.join(gitlab_shell_var_dir, "config.yml") do | @@ -82,7 +82,8 @@ template_symlink File.join(gitlab_shell_var_dir, "config.yml") do | ||
82 | :api_url => api_url, | 82 | :api_url => api_url, |
83 | :repositories_path => repositories_path, | 83 | :repositories_path => repositories_path, |
84 | :authorized_keys => authorized_keys, | 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 | :log_file => File.join(log_directory, "gitlab-shell.log") | 87 | :log_file => File.join(log_directory, "gitlab-shell.log") |
87 | ) | 88 | ) |
88 | end | 89 | end |
files/gitlab-cookbooks/gitlab/templates/default/gitlab-shell-config.yml.erb
@@ -27,7 +27,7 @@ auth_file: "<%= @authorized_keys %>" | @@ -27,7 +27,7 @@ auth_file: "<%= @authorized_keys %>" | ||
27 | # Redis settings used for pushing commit notices to gitlab | 27 | # Redis settings used for pushing commit notices to gitlab |
28 | redis: | 28 | redis: |
29 | bin: /opt/gitlab/embedded/bin/redis-cli | 29 | bin: /opt/gitlab/embedded/bin/redis-cli |
30 | - host: 127.0.0.1 | 30 | + host: <%= @redis_host %> |
31 | port: <%= @redis_port %> | 31 | port: <%= @redis_port %> |
32 | # socket: /tmp/redis.socket # Only define this if you want to use sockets | 32 | # socket: /tmp/redis.socket # Only define this if you want to use sockets |
33 | namespace: resque:gitlab | 33 | namespace: resque:gitlab |
files/gitlab-cookbooks/gitlab/templates/default/resque.yml.erb