testing
This commit is contained in:
parent
17c77913e2
commit
24ddf4fc34
@ -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}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
"ram": 1024,
|
||||
"hdd": 5,
|
||||
"os": "Debian",
|
||||
"version": "12"
|
||||
"version": "13"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@ -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 <<EOF >/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 <<EOF >/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 <<EOF >/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"
|
||||
$STD apt -y autoremove
|
||||
$STD apt -y autoclean
|
||||
$STD apt -y clean
|
||||
msg_ok "Cleaned"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user