From bb88b544c64a3b0d4edef3faa09bff4c3a59bdba Mon Sep 17 00:00:00 2001 From: Onni Lampi Date: Sat, 16 Aug 2025 12:33:17 +0300 Subject: Update .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index d06ebd7..98f1019 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ downloads/ node_modules/ .env dist/ +creds +IG_CREDS -- cgit v1.3 From 30efac2becd6dcc6854bb1e896b9ab579b42c3cc Mon Sep 17 00:00:00 2001 From: Onni Lampi Date: Sat, 16 Aug 2025 12:33:46 +0300 Subject: Containerize the application The containers are orchestrated with systemd. --- Containerfile | 11 +++++++++++ deploy_services.sh | 13 +++++++++++++ veetibot.build | 6 ++++++ veetibot.container | 16 ++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 Containerfile create mode 100755 deploy_services.sh create mode 100644 veetibot.build create mode 100644 veetibot.container 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 -- cgit v1.3 From b15d63c86f20dc658fe0a0e92ff06b2ff3a8e844 Mon Sep 17 00:00:00 2001 From: Onni Lampi Date: Sat, 16 Aug 2025 17:19:23 +0300 Subject: Add command requester to log output --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 0615cd7..e2254e7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,7 +36,7 @@ app.command("/veeti", async ({ command, ack, respond, client }) => { return; } - console.log("Received command: /veeti", command.text); + console.log("Received command: /veeti", command.text, " from ", command.user_name); const cmdText = command.text.trim(); const cmdParts = cmdText.split(" "); const url = cmdParts[0]; -- cgit v1.3 From 038b3ae298aefa179cdcb21c881fa5350cf92cb7 Mon Sep 17 00:00:00 2001 From: Onni Lampi Date: Sat, 16 Aug 2025 18:03:12 +0300 Subject: Remove chromium from the container --- Containerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Containerfile b/Containerfile index ad2f88e..2ca7692 100644 --- a/Containerfile +++ b/Containerfile @@ -1,5 +1,5 @@ FROM fedora:latest -RUN dnf install -y npm nodejs tsc yt-dlp chromium +RUN dnf install -y npm nodejs tsc yt-dlp RUN groupadd veetibot && useradd -g veetibot veetibot RUN mkdir /veetibot && chown -R veetibot:veetibot veetibot WORKDIR veetibot -- cgit v1.3