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}"
|
||||
|
||||
notifies :restart, 'service[consul]'
|
||||
end
|
||||
|
||||
directory '/var/log/consul/' do
|
||||
|
@ -23,12 +25,24 @@ directory '/var/log/consul/' do
|
|||
mode '0755'
|
||||
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
|
||||
owner 'consul'
|
||||
group 'consul'
|
||||
mode '644'
|
||||
end
|
||||
|
||||
service 'consul' do
|
||||
action [:enable, :start]
|
||||
end
|
||||
|
||||
# iptables settings here:
|
||||
%w( 8300/tcp 8301/tcp 8301/udp 8500/tcp ).each do |port|
|
||||
execute "ufw allow #{port}" do
|
||||
|
|
Loading…
Reference in New Issue