From e037ecfa8cc0133a84fbed791b7658c474c3e748 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Tue, 7 Oct 2025 15:51:43 +0300 Subject: Add hommabot jail --- templates/hommabot/etc_crontab.j2 | 10 ++++++++++ templates/hommabot/root_hommabot_deps.sh | 14 ++++++++++++++ templates/hommabot/root_hommabot_env.j2 | 4 ++++ 3 files changed, 28 insertions(+) create mode 100644 templates/hommabot/etc_crontab.j2 create mode 100644 templates/hommabot/root_hommabot_deps.sh create mode 100644 templates/hommabot/root_hommabot_env.j2 (limited to 'templates/hommabot') diff --git a/templates/hommabot/etc_crontab.j2 b/templates/hommabot/etc_crontab.j2 new file mode 100644 index 0000000..556d12a --- /dev/null +++ b/templates/hommabot/etc_crontab.j2 @@ -0,0 +1,10 @@ +# /etc/crontab - root's crontab for FreeBSD +# +# +SHELL=/bin/sh +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin +# +#minute hour mday month wday who command + +# Run hommabot every Monday at 9:00 AM +0 9 * * 1 root /bin/sh -c "cd /root/hommabot && node index.js" diff --git a/templates/hommabot/root_hommabot_deps.sh b/templates/hommabot/root_hommabot_deps.sh new file mode 100644 index 0000000..25c0e56 --- /dev/null +++ b/templates/hommabot/root_hommabot_deps.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -eux +cd /root/hommabot +npm ci + +# We need to build the better-sqlite3.node file before running the app +if [ ! -f build/better_sqlite3.node ]; then ( + mkdir -p build + cd node_modules/better-sqlite3 + npm run build-release + cp build/Release/better_sqlite3.node ../../build/better_sqlite3.node +) +fi diff --git a/templates/hommabot/root_hommabot_env.j2 b/templates/hommabot/root_hommabot_env.j2 new file mode 100644 index 0000000..c66c666 --- /dev/null +++ b/templates/hommabot/root_hommabot_env.j2 @@ -0,0 +1,4 @@ +TELEGRAM_BOT_TOKEN="{{ hommabot_telegram_bot_token }}" +SHEETS_SPREADSHEET_ID="{{ hommabot_sheets_spreadsheet_id }}" +SHEETS_RANGE="{{ hommabot_sheets_range }}" +G_SA_JSON_B64="{{ hommabot_g_sa_json_b64 }}" -- cgit v1.3