Overwrite the `systemd` config to rotate the log files.
This commit is contained in:
parent
0e6c2ad531
commit
7270023c92
|
@ -0,0 +1,20 @@
|
||||||
|
[Unit]
|
||||||
|
Description="HashiCorp Consul - A service mesh solution"
|
||||||
|
Documentation=https://www.consul.io/
|
||||||
|
Requires=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
ConditionFileNotEmpty=/etc/consul.d/consul.hcl
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=consul
|
||||||
|
Group=consul
|
||||||
|
ExecStartPre=/usr/bin/find /var/log/consul/ -type f -delete
|
||||||
|
ExecStart=/usr/bin/consul agent -config-dir=/etc/consul.d/
|
||||||
|
ExecReload=/bin/kill --signal HUP $MAINPID
|
||||||
|
KillMode=process
|
||||||
|
KillSignal=SIGTERM
|
||||||
|
Restart=on-failure
|
||||||
|
LimitNOFILE=65536
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -15,6 +15,8 @@ template '/etc/consul.d/consul.hcl' do
|
||||||
)
|
)
|
||||||
|
|
||||||
source "templates/etc/consul.d/#{SRC}"
|
source "templates/etc/consul.d/#{SRC}"
|
||||||
|
|
||||||
|
notifies :restart, 'service[consul]'
|
||||||
end
|
end
|
||||||
|
|
||||||
directory '/var/log/consul/' do
|
directory '/var/log/consul/' do
|
||||||
|
@ -23,12 +25,24 @@ directory '/var/log/consul/' do
|
||||||
mode '0755'
|
mode '0755'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
remote_file '/etc/systemd/system/consul.service' do
|
||||||
|
owner 'root'
|
||||||
|
group 'root'
|
||||||
|
mode '0644'
|
||||||
|
|
||||||
|
notifies :restart, 'service[consul]'
|
||||||
|
end
|
||||||
|
|
||||||
remote_file '/etc/consul.d/service-consul.json' do
|
remote_file '/etc/consul.d/service-consul.json' do
|
||||||
owner 'consul'
|
owner 'consul'
|
||||||
group 'consul'
|
group 'consul'
|
||||||
mode '644'
|
mode '644'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
service 'consul' do
|
||||||
|
action [:enable, :start]
|
||||||
|
end
|
||||||
|
|
||||||
# iptables settings here:
|
# iptables settings here:
|
||||||
%w( 8300/tcp 8301/tcp 8301/udp 8500/tcp ).each do |port|
|
%w( 8300/tcp 8301/tcp 8301/udp 8500/tcp ).each do |port|
|
||||||
execute "ufw allow #{port}" do
|
execute "ufw allow #{port}" do
|
||||||
|
|
Loading…
Reference in New Issue