Changing # gitlab_rails['redis_socket'] = "/var/opt/gitlab/redis/redis.socket" in gitlab.rb has no effect
Summary
default['gitlab']['redis']['unixsocket'] should actually be default['gitlab']['redis']['redis_socket'] in /files/gitlab-cookbooks/gitlab/attributes/default.rb
.
Steps to reproduce
Try to change default location of gitlab_rails['redis_socket'] = "/var/opt/gitlab/redis/redis.socket"
, socket does not write to new location.
What is the current bug behavior?
Socket does not write to new location.
What is the expected correct behavior?
Socket should write to new location
Relevant logs and/or screenshots
Fix:
diff --git a/files/gitlab-cookbooks/gitlab/attributes/default.rb b/files/gitlab-cookbooks/gitlab/attributes/default.rb
index 5c491055..66f0fee2 100644
--- a/files/gitlab-cookbooks/gitlab/attributes/default.rb
+++ b/files/gitlab-cookbooks/gitlab/attributes/default.rb
@@ -452,7 +452,6 @@ default['gitlab']['redis']['maxclients'] = "10000"
default['gitlab']['redis']['tcp_timeout'] = 60
default['gitlab']['redis']['tcp_keepalive'] = 300
default['gitlab']['redis']['password'] = nil
-default['gitlab']['redis']['unixsocket'] = "/var/opt/gitlab/redis/redis.socket"
default['gitlab']['redis']['unixsocketperm'] = "777"
default['gitlab']['redis']['master'] = true
default['gitlab']['redis']['master_name'] = 'gitlab-redis'
diff --git a/files/gitlab-cookbooks/gitlab/libraries/redis.rb b/files/gitlab-cookbooks/gitlab/libraries/redis.rb
index 0de4fcce..b4cfe2f9 100644
--- a/files/gitlab-cookbooks/gitlab/libraries/redis.rb
+++ b/files/gitlab-cookbooks/gitlab/libraries/redis.rb
@@ -25,7 +25,7 @@ module Redis
def parse_redis_settings
if is_redis_tcp?
# The user wants Redis to listen via TCP instead of unix socket.
- Gitlab['redis']['unixsocket'] = false
+ Gitlab['redis']['redis_socket'] = false
# Try to discover gitlab_rails redis connection params
# based on redis daemon
diff --git a/files/gitlab-cookbooks/gitlab/templates/default/redis.conf.erb b/files/gitlab-cookbooks/gitlab/templates/default/redis.conf.erb
index 3d3ccc41..53c6ef34 100644
--- a/files/gitlab-cookbooks/gitlab/templates/default/redis.conf.erb
+++ b/files/gitlab-cookbooks/gitlab/templates/default/redis.conf.erb
@@ -102,7 +102,7 @@ port <%= @port %>
# incoming connections. There is no default, so Redis will not listen
# on a unix socket when not specified.
#
-<%= "unixsocket #{@unixsocket}" if @unixsocket %>
+<%= "unixsocket #{@redis_socket}" if @redis_socket %>
unixsocketperm <%= @unixsocketperm %>
# Close the connection after a client is idle for N seconds (0 to disable)
diff --git a/spec/libraries/redis_spec.rb b/spec/libraries/redis_spec.rb
index 3c69a6e4..0761deb3 100644
--- a/spec/libraries/redis_spec.rb
+++ b/spec/libraries/redis_spec.rb
@@ -20,8 +20,8 @@ describe 'Redis' do
context '.parse_redis_settings' do
context 'when no customization is made' do
- it 'keeps unixsocket' do
- expect(node['gitlab']['gitlab-rails']['unixsocket']).not_to eq false
+ it 'keeps redis_socket' do
+ expect(node['gitlab']['gitlab-rails']['redis_socket']).not_to eq false
subject.parse_redis_settings
end
@@ -42,7 +42,7 @@ describe 'Redis' do
end
it 'disables unix socket when redis tcp params are defined' do
- expect(node['gitlab']['redis']['unixsocket']).to eq false
+ expect(node['gitlab']['redis']['redis_socket']).to eq false
subject.parse_redis_settings
end
@@ -81,7 +81,7 @@ describe 'Redis' do
end
it 'disables unix socket when sentinel params are defined' do
- expect(node['gitlab']['redis']['unixsocket']).to eq false
+ expect(node['gitlab']['redis']['redis_socket']).to eq false
subject.parse_redis_settings
end
Possible fixes
Listed above