From 9a129d91a5520fbd4b5b7453b0bbd5f3292313bd Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Thu, 30 Apr 2026 07:44:28 +0000 Subject: [PATCH] Add storyteller (ct) --- ct/headers/storyteller | 6 ++ ct/storyteller.sh | 84 +++++++++++++++++++++++++++ install/storyteller-install.sh | 101 +++++++++++++++++++++++++++++++++ 3 files changed, 191 insertions(+) create mode 100644 ct/headers/storyteller create mode 100644 ct/storyteller.sh create mode 100644 install/storyteller-install.sh diff --git a/ct/headers/storyteller b/ct/headers/storyteller new file mode 100644 index 000000000..a6f8620e1 --- /dev/null +++ b/ct/headers/storyteller @@ -0,0 +1,6 @@ + _____ __ __ ____ + / ___// /_____ _______ __/ /____ / / /__ _____ + \__ \/ __/ __ \/ ___/ / / / __/ _ \/ / / _ \/ ___/ + ___/ / /_/ /_/ / / / /_/ / /_/ __/ / / __/ / +/____/\__/\____/_/ \__, /\__/\___/_/_/\___/_/ + /____/ diff --git a/ct/storyteller.sh b/ct/storyteller.sh new file mode 100644 index 000000000..791b64cf6 --- /dev/null +++ b/ct/storyteller.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: community-scripts +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://gitlab.com/storyteller-platform/storyteller + +APP="Storyteller" +var_tags="${var_tags:-media;ebook;audiobook}" +var_cpu="${var_cpu:-4}" +var_ram="${var_ram:-10240}" +var_disk="${var_disk:-20}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +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/storyteller ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + msg_info "Stopping Service" + systemctl stop storyteller + msg_ok "Stopped Service" + + msg_info "Backing up Data" + cp /opt/storyteller/.env /opt/storyteller_env.bak + msg_ok "Backed up Data" + + CLEAN_INSTALL=1 fetch_and_deploy_gl_release "storyteller" "storyteller-platform/storyteller" "tarball" "latest" "/opt/storyteller" + + msg_info "Restoring Configuration" + mv /opt/storyteller_env.bak /opt/storyteller/.env + msg_ok "Restored Configuration" + + msg_info "Rebuilding Storyteller" + cd /opt/storyteller + export NODE_OPTIONS="--max-old-space-size=4096" + $STD yarn install --network-timeout 600000 + $STD gcc -g -fPIC -rdynamic -shared web/sqlite/uuid.c -o web/sqlite/uuid.c.so + export CI=1 + export NODE_ENV=production + export NEXT_TELEMETRY_DISABLED=1 + export SQLITE_NATIVE_BINDING=/opt/storyteller/node_modules/better-sqlite3/build/Release/better_sqlite3.node + $STD yarn workspaces foreach -Rpt --from @storyteller-platform/web --exclude @storyteller-platform/eslint run build + mkdir -p /opt/storyteller/web/.next/standalone/web/.next/static + cp -rT /opt/storyteller/web/.next/static /opt/storyteller/web/.next/standalone/web/.next/static + if [[ -d /opt/storyteller/web/public ]]; then + mkdir -p /opt/storyteller/web/.next/standalone/web/public + cp -rT /opt/storyteller/web/public /opt/storyteller/web/.next/standalone/web/public + fi + mkdir -p /opt/storyteller/web/.next/standalone/web/migrations + cp -rT /opt/storyteller/web/migrations /opt/storyteller/web/.next/standalone/web/migrations + mkdir -p /opt/storyteller/web/.next/standalone/web/sqlite + cp -rT /opt/storyteller/web/sqlite /opt/storyteller/web/.next/standalone/web/sqlite + ln -sf /opt/storyteller/.env /opt/storyteller/web/.next/standalone/web/.env + msg_ok "Rebuilt Storyteller" + + msg_info "Starting Service" + systemctl start storyteller + msg_ok "Started Service" + msg_ok "Updated successfully!" + 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 "${TAB}${GATEWAY}${BGN}http://${IP}:8001${CL}" diff --git a/install/storyteller-install.sh b/install/storyteller-install.sh new file mode 100644 index 000000000..e1796a32b --- /dev/null +++ b/install/storyteller-install.sh @@ -0,0 +1,101 @@ +#!/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://gitlab.com/storyteller-platform/storyteller + +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 \ + build-essential \ + git \ + pkg-config \ + libsqlite3-dev \ + sqlite3 \ + python3 \ + python3-setuptools \ + ffmpeg +msg_ok "Installed Dependencies" + +NODE_VERSION="22" NODE_MODULE="yarn" setup_nodejs + +fetch_and_deploy_gh_release "readium" "readium/cli" "prebuild" "latest" "/opt/readium" "readium_linux_x86_64.tar.gz" +ln -sf /opt/readium/readium /usr/local/bin/readium + +fetch_and_deploy_gl_release "storyteller" "storyteller-platform/storyteller" "tarball" "latest" "/opt/storyteller" + +msg_info "Setting up Storyteller" +cd /opt/storyteller +export NODE_OPTIONS="--max-old-space-size=4096" +$STD yarn install --network-timeout 600000 +$STD gcc -g -fPIC -rdynamic -shared web/sqlite/uuid.c -o web/sqlite/uuid.c.so +STORYTELLER_SECRET_KEY=$(openssl rand -base64 32) +cat </opt/storyteller/.env +STORYTELLER_SECRET_KEY=${STORYTELLER_SECRET_KEY} +STORYTELLER_DATA_DIR=/opt/storyteller/data +PORT=8001 +HOSTNAME=0.0.0.0 +READIUM_PORT=9000 +NODE_ENV=production +NEXT_TELEMETRY_DISABLED=1 +EOF +mkdir -p /opt/storyteller/data +{ + echo "Storyteller Credentials" + echo "=======================" + echo "Secret Key: ${STORYTELLER_SECRET_KEY}" +} >~/storyteller.creds +msg_ok "Set up Storyteller" + +msg_info "Building Storyteller" +cd /opt/storyteller +export CI=1 +export NODE_ENV=production +export NEXT_TELEMETRY_DISABLED=1 +export SQLITE_NATIVE_BINDING=/opt/storyteller/node_modules/better-sqlite3/build/Release/better_sqlite3.node +$STD yarn workspaces foreach -Rpt --from @storyteller-platform/web --exclude @storyteller-platform/eslint run build +mkdir -p /opt/storyteller/web/.next/standalone/web/.next/static +cp -rT /opt/storyteller/web/.next/static /opt/storyteller/web/.next/standalone/web/.next/static +if [[ -d /opt/storyteller/web/public ]]; then + mkdir -p /opt/storyteller/web/.next/standalone/web/public + cp -rT /opt/storyteller/web/public /opt/storyteller/web/.next/standalone/web/public +fi +mkdir -p /opt/storyteller/web/.next/standalone/web/migrations +cp -rT /opt/storyteller/web/migrations /opt/storyteller/web/.next/standalone/web/migrations +mkdir -p /opt/storyteller/web/.next/standalone/web/sqlite +cp -rT /opt/storyteller/web/sqlite /opt/storyteller/web/.next/standalone/web/sqlite +ln -sf /opt/storyteller/.env /opt/storyteller/web/.next/standalone/web/.env +msg_ok "Built Storyteller" + +msg_info "Creating Service" +cat </etc/systemd/system/storyteller.service +[Unit] +Description=Storyteller +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/storyteller/web/.next/standalone/web +EnvironmentFile=/opt/storyteller/.env +ExecStart=/usr/bin/node --enable-source-maps server.js +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now storyteller +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc