Files
ProxmoxVE/install/cryptpad-install.sh
T
CanbiZ (MickLesk) 891be92dc9 Refactor: Cryptpad (#18065)
* CryptPad: configure 2026.10.0 through infra.js

2026.10.0 moved the origins, host and ports from config.js to infra.js and no longer derives the sandbox origin, so updated instances pointed the sandbox at the browser's own localhost and hung at 'loading drive' (#18063). Update builds infra.js once from config.js, install writes it directly (the config.js seds matched nothing anymore). install-onlyoffice.sh is now install-office.sh; update runs it only where office was installed.

* CryptPad: repair instances already on 2026.10.0

Instances updated before this fix have no infra.js but already the new version, so the migration would wait for the next release. Update runs again for them, and a config.js from the 2026.10.0 example (no origin at all) gets the container address like a fresh install.
2026-10-22 13:50:33 +02:00

69 lines
1.7 KiB
Bash

#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: Slaviša Arežina (tremor021)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/cryptpad/cryptpad
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 git
msg_ok "Installed Dependencies"
NODE_VERSION="22" setup_nodejs
onlyoffice="${var_cryptpad_onlyoffice:-}"
[[ -n "$onlyoffice" ]] || read -rp "${TAB3}Install OnlyOffice components instead of CKEditor? (Y/N): " onlyoffice
fetch_and_deploy_gh_release "cryptpad" "cryptpad/cryptpad" "tarball"
msg_info "Setup CryptPad"
cd /opt/cryptpad
$STD npm ci --allow-git=all
$STD npm run install:components
if [[ "${onlyoffice,,}" =~ ^(y|yes)$ ]]; then
$STD bash -c "./install-office.sh --accept-license"
fi
cp config/config.example.js config/config.js
cp config/infra.example.js config/infra.js
sed -i \
-e "s|origin: \"http://localhost:3000\"|origin: \"http://${LOCAL_IP}:3000\"|" \
-e "s|sandboxOrigin: \"http://localhost:3001\"|sandboxOrigin: \"http://${LOCAL_IP}:3001\"|" \
-e "s|httpHost: \"localhost\"|httpHost: \"0.0.0.0\"|" \
config/infra.js
$STD npm run build
msg_ok "Setup CryptPad"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/cryptpad.service
[Unit]
Description=CryptPad Service
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/cryptpad
ExecStart=/usr/bin/node server
Environment='PWD="/opt/cryptpad"'
StandardOutput=journal
StandardError=journal+console
LimitNOFILE=1000000
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now cryptpad
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc