File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
files/gitlab-cookbooks/gitlab/libraries
spec/chef/cookbooks/redis/recipes Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ def parse_redis_settings
30
30
# The user wants Redis to listen via TCP instead of unix socket.
31
31
Gitlab [ 'redis' ] [ 'unixsocket' ] = false
32
32
33
+ parse_redis_bind_address
33
34
# Try to discover gitlab_rails redis connection params
34
35
# based on redis daemon
35
36
parse_redis_daemon! unless RedisHelper ::Checks . has_sentinels?
@@ -74,12 +75,17 @@ def redis_managed?
74
75
75
76
private
76
77
77
- def parse_redis_daemon!
78
+ def parse_redis_bind_address
78
79
return unless redis_managed?
79
80
80
81
redis_bind = Gitlab [ 'redis' ] [ 'bind' ] || node [ 'redis' ] [ 'bind' ]
81
82
Gitlab [ 'redis' ] [ 'default_host' ] = redis_bind . split ( ' ' ) . first
83
+ end
84
+
85
+ def parse_redis_daemon!
86
+ return unless redis_managed?
82
87
88
+ redis_bind = Gitlab [ 'redis' ] [ 'bind' ] || node [ 'redis' ] [ 'bind' ]
83
89
Gitlab [ 'gitlab_rails' ] [ 'redis_host' ] ||= Gitlab [ 'redis' ] [ 'default_host' ]
84
90
85
91
redis_port_config_key = if Gitlab [ 'redis' ] . key? ( 'port' ) && !Gitlab [ 'redis' ] [ 'port' ] . zero?
Original file line number Diff line number Diff line change 332
332
expect ( chef_run ) . to render_file ( '/opt/gitlab/etc/gitlab-redis-cli-rc' )
333
333
. with_content ( gitlab_redis_cli_rc )
334
334
end
335
+
336
+ context 'with Sentinels configured' do
337
+ before do
338
+ stub_gitlab_rb (
339
+ redis : {
340
+ bind : redis_host ,
341
+ port : redis_port ,
342
+ ha : true ,
343
+ master_ip : master_ip ,
344
+ master_port : master_port ,
345
+ master_password : 'password' ,
346
+ master : false
347
+ } ,
348
+ gitlab_rails : {
349
+ redis_sentinels : [
350
+ { 'host' => '127.0.0.1' , 'port' => 2637 }
351
+ ]
352
+ }
353
+ )
354
+ end
355
+
356
+ it_behaves_like 'started down runit service' , 'redis'
357
+
358
+ it 'creates gitlab-redis-cli-rc' do
359
+ expect ( chef_run ) . to render_file ( '/opt/gitlab/etc/gitlab-redis-cli-rc' )
360
+ . with_content ( gitlab_redis_cli_rc )
361
+ end
362
+ end
335
363
end
336
364
337
365
context 'with rename_commands disabled' do
You can’t perform that action at this time.
0 commit comments