From d5cd9fe8b9eea38e4c4d99bfaa640bd0fdcb6f1f Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Wed, 14 Jul 2021 01:36:15 -0400 Subject: [PATCH] Tweak systemd units Changes include: * Remove target unit * Create and use config directory * Use directory directly under /opt as home * Rename suggested user/group * Restart on failure * (aside) Rename Node module name after Chrome unit --- puppet/package.json | 4 ++-- systemd/matrix-puppeteer-line-chrome.service | 19 ++++++++++------- systemd/matrix-puppeteer-line-chrome.target | 5 ----- systemd/matrix-puppeteer-line.service | 22 ++++++++++++-------- 4 files changed, 26 insertions(+), 24 deletions(-) delete mode 100644 systemd/matrix-puppeteer-line-chrome.target diff --git a/puppet/package.json b/puppet/package.json index cb73159..04c935b 100644 --- a/puppet/package.json +++ b/puppet/package.json @@ -1,7 +1,7 @@ { - "name": "matrix-puppeteer-line-puppeteer", + "name": "matrix-puppeteer-line-chrome", "version": "0.1.0", - "description": "Puppeteer module for matrix-puppeteer-line", + "description": "Chrome/Puppeteer backend for matrix-puppeteer-line", "repository": { "type": "git", "url": "git+https://src.miscworks.net/fair/matrix-puppeteer-line.git" diff --git a/systemd/matrix-puppeteer-line-chrome.service b/systemd/matrix-puppeteer-line-chrome.service index 179e612..a3b47f1 100644 --- a/systemd/matrix-puppeteer-line-chrome.service +++ b/systemd/matrix-puppeteer-line-chrome.service @@ -1,15 +1,18 @@ [Unit] -Description=Matrix-puppeteer-line Chrome backend -PartOf=matrix-puppeteer-line-chrome.target +Description=Chrome/Puppeteer backend for matrix-puppeteer-line +After=multi-user.target network.target [Service] -; User=matrix-line -; Group=matrix +; User=matrix-puppeteer-line +; Group=matrix-puppeteer-line Type=notify NotifyAccess=all -WorkingDirectory=/opt/synapse/bridges/matrix-puppeteer-line/puppet -ExecStart=/bin/xvfb-run /usr/bin/node src/main.js -RuntimeDirectory=matrix/puppeteer-line +WorkingDirectory=/opt/matrix-puppeteer-line/puppet +ConfigurationDirectory=matrix-puppeteer-line +RuntimeDirectory=matrix-puppeteer-line +ExecStart=/usr/bin/xvfb-run -a yarn start --config ${CONFIGURATION_DIRECTORY}/puppet-config.json +Restart=on-failure +RestartSec=3 [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target diff --git a/systemd/matrix-puppeteer-line-chrome.target b/systemd/matrix-puppeteer-line-chrome.target deleted file mode 100644 index 98b981a..0000000 --- a/systemd/matrix-puppeteer-line-chrome.target +++ /dev/null @@ -1,5 +0,0 @@ -[Unit] -Description=Matrix puppeteer line bridge target -Requires=multi-user.target network.target -After=multi-user.target network.target -BindsTo=matrix-puppeteer-line-chrome.service diff --git a/systemd/matrix-puppeteer-line.service b/systemd/matrix-puppeteer-line.service index ff1f259..6b60870 100644 --- a/systemd/matrix-puppeteer-line.service +++ b/systemd/matrix-puppeteer-line.service @@ -1,14 +1,18 @@ [Unit] -Description=Matrix-puppeteer-line bridge -BindsTo=matrix-puppeteer-line-chrome.target -After=matrix-puppeteer-line-chrome.target +Description=matrix-puppeteer-line bridge +BindsTo=matrix-puppeteer-line-chrome.service +PartOf=matrix-puppeteer-line-chrome.service +After=matrix-puppeteer-line-chrome.service [Service] -; User=matrix-line -; Group=matrix -WorkingDirectory=/opt/synapse/bridges/matrix-puppeteer-line -ExecStart=/opt/synapse/bridges/matrix-puppeteer-line/.venv/bin/python -m matrix_puppeteer_line -RuntimeDirectory=matrix/puppeteer-line +; User=matrix-puppeteer-line +; Group=matrix-puppeteer-line +WorkingDirectory=/opt/matrix-puppeteer-line +ConfigurationDirectory=matrix-puppeteer-line +RuntimeDirectory=matrix-puppeteer-line +ExecStart=/opt/matrix-puppeteer-line/.venv/bin/python -m matrix_puppeteer_line -c ${CONFIGURATION_DIRECTORY}/config.yaml +Restart=on-failure +RestartSec=3 [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target