From b208ff620eac00ea6dcedd525cd3bf70ae451ef8 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 15 Jan 2023 20:18:50 +0900 Subject: [PATCH] Deploy `digdag` systemd file and enable `digdag`. --- .../files/etc/supervisor/conf.d/digdag.conf | 7 ------- .../files/lib/systemd/system/digdag.service | 15 +++++++++++++++ cookbooks/digdag/setup.rb | 10 ++++------ 3 files changed, 19 insertions(+), 13 deletions(-) delete mode 100644 cookbooks/digdag/files/etc/supervisor/conf.d/digdag.conf create mode 100644 cookbooks/digdag/files/lib/systemd/system/digdag.service diff --git a/cookbooks/digdag/files/etc/supervisor/conf.d/digdag.conf b/cookbooks/digdag/files/etc/supervisor/conf.d/digdag.conf deleted file mode 100644 index eaf346d..0000000 --- a/cookbooks/digdag/files/etc/supervisor/conf.d/digdag.conf +++ /dev/null @@ -1,7 +0,0 @@ -[program:digdag] -command=/etc/digdag/digdag.sh -stdout_logfile=/var/log/supervisor/digdag.log -redirect_stderr=true -stdout_logfile_maxbytes=1MB -stdout_logfile_backups=5 -autorestart=true diff --git a/cookbooks/digdag/files/lib/systemd/system/digdag.service b/cookbooks/digdag/files/lib/systemd/system/digdag.service new file mode 100644 index 0000000..dd0de72 --- /dev/null +++ b/cookbooks/digdag/files/lib/systemd/system/digdag.service @@ -0,0 +1,15 @@ +[Unit] +Description=digdag +Requires=network-online.target +After=network-online.target + +[Service] +Type=simple +EnvironmentFile=-/etc/default/digdag +Restart=on-failure +ExecStart=/etc/digdag/digdag.sh +KillSignal=process + +[Install] +WantedBy=multi-user.target + diff --git a/cookbooks/digdag/setup.rb b/cookbooks/digdag/setup.rb index 2f5e920..53abb9b 100644 --- a/cookbooks/digdag/setup.rb +++ b/cookbooks/digdag/setup.rb @@ -36,17 +36,15 @@ execute 'ufw reload-or-enable' do action :nothing end -# Deploy the config file for `supervisor`: -remote_file '/etc/supervisor/conf.d/digdag.conf' do +# Deploy the config file for `systemd`: +remote_file '/lib/systemd/system/digdag.service' do owner 'root' group 'root' mode '644' - - notifies :restart, 'service[supervisor]' end -service 'supervisor' do - action :nothing +service 'digdag' do + action [ :enable, :restart ] end # Deploy /etc/hosts file: