2020-11-12 15:30:51 +00:00
|
|
|
# Start provisioning:
|
2020-11-12 15:31:15 +00:00
|
|
|
%w(loki.yaml prometheus.yaml).each do |conf|
|
|
|
|
remote_file "/etc/grafana/provisioning/datasources/#{conf}" do
|
|
|
|
owner 'root'
|
|
|
|
group 'grafana'
|
|
|
|
mode '640'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-11-12 15:42:40 +00:00
|
|
|
remote_file '/etc/grafana/grafana.ini' do
|
|
|
|
owner 'grafana'
|
|
|
|
group 'grafana'
|
|
|
|
mode '640'
|
|
|
|
end
|
|
|
|
|
2019-03-03 08:50:49 +00:00
|
|
|
# Start/Enable `grafana`:
|
|
|
|
service 'grafana-server' do
|
|
|
|
action [ :enable, :start ]
|
|
|
|
end
|
|
|
|
|
2020-09-26 08:34:59 +00:00
|
|
|
# Deploy `consul` config for `grafana`:
|
|
|
|
remote_file '/etc/consul.d/service-grafana.json' do
|
2020-11-22 15:52:14 +00:00
|
|
|
owner 'consul'
|
|
|
|
group 'consul'
|
2020-09-26 08:34:59 +00:00
|
|
|
mode '644'
|
|
|
|
|
2020-11-22 16:42:06 +00:00
|
|
|
notifies :reload, 'service[consul]'
|
|
|
|
end
|
|
|
|
|
|
|
|
service 'consul' do
|
|
|
|
action :nothing
|
2020-09-26 08:34:59 +00:00
|
|
|
end
|
|
|
|
|
2019-03-03 08:50:49 +00:00
|
|
|
# Firewall settings here:
|
|
|
|
%w( 3000/tcp ).each do |p|
|
|
|
|
execute "ufw allow #{p}" do
|
|
|
|
user 'root'
|
|
|
|
|
|
|
|
not_if "LANG=c ufw status | grep #{p}"
|
|
|
|
|
|
|
|
notifies :run, 'execute[ufw reload-or-enable]'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
execute 'ufw reload-or-enable' do
|
|
|
|
user 'root'
|
|
|
|
command 'LANG=C ufw reload | grep skipping && ufw --force enable || exit 0'
|
|
|
|
|
|
|
|
action :nothing
|
|
|
|
end
|