From b17aebea6099ee9f7e36e7ea47e489c863645f55 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE Date: Thu, 30 Oct 2025 10:56:46 +0000 Subject: [PATCH 01/22] add snowshare --- ct/snowshare.sh | 79 ++++++++++++++++++ frontend/public/json/snowshare.json | 35 ++++++++ install/snowshare-install.sh | 122 ++++++++++++++++++++++++++++ misc/build.func | 2 +- misc/install.func | 2 +- 5 files changed, 238 insertions(+), 2 deletions(-) create mode 100644 ct/snowshare.sh create mode 100644 frontend/public/json/snowshare.json create mode 100644 install/snowshare-install.sh diff --git a/ct/snowshare.sh b/ct/snowshare.sh new file mode 100644 index 000000000..816036f49 --- /dev/null +++ b/ct/snowshare.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: TuroYT +# License: MIT +# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _____ _____ __ + / ___/____ ____ _ __ / ___// /_ ____ ___________ + \__ \/ __ \/ __ \ | /| / / \__ \/ __ \/ __ `/ ___/ _ \ + ___/ / / / / /_/ / |/ |/ / ___/ / / / / /_/ / / / __/ +/____/_/ /_/\____/|__/|__/ /____/_/ /_/\__,_/_/ \___/ + +EOF +} +header_info +echo -e "Loading..." +APP="SnowShare" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/snowshare ]]; then + msg_error "No ${APP} Installation Found!" + exit +fi +msg_info "Updating ${APP}" +systemctl stop snowshare +cd /opt/snowshare +git pull +npm ci +npx prisma generate +npm run build +systemctl start snowshare +msg_ok "Updated ${APP}" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" \ No newline at end of file diff --git a/frontend/public/json/snowshare.json b/frontend/public/json/snowshare.json new file mode 100644 index 000000000..553971987 --- /dev/null +++ b/frontend/public/json/snowshare.json @@ -0,0 +1,35 @@ +{ + "name": "SnowShare", + "slug": "snowshare", + "categories": [ + 11 + ], + "date_created": "2025-09-24", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 3000, + "documentation": "https://github.com/TuroYT/snowshare", + "config_path": "/opt/snowshare/.env", + "website": "https://github.com/TuroYT/snowshare", + "logo": "https://github.com/TuroYT/snowshare/raw/main/public/logo.svg", + "description": "A modern, secure file and link sharing platform built with Next.js, Prisma, and NextAuth. Share URLs, code snippets, and files with customizable expiration, privacy, and QR codes.", + "install_methods": [ + { + "type": "default", + "script": "ct/snowshare.sh", + "resources": { + "cpu": 1, + "ram": 1024, + "hdd": 5, + "os": "Debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] +} \ No newline at end of file diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh new file mode 100644 index 000000000..f1f82aa03 --- /dev/null +++ b/install/snowshare-install.sh @@ -0,0 +1,122 @@ +#!/usr/bin/env bash + +# Couleurs pour les messages +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" + +msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +# Installation des dépendances système +msg_info "Updating system packages" +apt-get update &>/dev/null +apt-get upgrade -y &>/dev/null +msg_ok "Updated system packages" + +msg_info "Installing dependencies" +apt-get install -y curl sudo git wget postgresql postgresql-contrib &>/dev/null +msg_ok "Installed dependencies" + +# Installation de Node.js 20 +msg_info "Installing Node.js" +curl -fsSL https://deb.nodesource.com/setup_20.x | bash - &>/dev/null +apt-get install -y nodejs &>/dev/null +msg_ok "Installed Node.js $(node --version)" + +# Configuration de PostgreSQL +msg_info "Configuring PostgreSQL" +systemctl enable --now postgresql &>/dev/null +sudo -u postgres psql -c "CREATE DATABASE snowshare;" &>/dev/null +sudo -u postgres psql -c "CREATE USER snowshare WITH ENCRYPTED PASSWORD 'snowshare';" &>/dev/null +sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE snowshare TO snowshare;" &>/dev/null +sudo -u postgres psql -c "ALTER DATABASE snowshare OWNER TO snowshare;" &>/dev/null +msg_ok "Configured PostgreSQL" + +# Clonage du dépôt +msg_info "Cloning SnowShare repository" +git clone https://github.com/TuroYT/snowshare.git /opt/snowshare &>/dev/null +cd /opt/snowshare +msg_ok "Cloned repository" + +# Installation des dépendances NPM +msg_info "Installing NPM dependencies" +npm ci &>/dev/null +msg_ok "Installed NPM dependencies" + +# Configuration de l'environnement +msg_info "Configuring environment" +cat < /opt/snowshare/.env +DATABASE_URL="postgresql://snowshare:snowshare@localhost:5432/snowshare" +NEXTAUTH_URL="http://localhost:3000" +NEXTAUTH_SECRET="$(openssl rand -base64 32)" +ALLOW_SIGNUP=true +NODE_ENV=production +EOF +msg_ok "Configured environment" + +# Génération Prisma et migrations +msg_info "Running Prisma migrations" +npx prisma generate &>/dev/null +npx prisma migrate deploy &>/dev/null +msg_ok "Ran Prisma migrations" + +# Build de l'application +msg_info "Building SnowShare" +npm run build &>/dev/null +msg_ok "Built SnowShare" + +# Création du service systemd +msg_info "Creating systemd service" +cat </etc/systemd/system/snowshare.service +[Unit] +Description=SnowShare - Modern File Sharing Platform +After=network.target postgresql.service +Requires=postgresql.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/snowshare +Environment=NODE_ENV=production +ExecStart=/usr/bin/npm start +Restart=on-failure +RestartSec=10 + +[Install] +WantedBy=multi-user.target +EOF +systemctl daemon-reload +systemctl enable --now snowshare.service &>/dev/null +msg_ok "Created systemd service" + +# Configuration du cron pour le nettoyage +msg_info "Setting up cleanup cron job" +(crontab -l 2>/dev/null; echo "0 2 * * * cd /opt/snowshare && /usr/bin/npm run cleanup:expired >> /var/log/snowshare-cleanup.log 2>&1") | crontab - +msg_ok "Setup cleanup cron job" + +# Nettoyage +msg_info "Cleaning up" +apt-get autoremove -y &>/dev/null +apt-get autoclean -y &>/dev/null +msg_ok "Cleaned up" \ No newline at end of file diff --git a/misc/build.func b/misc/build.func index eb2183872..dcb257d75 100644 --- a/misc/build.func +++ b/misc/build.func @@ -2488,7 +2488,7 @@ EOF' install_ssh_keys_into_ct # Run application installer - if ! lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/${var_install}.sh)"; then + if ! lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/TuroYT/ProxmoxVED/refs/heads/add-snowshare/install/${var_install}.sh)"; then exit $? fi } diff --git a/misc/install.func b/misc/install.func index f741b921d..84d4e6fb4 100644 --- a/misc/install.func +++ b/misc/install.func @@ -195,7 +195,7 @@ EOF systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') msg_ok "Customized Container" fi - echo "bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${app}.sh)\"" >/usr/bin/update + echo "bash -c \"\$(curl -fsSL https://github.com/TuroYT/ProxmoxVED/raw/add-snowshare/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then mkdir -p /root/.ssh From abef12462a5baecef7fd43e5fbb8ffe461e8ccee Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE Date: Thu, 30 Oct 2025 14:18:05 +0000 Subject: [PATCH 02/22] some fix --- ct/snowshare.sh | 93 ++++++++------------- install/snowshare-install.sh | 152 ++++++++++++++++------------------- 2 files changed, 103 insertions(+), 142 deletions(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index 816036f49..a7363f88b 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -1,73 +1,43 @@ #!/usr/bin/env bash -source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: TuroYT -# License: MIT -# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/TuroYT/snowshare -function header_info { -clear -cat <<"EOF" - _____ _____ __ - / ___/____ ____ _ __ / ___// /_ ____ ___________ - \__ \/ __ \/ __ \ | /| / / \__ \/ __ \/ __ `/ ___/ _ \ - ___/ / / / / /_/ / |/ |/ / ___/ / / / / /_/ / / / __/ -/____/_/ /_/\____/|__/|__/ /____/_/ /_/\__,_/_/ \___/ - -EOF -} -header_info -echo -e "Loading..." APP="SnowShare" -var_disk="8" -var_cpu="2" -var_ram="2048" -var_os="debian" -var_version="12" +var_tags="${var_tags:-file-sharing}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-8}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" + variables color catch_errors -function default_settings() { - CT_TYPE="1" - PW="" - CT_ID=$NEXTID - HN=$NSAPP - DISK_SIZE="$var_disk" - CORE_COUNT="$var_cpu" - RAM_SIZE="$var_ram" - BRG="vmbr0" - NET="dhcp" - GATE="" - APT_CACHER="" - APT_CACHER_IP="" - DISABLEIP6="no" - MTU="" - SD="" - NS="" - MAC="" - VLAN="" - SSH="no" - VERB="no" - echo_default -} - function update_script() { -header_info -if [[ ! -d /opt/snowshare ]]; then - msg_error "No ${APP} Installation Found!" + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/snowshare ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_info "Updating ${APP}" + systemctl stop snowshare + cd /opt/snowshare + git pull + npm ci + npx prisma generate + npm run build + systemctl start snowshare + msg_ok "Updated ${APP}" exit -fi -msg_info "Updating ${APP}" -systemctl stop snowshare -cd /opt/snowshare -git pull -npm ci -npx prisma generate -npm run build -systemctl start snowshare -msg_ok "Updated ${APP}" -exit } start @@ -75,5 +45,6 @@ build_container description msg_ok "Completed Successfully!\n" -echo -e "${APP} should be reachable by going to the following URL. - ${BL}http://${IP}:3000${CL} \n" \ No newline at end of file +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}:3000${CL}" \ No newline at end of file diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh index f1f82aa03..a107c8556 100644 --- a/install/snowshare-install.sh +++ b/install/snowshare-install.sh @@ -1,93 +1,81 @@ #!/usr/bin/env bash -# Couleurs pour les messages -YW=$(echo "\033[33m") -BL=$(echo "\033[36m") -RD=$(echo "\033[01;31m") -BGN=$(echo "\033[4;92m") -GN=$(echo "\033[1;92m") -DGN=$(echo "\033[32m") -CL=$(echo "\033[m") -BFR="\\r\\033[K" -HOLD="-" -CM="${GN}✓${CL}" -CROSS="${RD}✗${CL}" +# Copyright (c) 2021-2025 community-scripts ORG +# Author: TuroYT +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -msg_info() { - local msg="$1" - echo -ne " ${HOLD} ${YW}${msg}..." -} +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os -msg_ok() { - local msg="$1" - echo -e "${BFR} ${CM} ${GN}${msg}${CL}" -} +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + sudo \ + git \ + make \ + gnupg \ + ca-certificates \ + postgresql \ + postgresql-contrib +msg_ok "Installed Dependencies" -msg_error() { - local msg="$1" - echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" -} - -# Installation des dépendances système -msg_info "Updating system packages" -apt-get update &>/dev/null -apt-get upgrade -y &>/dev/null -msg_ok "Updated system packages" - -msg_info "Installing dependencies" -apt-get install -y curl sudo git wget postgresql postgresql-contrib &>/dev/null -msg_ok "Installed dependencies" - -# Installation de Node.js 20 msg_info "Installing Node.js" -curl -fsSL https://deb.nodesource.com/setup_20.x | bash - &>/dev/null -apt-get install -y nodejs &>/dev/null -msg_ok "Installed Node.js $(node --version)" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js $(node -v)" -# Configuration de PostgreSQL -msg_info "Configuring PostgreSQL" -systemctl enable --now postgresql &>/dev/null -sudo -u postgres psql -c "CREATE DATABASE snowshare;" &>/dev/null -sudo -u postgres psql -c "CREATE USER snowshare WITH ENCRYPTED PASSWORD 'snowshare';" &>/dev/null -sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE snowshare TO snowshare;" &>/dev/null -sudo -u postgres psql -c "ALTER DATABASE snowshare OWNER TO snowshare;" &>/dev/null -msg_ok "Configured PostgreSQL" +msg_info "Setting up PostgreSQL Database" +DB_NAME=snowshare +DB_USER=snowshare +DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" +$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" +$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" +echo "" >>~/snowshare.creds +echo -e "SnowShare Database User: \e[32m$DB_USER\e[0m" >>~/snowshare.creds +echo -e "SnowShare Database Password: \e[32m$DB_PASS\e[0m" >>~/snowshare.creds +echo -e "SnowShare Database Name: \e[32m$DB_NAME\e[0m" >>~/snowshare.creds +msg_ok "Set up PostgreSQL Database" -# Clonage du dépôt -msg_info "Cloning SnowShare repository" -git clone https://github.com/TuroYT/snowshare.git /opt/snowshare &>/dev/null +msg_info "Installing SnowShare (Patience)" +cd /opt +RELEASE=$(curl -s https://api.github.com/repos/TuroYT/snowshare/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +$STD git clone https://github.com/TuroYT/snowshare.git cd /opt/snowshare -msg_ok "Cloned repository" +$STD npm ci +msg_ok "Installed SnowShare" -# Installation des dépendances NPM -msg_info "Installing NPM dependencies" -npm ci &>/dev/null -msg_ok "Installed NPM dependencies" - -# Configuration de l'environnement -msg_info "Configuring environment" -cat < /opt/snowshare/.env -DATABASE_URL="postgresql://snowshare:snowshare@localhost:5432/snowshare" +msg_info "Creating Environment Configuration" +cat </opt/snowshare/.env +DATABASE_URL="postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME" NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_SECRET="$(openssl rand -base64 32)" ALLOW_SIGNUP=true NODE_ENV=production EOF -msg_ok "Configured environment" +msg_ok "Created Environment Configuration" -# Génération Prisma et migrations -msg_info "Running Prisma migrations" -npx prisma generate &>/dev/null -npx prisma migrate deploy &>/dev/null -msg_ok "Ran Prisma migrations" +msg_info "Running Database Migrations" +cd /opt/snowshare +$STD npx prisma generate +$STD npx prisma migrate deploy +msg_ok "Ran Database Migrations" -# Build de l'application msg_info "Building SnowShare" -npm run build &>/dev/null +$STD npm run build msg_ok "Built SnowShare" -# Création du service systemd -msg_info "Creating systemd service" +msg_info "Creating Service" cat </etc/systemd/system/snowshare.service [Unit] Description=SnowShare - Modern File Sharing Platform @@ -106,17 +94,19 @@ RestartSec=10 [Install] WantedBy=multi-user.target EOF -systemctl daemon-reload -systemctl enable --now snowshare.service &>/dev/null -msg_ok "Created systemd service" +systemctl enable -q --now snowshare.service +msg_ok "Created Service" -# Configuration du cron pour le nettoyage -msg_info "Setting up cleanup cron job" -(crontab -l 2>/dev/null; echo "0 2 * * * cd /opt/snowshare && /usr/bin/npm run cleanup:expired >> /var/log/snowshare-cleanup.log 2>&1") | crontab - -msg_ok "Setup cleanup cron job" +msg_info "Setting up Cleanup Cron Job" +cat </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 -# Nettoyage msg_info "Cleaning up" -apt-get autoremove -y &>/dev/null -apt-get autoclean -y &>/dev/null -msg_ok "Cleaned up" \ No newline at end of file +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" \ No newline at end of file From 2fe4119e49713ff3059d5f7bc878b3177e24b2e1 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE Date: Thu, 30 Oct 2025 14:33:50 +0000 Subject: [PATCH 03/22] link --- ct/snowshare.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index a7363f88b..ff993bfbe 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +#source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) + +source <(curl -fsSL https://raw.githubusercontent.com/TuroYT/ProxmoxVED/refs/heads/add-snowshare/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: TuroYT # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE From 21d595ddc7d0aa66756f09bb403654a06790becb Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE Date: Thu, 30 Oct 2025 14:47:50 +0000 Subject: [PATCH 04/22] ok --- install/snowshare-install.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh index a107c8556..0b5d19783 100644 --- a/install/snowshare-install.sh +++ b/install/snowshare-install.sh @@ -36,11 +36,12 @@ msg_info "Setting up PostgreSQL Database" DB_NAME=snowshare DB_USER=snowshare DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" +systemctl enable -q --now postgresql $STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" $STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';" echo "" >>~/snowshare.creds echo -e "SnowShare Database User: \e[32m$DB_USER\e[0m" >>~/snowshare.creds echo -e "SnowShare Database Password: \e[32m$DB_PASS\e[0m" >>~/snowshare.creds @@ -49,7 +50,6 @@ msg_ok "Set up PostgreSQL Database" msg_info "Installing SnowShare (Patience)" cd /opt -RELEASE=$(curl -s https://api.github.com/repos/TuroYT/snowshare/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') $STD git clone https://github.com/TuroYT/snowshare.git cd /opt/snowshare $STD npm ci @@ -72,7 +72,8 @@ $STD npx prisma migrate deploy msg_ok "Ran Database Migrations" msg_info "Building SnowShare" -$STD npm run build +cd /opt/snowshare +npm run build msg_ok "Built SnowShare" msg_info "Creating Service" From 17c77913e27ee3a9d99bf91d2bd5aadcf2fec704 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE Date: Thu, 30 Oct 2025 14:54:22 +0000 Subject: [PATCH 05/22] ready to pr --- ct/snowshare.sh | 10 +++++----- install/snowshare-install.sh | 2 +- misc/build.func | 2 +- misc/install.func | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index ff993bfbe..c8998b809 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -#source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) -source <(curl -fsSL https://raw.githubusercontent.com/TuroYT/ProxmoxVED/refs/heads/add-snowshare/misc/build.func) +#source <(curl -fsSL https://raw.githubusercontent.com/TuroYT/ProxmoxVED/refs/heads/add-snowshare/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: TuroYT # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -9,9 +9,9 @@ source <(curl -fsSL https://raw.githubusercontent.com/TuroYT/ProxmoxVED/refs/hea APP="SnowShare" var_tags="${var_tags:-file-sharing}" -var_cpu="${var_cpu:-2}" -var_ram="${var_ram:-2048}" -var_disk="${var_disk:-8}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-1024}" +var_disk="${var_disk:-5}" var_os="${var_os:-debian}" var_version="${var_version:-12}" var_unprivileged="${var_unprivileged:-1}" diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh index 0b5d19783..8debd978f 100644 --- a/install/snowshare-install.sh +++ b/install/snowshare-install.sh @@ -73,7 +73,7 @@ msg_ok "Ran Database Migrations" msg_info "Building SnowShare" cd /opt/snowshare -npm run build +$STD npm run build msg_ok "Built SnowShare" msg_info "Creating Service" diff --git a/misc/build.func b/misc/build.func index dcb257d75..eb2183872 100644 --- a/misc/build.func +++ b/misc/build.func @@ -2488,7 +2488,7 @@ EOF' install_ssh_keys_into_ct # Run application installer - if ! lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/TuroYT/ProxmoxVED/refs/heads/add-snowshare/install/${var_install}.sh)"; then + if ! lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/${var_install}.sh)"; then exit $? fi } diff --git a/misc/install.func b/misc/install.func index 84d4e6fb4..f741b921d 100644 --- a/misc/install.func +++ b/misc/install.func @@ -195,7 +195,7 @@ EOF systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') msg_ok "Customized Container" fi - echo "bash -c \"\$(curl -fsSL https://github.com/TuroYT/ProxmoxVED/raw/add-snowshare/ct/${app}.sh)\"" >/usr/bin/update + echo "bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then mkdir -p /root/.ssh From 50eaac6b2a57912d1e4e1b6ecf79e7ba77abbe00 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE <53913510+TuroYT@users.noreply.github.com> Date: Thu, 30 Oct 2025 16:04:40 +0100 Subject: [PATCH 06/22] Add jq and fetch latest SnowShare release tag --- install/snowshare-install.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh index 8debd978f..a00494e49 100644 --- a/install/snowshare-install.sh +++ b/install/snowshare-install.sh @@ -17,6 +17,7 @@ $STD apt-get install -y \ curl \ sudo \ git \ + jq \ make \ gnupg \ ca-certificates \ @@ -49,11 +50,23 @@ echo -e "SnowShare Database Name: \e[32m$DB_NAME\e[0m" >>~/snowshare.creds msg_ok "Set up PostgreSQL Database" msg_info "Installing SnowShare (Patience)" +# Find the latest release tag using the GitHub API +LATEST_TAG=$(curl -s "https://api.github.com/repos/TuroYT/snowshare/releases/latest" | jq -r .tag_name) + +if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" == "null" ]; then + msg_error "Failed to fetch the latest release tag from GitHub." + exit 1 +fi +msg_ok "Fetching latest release: $LATEST_TAG" + cd /opt $STD git clone https://github.com/TuroYT/snowshare.git cd /opt/snowshare +$STD git checkout $LATEST_TAG +msg_ok "Checked out $LATEST_TAG" + $STD npm ci -msg_ok "Installed SnowShare" +msg_ok "Installed SnowShare dependencies" msg_info "Creating Environment Configuration" cat </opt/snowshare/.env @@ -110,4 +123,4 @@ customize msg_info "Cleaning up" $STD apt-get -y autoremove $STD apt-get -y autoclean -msg_ok "Cleaned" \ No newline at end of file +msg_ok "Cleaned" From c8b36f3ec50952f5a16ae336158486a598fc0348 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE <53913510+TuroYT@users.noreply.github.com> Date: Thu, 30 Oct 2025 16:07:00 +0100 Subject: [PATCH 07/22] fix update to latest --- ct/snowshare.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index c8998b809..32c1b48b9 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -30,15 +30,71 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - msg_info "Updating ${APP}" - systemctl stop snowshare + + # S'assurer que jq est installé pour l'analyse de l'API + if ! command -v jq &> /dev/null; then + msg_info "Installing 'jq' (required for update check)..." + apt-get update &>/dev/null + apt-get install -y jq &>/dev/null + if ! command -v jq &> /dev/null; then + msg_error "Failed to install 'jq'. Cannot proceed with update." + exit 1 + fi + msg_ok "Installed 'jq'" + fi + + msg_info "Checking for ${APP} updates..." cd /opt/snowshare - git pull + + # Obtenir le tag local actuel + CURRENT_TAG=$(git describe --tags 2>/dev/null) + if [ $? -ne 0 ]; then + msg_warn "Could not determine current version tag. Fetching latest..." + CURRENT_TAG="unknown" + fi + + # Obtenir le tag de la dernière release depuis GitHub + LATEST_TAG=$(curl -s "https://api.github.com/repos/TuroYT/snowshare/releases/latest" | jq -r .tag_name) + + if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" == "null" ]; then + msg_error "Failed to fetch the latest release tag from GitHub." + exit 1 + fi + + msg_info "Current version: $CURRENT_TAG" + msg_info "Latest version: $LATEST_TAG" + + if [ "$CURRENT_TAG" == "$LATEST_TAG" ]; then + msg_ok "${APP} is already up to date." + exit + fi + + msg_info "Updating ${APP} to $LATEST_TAG..." + systemctl stop snowshare + + # Récupérer les nouveaux tags + git fetch --tags + + # Se placer sur le dernier tag + git checkout $LATEST_TAG + if [ $? -ne 0 ]; then + msg_error "Failed to checkout tag $LATEST_TAG. Aborting update." + systemctl start snowshare + exit 1 + fi + + # Relancer les étapes d'installation et de build + msg_info "Installing dependencies..." npm ci + msg_info "Generating Prisma client..." npx prisma generate + msg_info "Applying database migrations..." + npx prisma migrate deploy # Important pour les changements de schéma + msg_info "Building application..." npm run build + systemctl start snowshare - msg_ok "Updated ${APP}" + msg_ok "Updated ${APP} to $LATEST_TAG" exit } @@ -49,4 +105,4 @@ 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}:3000${CL}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}" From 28b6a601c403e5c95c1ad14db28c849ed3c76ea4 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE <53913510+TuroYT@users.noreply.github.com> Date: Fri, 31 Oct 2025 09:37:11 +0100 Subject: [PATCH 08/22] Update ct/snowshare.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- ct/snowshare.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index 32c1b48b9..f515ebd18 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) #source <(curl -fsSL https://raw.githubusercontent.com/TuroYT/ProxmoxVED/refs/heads/add-snowshare/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG From 77a82c78e04e7b06b20494c7f9ec9f72fca1c117 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE <53913510+TuroYT@users.noreply.github.com> Date: Fri, 31 Oct 2025 09:37:20 +0100 Subject: [PATCH 09/22] Update ct/snowshare.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- ct/snowshare.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index f515ebd18..f5a76507f 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) -#source <(curl -fsSL https://raw.githubusercontent.com/TuroYT/ProxmoxVED/refs/heads/add-snowshare/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: TuroYT # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE From 24ddf4fc34a244e242c1b4ffae3af3f23c081df4 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE Date: Fri, 31 Oct 2025 09:38:37 +0000 Subject: [PATCH 10/22] testing --- ct/snowshare.sh | 35 +++++++++++++-------- frontend/public/json/snowshare.json | 2 +- install/snowshare-install.sh | 48 ++++++++++++----------------- 3 files changed, 42 insertions(+), 43 deletions(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index c8998b809..bd2de2f6f 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +#source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) -#source <(curl -fsSL https://raw.githubusercontent.com/TuroYT/ProxmoxVED/refs/heads/add-snowshare/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/TuroYT/ProxmoxVED/refs/heads/add-snowshare/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: TuroYT # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -13,7 +13,7 @@ var_cpu="${var_cpu:-1}" var_ram="${var_ram:-1024}" var_disk="${var_disk:-5}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -30,15 +30,24 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - msg_info "Updating ${APP}" - systemctl stop snowshare - cd /opt/snowshare - git pull - npm ci - npx prisma generate - npm run build - systemctl start snowshare - msg_ok "Updated ${APP}" + + if check_for_gh_release "snowshare" "TuroYT/snowshare"; then + msg_info "Updating ${APP} to v${RELEASE}" + + systemctl stop snowshare + cd /opt/ + fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare" + cd /opt/snowshare + npm ci + npx prisma generate + npm run build + systemctl start snowshare + msg_ok "Updated ${APP}" + exit + + else + msg_ok "No update required. ${APP} is already at v${RELEASE}." + fi exit } @@ -49,4 +58,4 @@ 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}:3000${CL}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}" diff --git a/frontend/public/json/snowshare.json b/frontend/public/json/snowshare.json index 553971987..f952b4b18 100644 --- a/frontend/public/json/snowshare.json +++ b/frontend/public/json/snowshare.json @@ -23,7 +23,7 @@ "ram": 1024, "hdd": 5, "os": "Debian", - "version": "12" + "version": "13" } } ], diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh index 8debd978f..28dd3f3bc 100644 --- a/install/snowshare-install.sh +++ b/install/snowshare-install.sh @@ -4,7 +4,7 @@ # Author: TuroYT # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" color verb_ip6 catch_errors @@ -14,48 +14,41 @@ update_os msg_info "Installing Dependencies" $STD apt-get install -y \ - curl \ - sudo \ - git \ make \ gnupg \ - ca-certificates \ - postgresql \ - postgresql-contrib + ca-certificates + msg_ok "Installed Dependencies" -msg_info "Installing Node.js" -mkdir -p /etc/apt/keyrings -curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg -echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list -$STD apt-get update -$STD apt-get install -y nodejs -msg_ok "Installed Node.js $(node -v)" +setup_nodejs msg_info "Setting up PostgreSQL Database" DB_NAME=snowshare DB_USER=snowshare DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" -systemctl enable -q --now postgresql +setup_postgresql $STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" $STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';" echo "" >>~/snowshare.creds -echo -e "SnowShare Database User: \e[32m$DB_USER\e[0m" >>~/snowshare.creds -echo -e "SnowShare Database Password: \e[32m$DB_PASS\e[0m" >>~/snowshare.creds -echo -e "SnowShare Database Name: \e[32m$DB_NAME\e[0m" >>~/snowshare.creds +echo -e "Database Username: $DB_USER" >>~/snowshare.creds +echo -e "Database Password: $DB_PASS" >>~/snowshare.creds +echo -e "Database Name: $DB_NAME" >>~/snowshare.creds msg_ok "Set up PostgreSQL Database" msg_info "Installing SnowShare (Patience)" +APP="snowshare" cd /opt -$STD git clone https://github.com/TuroYT/snowshare.git + +fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare" + cd /opt/snowshare $STD npm ci -msg_ok "Installed SnowShare" -msg_info "Creating Environment Configuration" +echo "${RELEASE}" >/opt/${APP}_version.txt + cat </opt/snowshare/.env DATABASE_URL="postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME" NEXTAUTH_URL="http://localhost:3000" @@ -63,18 +56,14 @@ NEXTAUTH_SECRET="$(openssl rand -base64 32)" ALLOW_SIGNUP=true NODE_ENV=production EOF -msg_ok "Created Environment Configuration" -msg_info "Running Database Migrations" cd /opt/snowshare $STD npx prisma generate $STD npx prisma migrate deploy msg_ok "Ran Database Migrations" -msg_info "Building SnowShare" cd /opt/snowshare $STD npm run build -msg_ok "Built SnowShare" msg_info "Creating Service" cat </etc/systemd/system/snowshare.service @@ -96,7 +85,7 @@ RestartSec=10 WantedBy=multi-user.target EOF systemctl enable -q --now snowshare.service -msg_ok "Created Service" +msg_ok "Installed SnowShare v${RELEASE}" msg_info "Setting up Cleanup Cron Job" cat </etc/cron.d/snowshare-cleanup @@ -108,6 +97,7 @@ motd_ssh customize msg_info "Cleaning up" -$STD apt-get -y autoremove -$STD apt-get -y autoclean -msg_ok "Cleaned" \ No newline at end of file +$STD apt -y autoremove +$STD apt -y autoclean +$STD apt -y clean +msg_ok "Cleaned" From 89a062bb0b308b85bbb1639cb8bd45c982b40bfb Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE <53913510+TuroYT@users.noreply.github.com> Date: Fri, 31 Oct 2025 11:39:15 +0100 Subject: [PATCH 11/22] Refactor installation script for SnowShare --- install/snowshare-install.sh | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh index 692215aaa..959719998 100644 --- a/install/snowshare-install.sh +++ b/install/snowshare-install.sh @@ -14,13 +14,6 @@ update_os msg_info "Installing Dependencies" $STD apt-get install -y \ -<<<<<<< HEAD -======= - curl \ - sudo \ - git \ - jq \ ->>>>>>> 77a82c78e04e7b06b20494c7f9ec9f72fca1c117 make \ gnupg \ ca-certificates @@ -46,32 +39,18 @@ echo -e "Database Name: $DB_NAME" >>~/snowshare.creds msg_ok "Set up PostgreSQL Database" msg_info "Installing SnowShare (Patience)" -<<<<<<< HEAD + APP="snowshare" -======= -# Find the latest release tag using the GitHub API -LATEST_TAG=$(curl -s "https://api.github.com/repos/TuroYT/snowshare/releases/latest" | jq -r .tag_name) -if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" == "null" ]; then - msg_error "Failed to fetch the latest release tag from GitHub." - exit 1 -fi -msg_ok "Fetching latest release: $LATEST_TAG" - ->>>>>>> 77a82c78e04e7b06b20494c7f9ec9f72fca1c117 cd /opt fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare" cd /opt/snowshare -$STD git checkout $LATEST_TAG -msg_ok "Checked out $LATEST_TAG" + $STD npm ci -<<<<<<< HEAD -======= -msg_ok "Installed SnowShare dependencies" ->>>>>>> 77a82c78e04e7b06b20494c7f9ec9f72fca1c117 + echo "${RELEASE}" >/opt/${APP}_version.txt @@ -123,12 +102,9 @@ motd_ssh customize msg_info "Cleaning up" -<<<<<<< HEAD + $STD apt -y autoremove $STD apt -y autoclean $STD apt -y clean -======= -$STD apt-get -y autoremove -$STD apt-get -y autoclean ->>>>>>> 77a82c78e04e7b06b20494c7f9ec9f72fca1c117 + msg_ok "Cleaned" From 89d5c096db5d83c504e150ed281214e829b46160 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE <53913510+TuroYT@users.noreply.github.com> Date: Fri, 31 Oct 2025 11:40:38 +0100 Subject: [PATCH 12/22] Remove log messages from installation script Removed logging messages for database migrations and service creation. --- install/snowshare-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh index 959719998..c1b7c5a82 100644 --- a/install/snowshare-install.sh +++ b/install/snowshare-install.sh @@ -65,12 +65,12 @@ EOF cd /opt/snowshare $STD npx prisma generate $STD npx prisma migrate deploy -msg_ok "Ran Database Migrations" + cd /opt/snowshare $STD npm run build -msg_info "Creating Service" + cat </etc/systemd/system/snowshare.service [Unit] Description=SnowShare - Modern File Sharing Platform From 477ae6cb86e636ce301b3768d9513d4c6e8ae06a Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE Date: Fri, 31 Oct 2025 10:50:57 +0000 Subject: [PATCH 13/22] tests --- ct/snowshare.sh | 3 ++- misc/build.func | 2 +- misc/install.func | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index 7b1123c15..e92f30296 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +#source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +source <(curl -fsSL https://github.com/TuroYT/ProxmoxVED/raw/refs/heads/add-snowshare/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: TuroYT diff --git a/misc/build.func b/misc/build.func index eb2183872..77e40ce10 100644 --- a/misc/build.func +++ b/misc/build.func @@ -2488,7 +2488,7 @@ EOF' install_ssh_keys_into_ct # Run application installer - if ! lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/${var_install}.sh)"; then + if ! lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://github.com/TuroYT/ProxmoxVED/raw/refs/heads/add-snowshare/install/${var_install}.sh)"; then exit $? fi } diff --git a/misc/install.func b/misc/install.func index f741b921d..1cadbf0c0 100644 --- a/misc/install.func +++ b/misc/install.func @@ -195,7 +195,7 @@ EOF systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') msg_ok "Customized Container" fi - echo "bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${app}.sh)\"" >/usr/bin/update + echo "bash -c \"\$(curl -fsSL https://github.com/TuroYT/ProxmoxVED/raw/refs/heads/add-snowshare/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then mkdir -p /root/.ssh From a44c9364ae6a742064f982e4c97696217ee78f02 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE Date: Fri, 31 Oct 2025 11:03:31 +0000 Subject: [PATCH 14/22] fixed --- ct/snowshare.sh | 9 +++------ install/snowshare-install.sh | 25 ++++++------------------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index e92f30296..5cd6aaa53 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -32,21 +32,18 @@ function update_script() { fi if check_for_gh_release "snowshare" "TuroYT/snowshare"; then - msg_info "Updating ${APP} to v${RELEASE}" - + msg_info "Downloading ${APP}" systemctl stop snowshare - cd /opt/ fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare" cd /opt/snowshare + msg_ok "Downloaded ${APP}" + msg_info "Installing ${APP}" npm ci npx prisma generate npm run build systemctl start snowshare msg_ok "Updated ${APP}" exit - - else - msg_ok "No update required. ${APP} is already at v${RELEASE}." fi exit } diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh index c1b7c5a82..fa2f3ecb4 100644 --- a/install/snowshare-install.sh +++ b/install/snowshare-install.sh @@ -23,6 +23,11 @@ msg_ok "Installed Dependencies" setup_nodejs msg_info "Setting up PostgreSQL Database" +cd /opt + +fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare" + +cd /opt/snowshare DB_NAME=snowshare DB_USER=snowshare DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" @@ -42,18 +47,8 @@ msg_info "Installing SnowShare (Patience)" APP="snowshare" -cd /opt - -fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare" - -cd /opt/snowshare - - $STD npm ci - -echo "${RELEASE}" >/opt/${APP}_version.txt - cat </opt/snowshare/.env DATABASE_URL="postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME" NEXTAUTH_URL="http://localhost:3000" @@ -65,12 +60,8 @@ EOF cd /opt/snowshare $STD npx prisma generate $STD npx prisma migrate deploy - - -cd /opt/snowshare $STD npm run build - cat </etc/systemd/system/snowshare.service [Unit] Description=SnowShare - Modern File Sharing Platform @@ -90,21 +81,17 @@ RestartSec=10 WantedBy=multi-user.target EOF systemctl enable -q --now snowshare.service -msg_ok "Installed SnowShare v${RELEASE}" +msg_ok "Installed SnowShare" msg_info "Setting up Cleanup Cron Job" cat </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 - msg_info "Cleaning up" - $STD apt -y autoremove $STD apt -y autoclean $STD apt -y clean - msg_ok "Cleaned" From f8c397cae1ef70b3ed4a7c7a9f1b0b098dd779bf Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE Date: Fri, 31 Oct 2025 11:10:10 +0000 Subject: [PATCH 15/22] ok --- ct/snowshare.sh | 4 +--- misc/build.func | 2 +- misc/install.func | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index 5cd6aaa53..d91c8c4b5 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -#source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) -source <(curl -fsSL https://github.com/TuroYT/ProxmoxVED/raw/refs/heads/add-snowshare/misc/build.func) - +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: TuroYT # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE diff --git a/misc/build.func b/misc/build.func index 77e40ce10..eb2183872 100644 --- a/misc/build.func +++ b/misc/build.func @@ -2488,7 +2488,7 @@ EOF' install_ssh_keys_into_ct # Run application installer - if ! lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://github.com/TuroYT/ProxmoxVED/raw/refs/heads/add-snowshare/install/${var_install}.sh)"; then + if ! lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/${var_install}.sh)"; then exit $? fi } diff --git a/misc/install.func b/misc/install.func index 1cadbf0c0..f741b921d 100644 --- a/misc/install.func +++ b/misc/install.func @@ -195,7 +195,7 @@ EOF systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') msg_ok "Customized Container" fi - echo "bash -c \"\$(curl -fsSL https://github.com/TuroYT/ProxmoxVED/raw/refs/heads/add-snowshare/ct/${app}.sh)\"" >/usr/bin/update + echo "bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then mkdir -p /root/.ssh From 896299aedff213d4ffd16c1da71874f271aef2e7 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE Date: Fri, 31 Oct 2025 13:47:31 +0000 Subject: [PATCH 16/22] fixed install --- ct/snowshare.sh | 21 +++++++++++++-------- install/snowshare-install.sh | 25 +++++++------------------ 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index d91c8c4b5..093d265ed 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -30,18 +30,23 @@ function update_script() { fi if check_for_gh_release "snowshare" "TuroYT/snowshare"; then - msg_info "Downloading ${APP}" + msg_info "Stopping Service" systemctl stop snowshare + msg_ok "Stopped Service" + fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare" + + msg_info "Updating Snowshare" cd /opt/snowshare - msg_ok "Downloaded ${APP}" - msg_info "Installing ${APP}" - npm ci - npx prisma generate - npm run build + $STD npm ci + $STD npx prisma generate + $STD npm run build + msg_ok "Updated Snowshare" + + msg_info "Starting Service" systemctl start snowshare - msg_ok "Updated ${APP}" - exit + msg_ok "Started Service" + msg_ok "Updated successfully!" fi exit } diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh index fa2f3ecb4..0d8590f8f 100644 --- a/install/snowshare-install.sh +++ b/install/snowshare-install.sh @@ -12,26 +12,18 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt-get install -y \ - make \ - gnupg \ - ca-certificates +NODE_VERSION="22" setup_nodejs -msg_ok "Installed Dependencies" - -setup_nodejs +cd /opt +msg_info "Downloading" +fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare" +msg_ok "Snowshare Downloaded" msg_info "Setting up PostgreSQL Database" -cd /opt - -fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare" - -cd /opt/snowshare +setup_postgresql DB_NAME=snowshare DB_USER=snowshare DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" -setup_postgresql $STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" $STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" @@ -44,11 +36,9 @@ echo -e "Database Name: $DB_NAME" >>~/snowshare.creds msg_ok "Set up PostgreSQL Database" msg_info "Installing SnowShare (Patience)" - APP="snowshare" - +cd /opt/snowshare $STD npm ci - cat </opt/snowshare/.env DATABASE_URL="postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME" NEXTAUTH_URL="http://localhost:3000" @@ -57,7 +47,6 @@ ALLOW_SIGNUP=true NODE_ENV=production EOF -cd /opt/snowshare $STD npx prisma generate $STD npx prisma migrate deploy $STD npm run build From a39be2339d18d2bf48a444be09f13b6e278f9956 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE Date: Sat, 1 Nov 2025 17:34:03 +0100 Subject: [PATCH 17/22] ok --- ct/snowshare.sh | 2 -- install/snowshare-install.sh | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index 093d265ed..f8a06fd96 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -13,9 +13,7 @@ var_disk="${var_disk:-5}" var_os="${var_os:-debian}" var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" - header_info "$APP" - variables color catch_errors diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh index 0d8590f8f..b188c7775 100644 --- a/install/snowshare-install.sh +++ b/install/snowshare-install.sh @@ -12,12 +12,10 @@ setting_up_container network_check update_os -NODE_VERSION="22" setup_nodejs +setup_nodejs cd /opt -msg_info "Downloading" fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare" -msg_ok "Snowshare Downloaded" msg_info "Setting up PostgreSQL Database" setup_postgresql @@ -29,14 +27,15 @@ $STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCO $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';" -echo "" >>~/snowshare.creds -echo -e "Database Username: $DB_USER" >>~/snowshare.creds -echo -e "Database Password: $DB_PASS" >>~/snowshare.creds -echo -e "Database Name: $DB_NAME" >>~/snowshare.creds +{ + echo "SnowShare-Database-Credentials" + echo "Database Username: $DB_USER" + echo "Database Password: $DB_PASS" + echo "Database Name: $DB_NAME" +} >>~/snowshare.creds msg_ok "Set up PostgreSQL Database" msg_info "Installing SnowShare (Patience)" -APP="snowshare" cd /opt/snowshare $STD npm ci cat </opt/snowshare/.env @@ -46,11 +45,9 @@ NEXTAUTH_SECRET="$(openssl rand -base64 32)" ALLOW_SIGNUP=true NODE_ENV=production EOF - $STD npx prisma generate $STD npx prisma migrate deploy $STD npm run build - cat </etc/systemd/system/snowshare.service [Unit] Description=SnowShare - Modern File Sharing Platform @@ -69,7 +66,7 @@ RestartSec=10 [Install] WantedBy=multi-user.target EOF -systemctl enable -q --now snowshare.service +systemctl enable -q --now snowshare msg_ok "Installed SnowShare" msg_info "Setting up Cleanup Cron Job" @@ -77,8 +74,10 @@ cat </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 + msg_info "Cleaning up" $STD apt -y autoremove $STD apt -y autoclean From 8535e8b35711e616adc293c90c98cefd9a6e4bec Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE <53913510+TuroYT@users.noreply.github.com> Date: Mon, 3 Nov 2025 08:09:59 +0100 Subject: [PATCH 18/22] Change environment variable to use .env file --- install/snowshare-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh index b188c7775..b038048ab 100644 --- a/install/snowshare-install.sh +++ b/install/snowshare-install.sh @@ -58,7 +58,7 @@ Requires=postgresql.service Type=simple User=root WorkingDirectory=/opt/snowshare -Environment=NODE_ENV=production +EnvironmentFile=/opt/snowshare/.env ExecStart=/usr/bin/npm start Restart=on-failure RestartSec=10 From 21b7d27dbc2f891dd950f12119196afdb9c94733 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE <53913510+TuroYT@users.noreply.github.com> Date: Mon, 3 Nov 2025 13:01:08 +0100 Subject: [PATCH 19/22] Update logo URL in snowshare.json --- frontend/public/json/snowshare.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/public/json/snowshare.json b/frontend/public/json/snowshare.json index f952b4b18..40433298c 100644 --- a/frontend/public/json/snowshare.json +++ b/frontend/public/json/snowshare.json @@ -12,7 +12,7 @@ "documentation": "https://github.com/TuroYT/snowshare", "config_path": "/opt/snowshare/.env", "website": "https://github.com/TuroYT/snowshare", - "logo": "https://github.com/TuroYT/snowshare/raw/main/public/logo.svg", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/png/snowshare.png", "description": "A modern, secure file and link sharing platform built with Next.js, Prisma, and NextAuth. Share URLs, code snippets, and files with customizable expiration, privacy, and QR codes.", "install_methods": [ { @@ -32,4 +32,4 @@ "password": null }, "notes": [] -} \ No newline at end of file +} From 24832bc29d5e4cbb8ee803603f0975a6e1df91b2 Mon Sep 17 00:00:00 2001 From: Romain PINSOLLE Date: Mon, 3 Nov 2025 14:57:36 +0000 Subject: [PATCH 20/22] fixed --- install/snowshare-install.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh index b038048ab..98e064a15 100644 --- a/install/snowshare-install.sh +++ b/install/snowshare-install.sh @@ -14,11 +14,10 @@ update_os setup_nodejs -cd /opt fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare" -msg_info "Setting up PostgreSQL Database" setup_postgresql +msg_info "Setting up PostgreSQL Database" DB_NAME=snowshare DB_USER=snowshare DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" @@ -35,10 +34,10 @@ $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';" } >>~/snowshare.creds msg_ok "Set up PostgreSQL Database" -msg_info "Installing SnowShare (Patience)" +msg_info "Installing SnowShare" cd /opt/snowshare $STD npm ci -cat </opt/snowshare/.env +cat <.env DATABASE_URL="postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME" NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_SECRET="$(openssl rand -base64 32)" @@ -56,9 +55,8 @@ Requires=postgresql.service [Service] Type=simple -User=root WorkingDirectory=/opt/snowshare -EnvironmentFile=/opt/snowshare/.env +EnvironmentFile=.env ExecStart=/usr/bin/npm start Restart=on-failure RestartSec=10 From a5a59fced4dc499a0afb054ccd496f5fd4cee239 Mon Sep 17 00:00:00 2001 From: Tobias <96661824+CrazyWolf13@users.noreply.github.com> Date: Mon, 3 Nov 2025 16:20:34 +0100 Subject: [PATCH 21/22] fix: env file location --- install/snowshare-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/snowshare-install.sh b/install/snowshare-install.sh index 98e064a15..d31695b64 100644 --- a/install/snowshare-install.sh +++ b/install/snowshare-install.sh @@ -37,7 +37,7 @@ msg_ok "Set up PostgreSQL Database" msg_info "Installing SnowShare" cd /opt/snowshare $STD npm ci -cat <.env +cat </opt/snowshare.env DATABASE_URL="postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME" NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_SECRET="$(openssl rand -base64 32)" @@ -56,7 +56,7 @@ Requires=postgresql.service [Service] Type=simple WorkingDirectory=/opt/snowshare -EnvironmentFile=.env +EnvironmentFile=/opt/snowshare.env ExecStart=/usr/bin/npm start Restart=on-failure RestartSec=10 From 300c2356837000700cf50f225a0153a70aef05b0 Mon Sep 17 00:00:00 2001 From: Tobias <96661824+CrazyWolf13@users.noreply.github.com> Date: Mon, 3 Nov 2025 16:21:07 +0100 Subject: [PATCH 22/22] blank link --- ct/snowshare.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ct/snowshare.sh b/ct/snowshare.sh index f8a06fd96..9241f44db 100644 --- a/ct/snowshare.sh +++ b/ct/snowshare.sh @@ -13,6 +13,7 @@ var_disk="${var_disk:-5}" var_os="${var_os:-debian}" var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" + header_info "$APP" variables color