Skip to content
Snippets Groups Projects
Commit fe56646a authored by DJ Mountney's avatar DJ Mountney
Browse files

Merge branch '9-2-stable' into 9-2-stable-ee

parents 9ff10453 7b325bcc
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -32,13 +32,24 @@ directory gitlab_monitor_log_dir do
recursive true
end
 
connection_string = "dbname=#{node['gitlab']['gitlab-rails']['db_database']} user=#{node['gitlab']['gitlab-rails']['db_username']}"
if node['gitlab']['postgresql']['enabled']
connection_string += " host=#{node['gitlab']['postgresql']['dir']}"
else
connection_string += " host=#{node['gitlab']['gitlab-rails']['db_host']} port=#{node['gitlab']['gitlab-rails']['db_port']} password=#{node['gitlab']['gitlab-rails']['db_password']}"
end
redis_url = RedisHelper.new(node).redis_url
template "#{gitlab_monitor_dir}/gitlab-monitor.yml" do
source "gitlab-monitor.yml.erb"
owner gitlab_user
mode "0644"
notifies :restart, "service[gitlab-monitor]"
variables(:redis_url => redis_url)
variables(
:redis_url => redis_url,
:connection_string => connection_string,
)
end
 
runit_service "gitlab-monitor" do
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@ db_common: &db_common
methods:
- probe_db
opts:
connection_string: dbname=<%= node['gitlab']['gitlab-rails']['db_database'] %> user=<%= node['gitlab']['gitlab-rails']['db_username'] %> host=<%= node['gitlab']['postgresql']['dir'] %>
connection_string: <%= @connection_string %>
 
common_git: &common_git
class_name: GitProber
Loading
Loading
Loading
Loading
@@ -47,6 +47,27 @@ describe 'gitlab::gitlab-monitor' do
end
end
 
context 'when gitlab-monitor is enabled and postgres is disabled' do
let(:config_template) { chef_run.template('/var/log/gitlab/gitlab-monitor/config') }
before do
stub_gitlab_rb(
gitlab_monitor: { enable: true },
gitlab_rails: { db_host: 'postgres.example.com', db_port: '5432', db_password: 'secret' },
postgresql: { enabled: false }
)
end
it 'populates a config with a remote host' do
expect(chef_run).to render_file('/var/opt/gitlab/gitlab-monitor/gitlab-monitor.yml')
.with_content { |content|
expect(content).to match(/host=postgres\.example\.com/)
expect(content).to match(/port=5432/)
expect(content).to match(/password=secret/)
}
end
end
context 'when log dir is changed' do
before do
stub_gitlab_rb(
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment