fixed
This commit is contained in:
parent
477ae6cb86
commit
a44c9364ae
@ -32,21 +32,18 @@ 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 "Updating ${APP} to v${RELEASE}"
|
msg_info "Downloading ${APP}"
|
||||||
|
|
||||||
systemctl stop snowshare
|
systemctl stop snowshare
|
||||||
cd /opt/
|
|
||||||
fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare"
|
fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare"
|
||||||
cd /opt/snowshare
|
cd /opt/snowshare
|
||||||
|
msg_ok "Downloaded ${APP}"
|
||||||
|
msg_info "Installing ${APP}"
|
||||||
npm ci
|
npm ci
|
||||||
npx prisma generate
|
npx prisma generate
|
||||||
npm run build
|
npm run build
|
||||||
systemctl start snowshare
|
systemctl start snowshare
|
||||||
msg_ok "Updated ${APP}"
|
msg_ok "Updated ${APP}"
|
||||||
exit
|
exit
|
||||||
|
|
||||||
else
|
|
||||||
msg_ok "No update required. ${APP} is already at v${RELEASE}."
|
|
||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,11 @@ msg_ok "Installed Dependencies"
|
|||||||
setup_nodejs
|
setup_nodejs
|
||||||
|
|
||||||
msg_info "Setting up PostgreSQL Database"
|
msg_info "Setting up PostgreSQL Database"
|
||||||
|
cd /opt
|
||||||
|
|
||||||
|
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)"
|
||||||
@ -42,18 +47,8 @@ msg_info "Installing SnowShare (Patience)"
|
|||||||
|
|
||||||
APP="snowshare"
|
APP="snowshare"
|
||||||
|
|
||||||
cd /opt
|
|
||||||
|
|
||||||
fetch_and_deploy_gh_release "snowshare" "TuroYT/snowshare"
|
|
||||||
|
|
||||||
cd /opt/snowshare
|
|
||||||
|
|
||||||
|
|
||||||
$STD npm ci
|
$STD npm ci
|
||||||
|
|
||||||
|
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
|
||||||
|
|
||||||
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"
|
||||||
@ -65,12 +60,8 @@ EOF
|
|||||||
cd /opt/snowshare
|
cd /opt/snowshare
|
||||||
$STD npx prisma generate
|
$STD npx prisma generate
|
||||||
$STD npx prisma migrate deploy
|
$STD npx prisma migrate deploy
|
||||||
|
|
||||||
|
|
||||||
cd /opt/snowshare
|
|
||||||
$STD npm run build
|
$STD npm run build
|
||||||
|
|
||||||
|
|
||||||
cat <<EOF >/etc/systemd/system/snowshare.service
|
cat <<EOF >/etc/systemd/system/snowshare.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=SnowShare - Modern File Sharing Platform
|
Description=SnowShare - Modern File Sharing Platform
|
||||||
@ -90,21 +81,17 @@ RestartSec=10
|
|||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl enable -q --now snowshare.service
|
systemctl enable -q --now snowshare.service
|
||||||
msg_ok "Installed SnowShare v${RELEASE}"
|
msg_ok "Installed SnowShare"
|
||||||
|
|
||||||
msg_info "Setting up Cleanup Cron Job"
|
msg_info "Setting up Cleanup Cron Job"
|
||||||
cat <<EOF >/etc/cron.d/snowshare-cleanup
|
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
|
0 2 * * * root cd /opt/snowshare && /usr/bin/npm run cleanup:expired >> /var/log/snowshare-cleanup.log 2>&1
|
||||||
EOF
|
EOF
|
||||||
msg_ok "Set up Cleanup Cron Job"
|
msg_ok "Set up Cleanup Cron Job"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
|
|
||||||
$STD apt -y autoremove
|
$STD apt -y autoremove
|
||||||
$STD apt -y autoclean
|
$STD apt -y autoclean
|
||||||
$STD apt -y clean
|
$STD apt -y clean
|
||||||
|
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user