Resolve "Repmgr logrotation stops working"
Closes #2695 (closed)
Merge request reports
Activity
So logrotate was broken because I didn't set it up. I'm not 100% sold on this solution, so I'll keep this WIP for the evening.
Looks like this is the first EE only solution that is being managed. I'll do a sweep tomorrow for other services and ensure the appropriate entries are covered as well.
added 1 commit
- e90460d4 - Update to add consul and pgbouncer to logrotation
added HA Pick into Stable postgresql labels
changed milestone to %9.5
assigned to @twk3
87 87 #{mattermost_user} 88 88 #{registry_user} 89 89 #{prometheus_user} 90 #{consul_user} 91 90 ) 91 userlist << consul_user if node.recipe?('gitlab-ee::default') I don't think we should check for a recipe, as it could cause problems if we add commands that use different recipes. Checking whether the GitLabEE constant is defined should be fine (similar to what we do in gitlab/recipes/config.rb
The tests require an extra stub for ce though, as EE libs are always loaded, you need to hide_const for your CE specific tests: https://relishapp.com/rspec/rspec-mocks/v/3-6/docs/mutating-constants/hide-defined-constant
35 35 end 36 36 37 37 node['gitlab']['logrotate']['services'].each do |svc| 38 if node['gitlab'].key?(svc) I recently came across a way to write this smaller using a ternary and node.read vs the if statement. Used it here: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/package/libraries/helpers/services_helper.rb#L149-152
service_path = node.attribute?(svc) ? [svc] : ['gitlab'][svc] log_directory = node.read(*service_path, 'log_directory') svc_options = node.read(*service_path)
@ibaum I'm not very familiar with logrotate myself. But it looks like our current config only rotates .log files, and if I turn on consul, and check it's log directory for example, it only has the runit logs.
Also, we should add the log directories to the gitlab.rb template, in the cases where they aren't already. Like Repmgr
assigned to @ibaum
Thanks @twk3, I looked a little closer at the problem, and it's not a problem :) For consul and repmgr at least. I do still need to update pgbouncer.
As part of #2712 (closed) we got rid of
repmgr.log
and just use the runit logs forrepmgr
. As you pointed out,consul
is already doing this, so logrotate isn't coming into play for either of these. Thesvlogd
rotation should be working fine for both of these.