Compare commits

..

1 Commits

Author SHA1 Message Date
push-app-to-main[bot]
fba2e34605 Add streamystats (ct) 2026-10-25 12:05:21 +00:00
4 changed files with 170 additions and 142 deletions

View File

@@ -1,72 +0,0 @@
#!/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/emdash-cms/emdash
APP="EmDash"
var_tags="${var_tags:-cms;blog}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-3072}"
var_disk="${var_disk:-6}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-yes}"
var_unprivileged="${var_unprivileged:-1}"
export var_emdash_url="${var_emdash_url:-}"
export var_emdash_template="${var_emdash_template:-}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/emdash ]]; then
msg_error "No EmDash Installation Found!"
exit
fi
if check_for_gh_release "emdash" "emdash-cms/emdash" "" "" "emdash@"; then
msg_info "Stopping EmDash"
systemctl stop emdash
msg_ok "Stopped EmDash"
NODE_VERSION="24" NODE_MODULE="pnpm@11" setup_nodejs
msg_info "Updating EmDash"
cd /opt/emdash
set -a && source /opt/emdash_data/.env && set +a
$STD pnpm add "${CHECK_UPDATE_RELEASE}"
$STD pnpm build
$STD pnpm store prune
cat <<EOF >~/.emdash
${CHECK_UPDATE_RELEASE}
EOF
msg_ok "Updated EmDash"
msg_info "Starting EmDash"
systemctl start emdash
msg_ok "Started EmDash"
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}:4321${CL}"
echo -e "${INFO}${YW}The admin at /_emdash/admin signs in with passkeys only, and browsers allow those on HTTPS with a domain or on localhost, never on an IP address.${CL}"
echo -e "${INFO}${YW}Put EmDash behind a reverse proxy with a trusted certificate, set EMDASH_SITE_URL in /opt/emdash_data/.env to that address and rebuild (see the notes), then create the admin there.${CL}"

70
ct/streamystats.sh Normal file
View File

@@ -0,0 +1,70 @@
#!/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/fredrikburmester/streamystats
APP="Streamystats"
var_tags="${var_tags:-analytics;jellyfin}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-3072}"
var_disk="${var_disk:-10}"
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/streamystats ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "streamystats" "fredrikburmester/streamystats"; then
msg_info "Stopping Streamystats"
systemctl stop streamystats-nextjs-app streamystats-job-server
msg_ok "Stopped Streamystats"
msg_info "Updating Bun"
$STD bun upgrade
msg_ok "Updated Bun"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "streamystats" "fredrikburmester/streamystats" "tarball"
msg_info "Building Streamystats"
cd /opt/streamystats
$STD bun install --frozen-lockfile
NEXT_TELEMETRY_DISABLED=1 NEXT_PUBLIC_VERSION="v$(cat ~/.streamystats)" $STD bun run build
msg_ok "Built Streamystats"
msg_info "Migrating Streamystats Database"
$STD bun --env-file=/opt/streamystats_data/.env run db:migrate
msg_ok "Migrated Streamystats Database"
msg_info "Starting Streamystats"
systemctl start streamystats-job-server streamystats-nextjs-app
msg_ok "Started Streamystats"
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}"

View File

@@ -1,70 +0,0 @@
#!/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/emdash-cms/emdash
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
NODE_VERSION="24" NODE_MODULE="pnpm@11" setup_nodejs
msg_info "Creating EmDash Site"
cd /opt
$STD pnpm dlx create-emdash@latest emdash --platform node --template "${var_emdash_template:-blog}" --pm pnpm --no-install --yes
mkdir -p /opt/emdash_data/uploads
mv /opt/emdash/.env /opt/emdash_data/.env
sed -i -e 's|file:./data.db|file:/opt/emdash_data/data.db|' -e 's|"./uploads"|"/opt/emdash_data/uploads"|' /opt/emdash/astro.config.mjs
cat <<EOF >>/opt/emdash_data/.env
HOST=0.0.0.0
PORT=4321
# The address in the browser bar. Passkeys are bound to its hostname, and the build bakes it in for image optimization:
# after a change run cd /opt/emdash && set -a && . /opt/emdash_data/.env && set +a && pnpm build && systemctl restart emdash
EMDASH_SITE_URL=${var_emdash_url:-http://${LOCAL_IP}:4321}
EOF
chmod 600 /opt/emdash_data/.env
msg_ok "Created EmDash Site"
msg_info "Building EmDash"
cd /opt/emdash
# pnpm keeps Astro's sharp out of the site's reach, and every /_image request then fails with MissingSharp
$STD pnpm add sharp
set -a && source /opt/emdash_data/.env && set +a
$STD pnpm build
cat <<EOF >~/.emdash
emdash@$(node -p 'require("/opt/emdash/node_modules/emdash/package.json").version')
EOF
msg_ok "Built EmDash"
msg_info "Creating EmDash Service"
cat <<EOF >/etc/systemd/system/emdash.service
[Unit]
Description=EmDash
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/emdash
EnvironmentFile=/opt/emdash_data/.env
Environment=NODE_ENV=production
ExecStart=/usr/bin/node /opt/emdash/dist/server/entry.mjs
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now emdash
msg_ok "Created EmDash Service"
motd_ssh
customize
cleanup_lxc

View File

@@ -0,0 +1,100 @@
#!/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/fredrikburmester/streamystats
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 unzip
msg_ok "Installed Dependencies"
PG_VERSION="17" PG_MODULES="pgvector" setup_postgresql
PG_DB_NAME="streamystats" PG_DB_USER="streamystats" PG_DB_EXTENSIONS="vector,pg_trgm,uuid-ossp" 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 "streamystats" "fredrikburmester/streamystats" "tarball"
msg_info "Building Streamystats"
cd /opt/streamystats
$STD bun install --frozen-lockfile
NEXT_TELEMETRY_DISABLED=1 NEXT_PUBLIC_VERSION="v$(cat ~/.streamystats)" $STD bun run build
msg_ok "Built Streamystats"
msg_info "Configuring Streamystats"
mkdir -p /opt/streamystats_data
cat <<EOF >/opt/streamystats_data/.env
NODE_ENV=production
NEXT_TELEMETRY_DISABLED=1
DATABASE_URL=postgresql://streamystats:${PG_DB_PASS}@127.0.0.1:5432/streamystats
JOB_SERVER_URL=http://127.0.0.1:3005
NEXTJS_URL=http://127.0.0.1:3000
SESSION_SECRET=$(openssl rand -hex 64)
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY=$(openssl rand -base64 32)
EOF
chmod 600 /opt/streamystats_data/.env
msg_ok "Configured Streamystats"
msg_info "Migrating Streamystats Database"
$STD bun --env-file=/opt/streamystats_data/.env run db:migrate
msg_ok "Migrated Streamystats Database"
msg_info "Creating Services"
cat <<EOF >/etc/systemd/system/streamystats-job-server.service
[Unit]
Description=Streamystats Job Server
After=network.target postgresql.service
[Service]
Type=simple
User=root
WorkingDirectory=/opt/streamystats/apps/job-server
EnvironmentFile=/opt/streamystats_data/.env
Environment=HOST=127.0.0.1
Environment=PORT=3005
ExecStart=/usr/local/bin/bun run start
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
cat <<EOF >/etc/systemd/system/streamystats-nextjs-app.service
[Unit]
Description=Streamystats Web
After=network.target streamystats-job-server.service
Wants=streamystats-job-server.service
[Service]
Type=simple
User=root
WorkingDirectory=/opt/streamystats/apps/nextjs-app
EnvironmentFile=/opt/streamystats_data/.env
Environment=PORT=3000
ExecStart=/usr/local/bin/bun run start
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now streamystats-job-server streamystats-nextjs-app
msg_ok "Created Services"
motd_ssh
customize
cleanup_lxc