From bde8234a90dfa842f639eda971516b84ce3e60de Mon Sep 17 00:00:00 2001
From: Enju Aihara <5-EnjuAihara@users.noreply.gitlab.varis.social>
Date: Fri, 4 Mar 2022 18:45:23 +0100
Subject: [PATCH] added service for the mastodon API

---
 README.md                     |  5 ++++-
 services/mastodon_api.service | 10 ++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
 create mode 100644 services/mastodon_api.service

diff --git a/README.md b/README.md
index e90aa5b..3ef6a45 100644
--- a/README.md
+++ b/README.md
@@ -15,10 +15,13 @@ Copy the preloaded database to the live database
 
 Start the mastodon API
 
+Make sure to edit the `User` and `WorkingDirectory` of the service file accordingly.
+
 ```
+sudo cp services/mastodon_api.service /etc/systemd/system
 cd mastodon_api
 yarn install
-node .
+systemctl start mastodon_api
 ```
 
 Fill the database with blocks.
diff --git a/services/mastodon_api.service b/services/mastodon_api.service
new file mode 100644
index 0000000..9e4e748
--- /dev/null
+++ b/services/mastodon_api.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Mastodon API
+
+[Service]
+Type=simple
+Restart=always
+RestartSec=1
+User=
+WorkingDirectory=/fedi-block-api/mastodon_api
+ExecStart=node .
\ No newline at end of file
-- 
GitLab