From c28a58e1751f0f3de5454cbc2bc3d5ea3f0ed3f6 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Mon, 11 Apr 2022 00:11:37 -0400 Subject: [PATCH] Add systemd setup instructions --- SETUP.md | 21 ++++++++++++++++++- .../matrix-appservice-kakaotalk-node.service | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/SETUP.md b/SETUP.md index b8e0d04..535797d 100644 --- a/SETUP.md +++ b/SETUP.md @@ -41,7 +41,26 @@ These instructions describe how to install and run the bridge manually from a cl * Note that on first use, you must enter a verification code on a smartphone version of KakaoTalk in order for the login to complete ## systemd -Coming soon! +The [systemd](systemd) directory provides sample service unit configuration files for running the bridge & node-kakao modules: + +* `matrix-appservice-kakao.service` for the bridge module +* `matrix-appservice-kakao-node.service` for the node-kakao module + +To use them as-is, follow these steps after [initial setup](#initial-setup): + +1. Place/link your clone of this repository in `/opt/matrix-appservice-kakaotalk` + * If moving your repo directory after having already created a Python virtual environment for the bridge module, re-create the virtual environment after moving to ensure its paths are up-to-date + * Alternatively, clone it to `/opt/matrix-appservice-kakaotalk` in the first place +1. Install the services as either system or user units + * To install as system units: + 1. Copy/link the service files to a directory in the system unit search path, such as `/etc/systemd/system/` + 1. Create the services' configuration directory with `sudo mkdir /etc/matrix-appservice-kakaotalk` + 1. RECOMMENDED: Create the `matrix-appservice-kakaotalk` user on your system with `adduser` or an equivalent command, then uncomment the `User` and `Group` lines in the service files + * To install as user units: + 1. Copy/link the service files to a directory in the user unit search path, such as `~/.config/systemd/user` + 1. Create the services' configuration directory with `mkdir $XDG_CONFIG_HOME/matrix-appservice-kakaotalk` +1. Copy the bridge & node-kakao module configuration files to the services' configuration directory as `config.yaml` and `node-config.json`, respectively +1. Start the services now and on every boot boot with `[sudo] systemd [--user] enable --now matrix-appservice-kakaotalk{,-node}` ## Upgrading Simply `git pull` or `git rebase` the latest changes and rerun any installation commands (`npm install`, `pip install -Ur ...`). diff --git a/systemd/matrix-appservice-kakaotalk-node.service b/systemd/matrix-appservice-kakaotalk-node.service index 474638c..4106c97 100644 --- a/systemd/matrix-appservice-kakaotalk-node.service +++ b/systemd/matrix-appservice-kakaotalk-node.service @@ -10,7 +10,7 @@ NotifyAccess=all WorkingDirectory=/opt/matrix-appservice-kakaotalk/node ConfigurationDirectory=matrix-appservice-kakaotalk RuntimeDirectory=matrix-appservice-kakaotalk -ExecStart=/usr/bin/env node src/main.js --config ${CONFIGURATION_DIRECTORY}/config.json +ExecStart=/usr/bin/env node src/main.js --config ${CONFIGURATION_DIRECTORY}/node-config.json Restart=on-failure RestartSec=3