summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Containerfile11
-rwxr-xr-xdeploy_services.sh13
-rw-r--r--veetibot.build6
-rw-r--r--veetibot.container16
4 files changed, 46 insertions, 0 deletions
diff --git a/Containerfile b/Containerfile
new file mode 100644
index 0000000..ad2f88e
--- /dev/null
+++ b/Containerfile
@@ -0,0 +1,11 @@
+FROM fedora:latest
+RUN dnf install -y npm nodejs tsc yt-dlp chromium
+RUN groupadd veetibot && useradd -g veetibot veetibot
+RUN mkdir /veetibot && chown -R veetibot:veetibot veetibot
+WORKDIR veetibot
+COPY src src
+COPY package.json .
+COPY tsconfig.json .
+RUN chown -R veetibot:veetibot ./
+USER veetibot
+RUN npm install && npm install puppeteer && npm run build
diff --git a/deploy_services.sh b/deploy_services.sh
new file mode 100755
index 0000000..9549ed2
--- /dev/null
+++ b/deploy_services.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# Script deploys the quadlet files to the user specific directories and lets systemd build the service files.
+# Finally, it copies the generated service file into a static location and enables it.
+
+set -euxo pipefail
+
+export XDG_RUNTIME_DIR="/run/user/$(id -u)"
+cp veetibot.build /home/slack-veetibot/.config/containers/systemd/
+cp veetibot.container /home/slack-veetibot/.config/containers/systemd/
+systemctl --user daemon-reload
+cp /run/user/1005/systemd/generator/veetibot.service /home/slack-veetibot/.config/systemd/user
+systemctl --user enable veetibot
diff --git a/veetibot.build b/veetibot.build
new file mode 100644
index 0000000..c54646a
--- /dev/null
+++ b/veetibot.build
@@ -0,0 +1,6 @@
+[Unit]
+Description=veetibot build service
+
+[Build]
+SetWorkingDirectory=/home/slack-veetibot/veetibot
+ImageTag=veetibot:latest
diff --git a/veetibot.container b/veetibot.container
new file mode 100644
index 0000000..c9307c3
--- /dev/null
+++ b/veetibot.container
@@ -0,0 +1,16 @@
+[Unit]
+Description=veetibot
+
+[Service]
+Restart=always
+RuntimeMaxSec=1d
+
+[Container]
+Image=veetibot.build
+Exec=npm start
+Volume=/home/slack-veetibot/veetibot/.env:/veetibot/.env:ro
+Volume=/home/slack-veetibot/veetibot/IG_CREDS:/veetibot/IG_CREDS:ro
+Volume=/home/slack-veetibot/.config/chromium:/home/veetibot/.config/chromium:ro,U
+
+[Install]
+WantedBy=default.target