From a45572e5214b3a963925fcd463513710d95b692b Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 13 Dec 2020 14:04:14 +0900 Subject: [PATCH] Deploy `systemd` config for `vector-docker`. --- .../etc/systemd/system/vector-docker.service | 16 ++++++++++++++++ cookbooks/docker/setup.rb | 14 ++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 cookbooks/docker/files/etc/systemd/system/vector-docker.service diff --git a/cookbooks/docker/files/etc/systemd/system/vector-docker.service b/cookbooks/docker/files/etc/systemd/system/vector-docker.service new file mode 100644 index 0000000..6994e1d --- /dev/null +++ b/cookbooks/docker/files/etc/systemd/system/vector-docker.service @@ -0,0 +1,16 @@ +[Unit] +Description=Vector +Documentation=https://vector.dev +After=network-online.target +Requires=network-online.target + +[Service] +ExecStart=/usr/bin/vector --config /etc/vector/docker.toml +ExecReload=/bin/kill -HUP $MAINPID +Restart=always +StandardOutput=syslog +StandardError=syslog +SyslogIdentifier=vector + +[Install] +WantedBy=multi-user.target diff --git a/cookbooks/docker/setup.rb b/cookbooks/docker/setup.rb index 56aa5a8..7745fb8 100644 --- a/cookbooks/docker/setup.rb +++ b/cookbooks/docker/setup.rb @@ -52,3 +52,17 @@ template '/etc/vector/docker.toml' do notifies :restart, 'service[vector-docker]' end + +# Deploy `systemd` configuration for `prometheus`: +remote_file '/etc/systemd/system/vector-docker.service' do + owner 'root' + group 'root' + mode '644' + + notifies :restart, 'service[vector-docker]' +end + +# Service setting: +service 'vector-docker' do + action [ :enable, :restart ] +end