mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-05-22 00:24:42 +00:00
9d0c174de1
* snowshare: use mv instead of cp for uploads backup to prevent disk fill Replaces cp -a with mv when backing up and restoring /opt/snowshare/uploads during updates. cp -a duplicated the entire uploads directory on each update, which could fill the disk on instances with large uploads and left stale backup directories accumulating across failed updates. mv is atomic on the same filesystem and avoids any data duplication. Also clears any leftover backup directory before the move to prevent nesting on interrupted updates. Refs TuroYT/snowshare#258 * snowshare: use UPLOAD_DIR env to persist uploads outside install dir Set UPLOAD_DIR=/opt/snowshare_data in the env file so uploads live outside /opt/snowshare and survive CLEAN_INSTALL updates without any backup/restore step. Existing installations are migrated on first update by moving uploads to the new location and appending UPLOAD_DIR to the env file, making the change non-breaking.
68 lines
1.7 KiB
Bash
68 lines
1.7 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright (c) 2021-2026 community-scripts ORG
|
|
# Author: TuroYT
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
# Source: https://github.com/TuroYT/snowshare
|
|
|
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
color
|
|
verb_ip6
|
|
catch_errors
|
|
setting_up_container
|
|
network_check
|
|
update_os
|
|
|
|
NODE_VERSION="24" setup_nodejs
|
|
PG_VERSION="17" setup_postgresql
|
|
PG_DB_USER="snowshare" PG_DB_NAME="snowshare" setup_postgresql_db
|
|
fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare" "tarball"
|
|
|
|
msg_info "Installing SnowShare"
|
|
cd /opt/snowshare
|
|
$STD npm ci
|
|
mkdir -p /opt/snowshare_data
|
|
cat <<EOF >/opt/snowshare.env
|
|
DATABASE_URL="postgresql://$PG_DB_USER:$PG_DB_PASS@localhost:5432/$PG_DB_NAME"
|
|
NEXTAUTH_URL="http://localhost:3000"
|
|
NEXTAUTH_SECRET="$(openssl rand -base64 32)"
|
|
ALLOW_SIGNUP=true
|
|
NODE_ENV=production
|
|
UPLOAD_DIR=/opt/snowshare_data
|
|
EOF
|
|
set -a
|
|
source /opt/snowshare.env
|
|
set +a
|
|
$STD npx prisma generate
|
|
$STD npx prisma migrate deploy
|
|
$STD npm run build
|
|
cat <<EOF >/etc/systemd/system/snowshare.service
|
|
[Unit]
|
|
Description=SnowShare - Modern File Sharing Platform
|
|
After=network.target postgresql.service
|
|
Requires=postgresql.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
WorkingDirectory=/opt/snowshare
|
|
EnvironmentFile=/opt/snowshare.env
|
|
ExecStart=/usr/bin/npm start
|
|
Restart=on-failure
|
|
RestartSec=10
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
systemctl enable -q --now snowshare
|
|
msg_ok "Installed SnowShare"
|
|
|
|
msg_info "Setting up Cleanup Cron Job"
|
|
cat <<EOF >/etc/cron.d/snowshare-cleanup
|
|
0 2 * * * root cd /opt/snowshare && /usr/bin/npm run cleanup:expired >> /var/log/snowshare-cleanup.log 2>&1
|
|
EOF
|
|
msg_ok "Set up Cleanup Cron Job"
|
|
|
|
motd_ssh
|
|
customize
|
|
cleanup_lxc
|