Add option to configure redis snapshotting
This commit is contained in:
parent
c40b82c403
commit
400f3a54f1
|
@ -784,6 +784,11 @@ external_url 'GENERATED_EXTERNAL_URL'
|
|||
# redis['client_output_buffer_limit_slave'] = '256mb 64mb 60'
|
||||
# redis['client_output_buffer_limit_pubsub'] = '32mb 8mb 60'
|
||||
|
||||
#####! Redis snapshotting frequency
|
||||
#####! Set to [] to disable
|
||||
#####! Set to [''] to clear previously set values
|
||||
# redis['save'] = [ '900 1', '300 10', '60 10000' ]
|
||||
|
||||
################################################################################
|
||||
## GitLab Web server
|
||||
##! Docs: https://docs.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server
|
||||
|
|
|
@ -473,6 +473,7 @@ default['gitlab']['redis']['master_password'] = nil
|
|||
default['gitlab']['redis']['client_output_buffer_limit_normal'] = "0 0 0"
|
||||
default['gitlab']['redis']['client_output_buffer_limit_slave'] = "256mb 64mb 60"
|
||||
default['gitlab']['redis']['client_output_buffer_limit_pubsub'] = "32mb 8mb 60"
|
||||
default['gitlab']['redis']['save'] = ['900 1', '300 10', '60 10000']
|
||||
|
||||
####
|
||||
# Web server
|
||||
|
|
|
@ -203,9 +203,15 @@ databases 16
|
|||
#
|
||||
# save ""
|
||||
|
||||
save 900 1
|
||||
save 300 10
|
||||
save 60 10000
|
||||
<% unless @save.empty? %>
|
||||
<% if @save.any?(&:empty?) %>
|
||||
save ""
|
||||
<% else %>
|
||||
<% @save.each do |line| %>
|
||||
<%= "save #{line}" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
# By default Redis will stop accepting writes if RDB snapshots are enabled
|
||||
# (at least one save point) and the latest background save failed.
|
||||
|
|
|
@ -15,6 +15,12 @@ describe 'gitlab::redis' do
|
|||
.with_content(/client-output-buffer-limit slave 256mb 64mb 60/)
|
||||
expect(chef_run).to render_file('/var/opt/gitlab/redis/redis.conf')
|
||||
.with_content(/client-output-buffer-limit pubsub 32mb 8mb 60/)
|
||||
expect(chef_run).to render_file('/var/opt/gitlab/redis/redis.conf')
|
||||
.with_content(/^save 900 1/)
|
||||
expect(chef_run).to render_file('/var/opt/gitlab/redis/redis.conf')
|
||||
.with_content(/^save 300 10/)
|
||||
expect(chef_run).to render_file('/var/opt/gitlab/redis/redis.conf')
|
||||
.with_content(/^save 60 10000/)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -24,7 +30,8 @@ describe 'gitlab::redis' do
|
|||
redis: {
|
||||
client_output_buffer_limit_normal: "5 5 5",
|
||||
client_output_buffer_limit_slave: "512mb 128mb 120",
|
||||
client_output_buffer_limit_pubsub: "64mb 16mb 120"
|
||||
client_output_buffer_limit_pubsub: "64mb 16mb 120",
|
||||
save: ["10 15000"]
|
||||
}
|
||||
)
|
||||
end
|
||||
|
@ -36,6 +43,37 @@ describe 'gitlab::redis' do
|
|||
.with_content(/client-output-buffer-limit slave 512mb 128mb 120/)
|
||||
expect(chef_run).to render_file('/var/opt/gitlab/redis/redis.conf')
|
||||
.with_content(/client-output-buffer-limit pubsub 64mb 16mb 120/)
|
||||
expect(chef_run).to render_file('/var/opt/gitlab/redis/redis.conf')
|
||||
.with_content(/^save 10 15000/)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with snapshotting disabled' do
|
||||
before do
|
||||
stub_gitlab_rb(
|
||||
redis: {
|
||||
save: []
|
||||
}
|
||||
)
|
||||
end
|
||||
it 'creates redis config without save setting' do
|
||||
expect(chef_run).to render_file('/var/opt/gitlab/redis/redis.conf')
|
||||
expect(chef_run).not_to render_file('/var/opt/gitlab/redis/redis.conf')
|
||||
.with_content(/^save/)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with snapshotting cleared' do
|
||||
before do
|
||||
stub_gitlab_rb(
|
||||
redis: {
|
||||
save: [""]
|
||||
}
|
||||
)
|
||||
end
|
||||
it 'creates redis config without save setting' do
|
||||
expect(chef_run).to render_file('/var/opt/gitlab/redis/redis.conf')
|
||||
.with_content(/^save ""/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue