From 9e6e9e77ffd506648b86f5fe31969023caff4525 Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 16:32:44 +0200 Subject: [PATCH] Add peertube (ct) (#16966) --- ct/headers/peertube | 6 ++ ct/peertube.sh | 69 ++++++++++++++++++++ install/peertube-install.sh | 125 ++++++++++++++++++++++++++++++++++++ 3 files changed, 200 insertions(+) create mode 100644 ct/headers/peertube create mode 100644 ct/peertube.sh create mode 100644 install/peertube-install.sh diff --git a/ct/headers/peertube b/ct/headers/peertube new file mode 100644 index 000000000..49726d2ae --- /dev/null +++ b/ct/headers/peertube @@ -0,0 +1,6 @@ + ____ ______ __ + / __ \___ ___ ____/_ __/_ __/ /_ ___ + / /_/ / _ \/ _ \/ ___// / / / / / __ \/ _ \ + / ____/ __/ __/ / / / / /_/ / /_/ / __/ +/_/ \___/\___/_/ /_/ \__,_/_.___/\___/ + diff --git a/ct/peertube.sh b/ct/peertube.sh new file mode 100644 index 000000000..cd21bba22 --- /dev/null +++ b/ct/peertube.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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/Chocobozzz/PeerTube + +APP="PeerTube" +var_tags="${var_tags:-media;video;fediverse}" +var_cpu="${var_cpu:-4}" +var_ram="${var_ram:-4096}" +var_disk="${var_disk:-40}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_gpu="${var_gpu:-yes}" +#var_arm64="${var_arm64:-no}" # unset = ask the user; set yes/no only when verified +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/peertube ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_release "peertube" "Chocobozzz/PeerTube"; then + msg_info "Stopping Service" + systemctl stop peertube + msg_ok "Stopped Service" + + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "peertube" "Chocobozzz/PeerTube" "prebuild" "latest" "/opt/peertube" "peertube-v*.zip" + + msg_info "Installing Node Dependencies (Patience)" + cd /opt/peertube + $STD npm run install-node-dependencies -- --production + msg_ok "Installed Node Dependencies" + + msg_info "Updating Default Configuration" + cp /opt/peertube/config/default.yaml /opt/peertube_data/config/default.yaml + msg_ok "Updated Default Configuration" + + msg_info "Starting Service" + systemctl start peertube + msg_ok "Started Service" + 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}:9000${CL}" +echo -e "${INFO}${YW}The root password was printed to the log on first start:${CL}" +echo -e "${TAB}${DEFAULT}${BGN}journalctl -u peertube | grep -i 'User password'${CL}" diff --git a/install/peertube-install.sh b/install/peertube-install.sh new file mode 100644 index 000000000..a0987bda1 --- /dev/null +++ b/install/peertube-install.sh @@ -0,0 +1,125 @@ +#!/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/Chocobozzz/PeerTube + +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 \ + python3-dev \ + unzip \ + redis-server +systemctl enable -q --now redis-server +msg_ok "Installed Dependencies" + +setup_ffmpeg +setup_hwaccel +PG_VERSION="17" setup_postgresql +PG_DB_NAME="peertube_prod" PG_DB_USER="peertube" PG_DB_EXTENSIONS="pg_trgm,unaccent" setup_postgresql_db +NODE_VERSION="22" NODE_MODULE="pnpm@^10" setup_nodejs + +fetch_and_deploy_gh_release "peertube" "Chocobozzz/PeerTube" "prebuild" "latest" "/opt/peertube" "peertube-v*.zip" + +msg_info "Installing Node Dependencies (Patience)" +cd /opt/peertube +$STD npm run install-node-dependencies -- --production +msg_ok "Installed Node Dependencies" + +msg_info "Configuring PeerTube" +mkdir -p /opt/peertube_data/{config,storage} +cp /opt/peertube/config/default.yaml /opt/peertube_data/config/default.yaml +cat </opt/peertube_data/config/production.yaml +listen: + hostname: '0.0.0.0' + port: 9000 + +webserver: + https: false + hostname: '${LOCAL_IP}' + port: 9000 + +secrets: + peertube: '$(openssl rand -hex 32)' + +database: + hostname: '127.0.0.1' + port: 5432 + ssl: false + suffix: '_prod' + username: 'peertube' + password: '${PG_DB_PASS}' + pool: + max: 5 + +redis: + hostname: '127.0.0.1' + port: 6379 + auth: null + db: 0 + +storage: + tmp: '/opt/peertube_data/storage/tmp/' + tmp_persistent: '/opt/peertube_data/storage/tmp-persistent/' + bin: '/opt/peertube_data/storage/bin/' + avatars: '/opt/peertube_data/storage/avatars/' + web_videos: '/opt/peertube_data/storage/web-videos/' + streaming_playlists: '/opt/peertube_data/storage/streaming-playlists/' + original_video_files: '/opt/peertube_data/storage/original-video-files/' + redundancy: '/opt/peertube_data/storage/redundancy/' + logs: '/opt/peertube_data/storage/logs/' + previews: '/opt/peertube_data/storage/previews/' + thumbnails: '/opt/peertube_data/storage/thumbnails/' + storyboards: '/opt/peertube_data/storage/storyboards/' + torrents: '/opt/peertube_data/storage/torrents/' + captions: '/opt/peertube_data/storage/captions/' + cache: '/opt/peertube_data/storage/cache/' + plugins: '/opt/peertube_data/storage/plugins/' + well_known: '/opt/peertube_data/storage/well-known/' + uploads: '/opt/peertube_data/storage/uploads/' + client_overrides: '/opt/peertube_data/storage/client-overrides/' + +admin: + # Must be a syntactically valid address - PeerTube validates it when creating + # the root user, and an IP as the domain part is rejected (require_tld). + email: 'admin@example.com' +EOF +chmod 750 /opt/peertube_data/config +msg_ok "Configured PeerTube" + +msg_info "Creating Service" +cat </etc/systemd/system/peertube.service +[Unit] +Description=PeerTube daemon +Wants=network-online.target +After=network-online.target postgresql.service redis-server.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/peertube +Environment=NODE_ENV=production +Environment=NODE_CONFIG_DIR=/opt/peertube_data/config +ExecStart=/usr/bin/node dist/server +Restart=always +RestartSec=5 +SyslogIdentifier=peertube + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now peertube +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc