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