fixed install

This commit is contained in:
Romain PINSOLLE 2025-10-31 13:47:31 +00:00
parent f8c397cae1
commit 896299aedf
2 changed files with 20 additions and 26 deletions

View File

@ -30,18 +30,23 @@ function update_script() {
fi fi
if check_for_gh_release "snowshare" "TuroYT/snowshare"; then if check_for_gh_release "snowshare" "TuroYT/snowshare"; then
msg_info "Downloading ${APP}" msg_info "Stopping Service"
systemctl stop snowshare systemctl stop snowshare
msg_ok "Stopped Service"
fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare" fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare"
msg_info "Updating Snowshare"
cd /opt/snowshare cd /opt/snowshare
msg_ok "Downloaded ${APP}" $STD npm ci
msg_info "Installing ${APP}" $STD npx prisma generate
npm ci $STD npm run build
npx prisma generate msg_ok "Updated Snowshare"
npm run build
msg_info "Starting Service"
systemctl start snowshare systemctl start snowshare
msg_ok "Updated ${APP}" msg_ok "Started Service"
exit msg_ok "Updated successfully!"
fi fi
exit exit
} }

View File

@ -12,26 +12,18 @@ setting_up_container
network_check network_check
update_os update_os
msg_info "Installing Dependencies" NODE_VERSION="22" setup_nodejs
$STD apt-get install -y \
make \
gnupg \
ca-certificates
msg_ok "Installed Dependencies" cd /opt
msg_info "Downloading"
setup_nodejs fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare"
msg_ok "Snowshare Downloaded"
msg_info "Setting up PostgreSQL Database" msg_info "Setting up PostgreSQL Database"
cd /opt setup_postgresql
fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare"
cd /opt/snowshare
DB_NAME=snowshare DB_NAME=snowshare
DB_USER=snowshare DB_USER=snowshare
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" 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 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 "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 client_encoding TO 'utf8';"
@ -44,11 +36,9 @@ echo -e "Database Name: $DB_NAME" >>~/snowshare.creds
msg_ok "Set up PostgreSQL Database" msg_ok "Set up PostgreSQL Database"
msg_info "Installing SnowShare (Patience)" msg_info "Installing SnowShare (Patience)"
APP="snowshare" APP="snowshare"
cd /opt/snowshare
$STD npm ci $STD npm ci
cat <<EOF >/opt/snowshare/.env cat <<EOF >/opt/snowshare/.env
DATABASE_URL="postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME" DATABASE_URL="postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME"
NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_URL="http://localhost:3000"
@ -57,7 +47,6 @@ ALLOW_SIGNUP=true
NODE_ENV=production NODE_ENV=production
EOF EOF
cd /opt/snowshare
$STD npx prisma generate $STD npx prisma generate
$STD npx prisma migrate deploy $STD npx prisma migrate deploy
$STD npm run build $STD npm run build