Updating
Updating
In production environments, GO Shortener upgrades follow a deterministic zero-compile workflow. The VPS never compiles source code; it merely downloads and swaps out the precompiled release binary while leaving configuration and databases untouched.
Pre-Upgrade Best Practice: Database Snapshot
Although the upgrade process does not modify your data files, creating a quick snapshot of the SQLite database prior to upgrading is recommended:
# Create a timestamped backup of the database
cp /root/Go-shortner/data/go.sqlite "/root/Go-shortner/data/go-backup-$(date +%Y%m%d%H%M%S).sqlite"
Production Update Workflow
Option 1: Automated Script Upgrade
Run the existing installation script on your server:
sudo bash /root/Go-shortner/install.sh
/root/Go-shortner/.env and /root/Go-shortner/data/go.sqlite. It strictly skips re-creating them, guaranteeing that all existing links, users, sessions, and configuration remain intact.Option 2: Zero-Compile Binary Swap
To perform the upgrade manually with minimum downtime (typically under 1 second):
1. Download the Target Release
Fetch the new binary directly into a staging file:
ARCH=$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
curl -L -o /root/Go-shortner/go-shortener.new "https://github.com/ItsARCn/Go-shortner/releases/latest/download/go-shortener-linux-$ARCH"
chmod +x /root/Go-shortner/go-shortener.new
2. Stop the Service & Swap Executables
Quickly stop the service, move the new binary into place, and start the service:
systemctl stop go-shortener && \
mv /root/Go-shortner/go-shortener.new /root/Go-shortner/go-shortener && \
systemctl start go-shortener
3. Verify Health
Confirm the new version is actively serving traffic:
curl -s http://127.0.0.1:3000/api/health
systemctl status go-shortener
Uninstallation Options
If you ever need to decommission the installation, GO includes a safe uninstaller script (/root/Go-shortner/uninstall.sh):
Safe Uninstall (Preserves Data)
Removes the systemd service and executable, keeping .env and /root/Go-shortner/data/ for future reference:
/root/Go-shortner/uninstall.sh
Complete Purge (Erases Everything)
Permanently deletes the service, configuration, and all stored links and database files:
/root/Go-shortner/uninstall.sh --purge