From 4f18ac7f8849b53148a3df3f8e7cc8ccaf0fe742 Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Sat, 3 Oct 2026 14:47:04 +0000 Subject: [PATCH] Add keeper (ct) --- ct/keeper.sh | 73 +++++++++++++++++++ install/keeper-install.sh | 144 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 217 insertions(+) create mode 100644 ct/keeper.sh create mode 100644 install/keeper-install.sh diff --git a/ct/keeper.sh b/ct/keeper.sh new file mode 100644 index 000000000..7d8a7a353 --- /dev/null +++ b/ct/keeper.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/ridafkih/keeper.sh + +APP="Keeper" +var_tags="${var_tags:-calendar;sync}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-8}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_arm64="${var_arm64:-yes}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/keeper ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_release "keeper" "ridafkih/keeper.sh"; then + msg_info "Stopping Keeper" + systemctl stop keeper-web keeper-worker keeper-cron keeper-api + msg_ok "Stopped Keeper" + + msg_info "Updating Bun" + $STD bun upgrade + msg_ok "Updated Bun" + + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "keeper" "ridafkih/keeper.sh" "tarball" + + msg_info "Building Keeper" + cd /opt/keeper + $STD bun install --frozen-lockfile + $STD bun run --cwd services/api build + $STD bun run --cwd services/cron build + $STD bun run --cwd services/worker build + $STD bun run --cwd applications/web build + msg_ok "Built Keeper" + + msg_info "Migrating Keeper Database" + $STD bun --env-file=/opt/keeper_data/.env packages/database/scripts/migrate.ts + msg_ok "Migrated Keeper Database" + + msg_info "Starting Keeper" + systemctl start keeper-api keeper-cron keeper-worker keeper-web + msg_ok "Started Keeper" + msg_ok "Updated successfully!" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW}Access it using the following URL:${CL}" +echo -e "${GATEWAY}${BGN}http://${IP}:3000${CL}" diff --git a/install/keeper-install.sh b/install/keeper-install.sh new file mode 100644 index 000000000..76e3ac03e --- /dev/null +++ b/install/keeper-install.sh @@ -0,0 +1,144 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/ridafkih/keeper.sh + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt install -y \ + redis-server \ + unzip +msg_ok "Installed Dependencies" + +PG_VERSION="17" setup_postgresql +PG_DB_NAME="keeper" PG_DB_USER="keeper" setup_postgresql_db + +msg_info "Installing Bun" +export BUN_INSTALL="/root/.bun" +curl -fsSL https://bun.sh/install | $STD bash +ln -sf /root/.bun/bin/bun /usr/local/bin/bun +ln -sf /root/.bun/bin/bunx /usr/local/bin/bunx +msg_ok "Installed Bun" + +fetch_and_deploy_gh_release "keeper" "ridafkih/keeper.sh" "tarball" + +msg_info "Building Keeper" +cd /opt/keeper +$STD bun install --frozen-lockfile +$STD bun run --cwd services/api build +$STD bun run --cwd services/cron build +$STD bun run --cwd services/worker build +$STD bun run --cwd applications/web build +msg_ok "Built Keeper" + +msg_info "Configuring Keeper" +mkdir -p /opt/keeper_data +cat </opt/keeper_data/.env +ENV=production +DATABASE_URL=postgresql://keeper:${PG_DB_PASS}@127.0.0.1:5432/keeper +REDIS_URL=redis://127.0.0.1:6379 +BETTER_AUTH_URL=http://${LOCAL_IP}:3000 +BETTER_AUTH_SECRET=$(openssl rand -base64 32) +ENCRYPTION_KEY=$(openssl rand -base64 32) +TRUSTED_ORIGINS=http://${LOCAL_IP}:3000 +API_PORT=3001 +PORT=3000 +VITE_API_URL=http://127.0.0.1:3001 +COMMERCIAL_MODE=false +WORKER_JOB_QUEUE_ENABLED=true +GOOGLE_CLIENT_ID= +GOOGLE_CLIENT_SECRET= +MICROSOFT_CLIENT_ID= +MICROSOFT_CLIENT_SECRET= +EOF +chmod 600 /opt/keeper_data/.env +msg_ok "Configured Keeper" + +msg_info "Migrating Keeper Database" +$STD bun --env-file=/opt/keeper_data/.env packages/database/scripts/migrate.ts +msg_ok "Migrated Keeper Database" + +msg_info "Creating Services" +cat </etc/systemd/system/keeper-api.service +[Unit] +Description=Keeper API +After=network.target postgresql.service redis-server.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/keeper +EnvironmentFile=/opt/keeper_data/.env +ExecStart=/usr/local/bin/bun /opt/keeper/services/api/dist/index.js +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +cat </etc/systemd/system/keeper-cron.service +[Unit] +Description=Keeper Cron +After=network.target postgresql.service redis-server.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/keeper +EnvironmentFile=/opt/keeper_data/.env +ExecStart=/usr/local/bin/bun /opt/keeper/services/cron/dist/index.js +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +cat </etc/systemd/system/keeper-worker.service +[Unit] +Description=Keeper Worker +After=network.target postgresql.service redis-server.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/keeper +EnvironmentFile=/opt/keeper_data/.env +ExecStart=/usr/local/bin/bun /opt/keeper/services/worker/dist/index.js +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +cat </etc/systemd/system/keeper-web.service +[Unit] +Description=Keeper Web +After=network.target keeper-api.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/keeper/applications/web +EnvironmentFile=/opt/keeper_data/.env +ExecStart=/usr/local/bin/bun /opt/keeper/applications/web/dist/server-entry/index.js +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now keeper-api keeper-cron keeper-worker keeper-web +msg_ok "Created Services" + +motd_ssh +customize +cleanup_lxc