Refactor Postgresus update script and update logo URL
Simplifies the update process in ct/postgresus.sh by using a helper function for fetching and deploying releases, streamlining frontend and backend build steps, and improving status messages. Updates the logo URL in frontend/public/json/postgresus.json to use a CDN-hosted image.
This commit is contained in:
parent
8a338f01b7
commit
cf73665ed1
@ -30,65 +30,46 @@ function update_script() {
|
||||
fi
|
||||
|
||||
if check_for_gh_release "RostislavDugin" "postgresus"; then
|
||||
msg_info "Stopping ${APP}"
|
||||
systemctl stop postgresus
|
||||
msg_ok "Stopped ${APP}"
|
||||
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/RostislavDugin/postgresus/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
msg_info "Stopping Postgresus"
|
||||
$STD systemctl stop postgresus
|
||||
msg_ok "Stopped Postgresus"
|
||||
|
||||
msg_info "Backing up Configuration"
|
||||
cp /opt/postgresus/.env /tmp/postgresus.env.bak
|
||||
msg_ok "Backed up Configuration"
|
||||
|
||||
msg_info "Building new version v${RELEASE}"
|
||||
cd /tmp
|
||||
curl -fsSL "https://github.com/RostislavDugin/postgresus/archive/refs/tags/v${RELEASE}.tar.gz" -o postgresus.tar.gz
|
||||
tar -xzf postgresus.tar.gz
|
||||
cd "postgresus-${RELEASE}"
|
||||
fetch_and_deploy_gh_release "postgresus" "RostislavDugin/postgresus" "tarball" "v${RELEASE}" "/opt/postgresus"
|
||||
|
||||
# Build frontend
|
||||
cd frontend
|
||||
msg_info "Updating Postgresus"
|
||||
cd /opt/postgresus/frontend
|
||||
$STD npm ci
|
||||
$STD npm run build
|
||||
cd ..
|
||||
|
||||
# Build backend
|
||||
cd backend
|
||||
cd /opt/postgresus/backend
|
||||
$STD go mod download
|
||||
CGO_ENABLED=0 go build -o /opt/postgresus/postgresus.new ./cmd/main.go
|
||||
cd ..
|
||||
|
||||
# Update files
|
||||
mv /opt/postgresus/postgresus /opt/postgresus/postgresus.backup
|
||||
mv /opt/postgresus/postgresus.new /opt/postgresus/postgresus
|
||||
chmod +x /opt/postgresus/postgresus
|
||||
|
||||
cp -r frontend/dist /opt/postgresus/ui
|
||||
cp -r backend/migrations /opt/postgresus/
|
||||
|
||||
cd /tmp && rm -rf "postgresus-${RELEASE}" postgresus.tar.gz
|
||||
msg_ok "Built new version v${RELEASE}"
|
||||
$STD go build -o ../postgresus ./cmd/main.go
|
||||
cd /opt/postgresus/
|
||||
cp -r frontend/dist ui
|
||||
cp -r backend/migrations .
|
||||
msg_ok "Updated Postgresus"
|
||||
|
||||
msg_info "Restoring Configuration"
|
||||
cp /tmp/postgresus.env.bak /opt/postgresus/.env
|
||||
rm -f /tmp/postgresus.env.bak
|
||||
chown -R postgresus:postgresus /opt/postgresus
|
||||
msg_ok "Restored Configuration"
|
||||
|
||||
msg_info "Starting ${APP}"
|
||||
systemctl start postgresus
|
||||
msg_ok "Started ${APP}"
|
||||
|
||||
msg_ok "Updated Successfully to v${RELEASE}"
|
||||
else
|
||||
msg_ok "No update available"
|
||||
msg_info "Starting Postgresus"
|
||||
$STD systemctl start postgresus
|
||||
msg_ok "Started Postgresus"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit
|
||||
}start
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
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}:4005${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
"interface_port": 80,
|
||||
"documentation": "https://github.com/RostislavDugin/postgresus",
|
||||
"website": "https://github.com/RostislavDugin/postgresus",
|
||||
"logo": "https://raw.githubusercontent.com/RostislavDugin/postgresus/main/frontend/public/logo.svg",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/postgresus.webp",
|
||||
"config_path": "/opt/postgresus/.env",
|
||||
"description": "Free, open source and self-hosted solution for automated PostgreSQL backups. With multiple storage options, notifications, scheduling, and a beautiful web interface for managing database backups across multiple PostgreSQL instances.",
|
||||
"install_methods": [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user