Data backup and version updates
Back up the database manually or on a schedule, download and restore backups, then update LDPage to a new version, manage the licence and turn on automatic updates.
When to use backups and updates#
The Backup tab (Admin › Settings › Backup — Sao lưu, Operations group) creates PostgreSQL database backups immediately or on a schedule, keeps a limited number of copies and lets you download .sql.gz files. These backups do not include source code or image files stored in MinIO. The Version updates page (Admin › Cập nhật phiên bản) checks for new releases, updates the source code, lets you roll back and manages the licence key.
1. Create and download a backup#
- 1
Open Admin › Settings and choose Backup (Sao lưu) under Operations. The four top cards show the number of Backups (how many are kept at most and how many are pinned), Size and free disk space, the Latest backup and the Next run of the schedule.
- 2
Click Back up now (Sao lưu ngay) in the Database backups panel. The new backup shows Waiting, Running, then Completed (or Failed). The Time column shows Manual with the name of whoever clicked, or Automatic.
- 3
Click the download icon at the end of a row to Download (.sql.gz). Re-enter your password when asked; the download link works once, within 60 seconds.
- 4
Each row's … menu has: Pin (never auto-delete) to keep an important backup forever (the row shows a yellow star), Unpin, Send via Telegram, Copy SHA-256 to verify the downloaded file, and Delete (permanently removes it from the server). A running backup cannot be deleted yet.
2. Automatic backups and sending files via Telegram#
- 1
In the Automatic backup panel (Sao lưu tự động), turn on Enable scheduled backup (Bật sao lưu theo lịch).
- 2
Choose the Frequency (Tần suất): Every few hours (pick an Interval of 1, 2, 3, 4, 6, 8 or 12 hours), Daily, or Weekly (also pick the weekday). Set the run time in At (Lúc), 02:00 by default. The schedule follows the time zone in Settings › General, shown just below.
- 3
Maximum backups kept: 1 to 100 (default 7). Older backups are deleted automatically, except pinned ones.
- 4
For an off-server copy, turn on Send file via Telegram (Gửi file qua Telegram): after each successful automatic backup the file is sent through the Telegram bot. Leave Chat ID to receive the file empty to use the bot's Chat ID from the Connections tab.
- 5
Click Save (Lưu). Turning on file sending or changing the receiving Chat ID requires re-entering your password.
3. Restore data#
Files on the server are AES-256 encrypted, randomly named and have no public link. A .sql.gz file downloaded from the admin area is already decrypted and can be used directly for restoring. Open How to restore in the Security panel to see sample commands.
- 1
Copy the .sql.gz file to the server and go to the LDPage source root.
- 2
Run ./infra/docker/restore-db.sh <file-name>.sql.gz. This OVERWRITES the current database, so create a fresh backup before running it.
- 3
If PostgreSQL runs outside Docker, you can restore with gunzip -c <file-name>.sql.gz | psql -h HOST -U USER -d DB.
- 4
To back up both the database and the image files in MinIO, run ./infra/docker/backup.sh ./backups on the server (creates a .tar.gz) and restore with ./infra/docker/restore.sh. Schedule backup.sh daily with cron and sync the files to another server.
4. Update the version#
- 1
Open Admin › Version updates (Cập nhật phiên bản). The Running version card shows the version number, a Latest or Update available tag, and when it was last checked. Click Check again (Kiểm tra lại) to ask the release server right away. When a new version exists, the admin top bar also shows a New version vX tag.
- 2
Read What's new (Có gì mới) to see the changes in the new release.
- 3
Click Update now (Cập nhật ngay) and confirm. The database is backed up first; the website may be interrupted for a few seconds while restarting. Progress goes through: Downloading the update package, Extracting, Backing up the database, Installing libraries, Building, Updating the database, Switching to the new version, Restarting, Update complete.
- 4
You can close the page during the update; it keeps running on the server. If it reports Update failed, open the accompanying Log and Backup to investigate.
- 5
One-click updating only works when LDPage runs under PM2. Otherwise the page says this installation cannot update itself: click Download package (Tải gói) to get the zip and run apply-update.sh on the server (bash apply-update.sh --zip <path-to-zip>).
- 6
Version history lists the most recent releases. Click Roll back (Quay về) to return to an older release: only the source code is rolled back, not the database, and Automatic updates are turned off.
5. Licence and automatic updates#
- 1
The Licence card (Giấy phép) shows the status (Active, Expired, Suspended, Invalid), Product, Licence holder, Email, Service code, Valid until (Permanent or days remaining) and the licensed Domain.
- 2
To change the key, open Replace licence key (Thay khoá giấy phép), paste the new key and click Save. The key is stored encrypted and never shown again.
- 3
Turn on Automatic updates (Tự động cập nhật) so the platform checks for new versions every 30 minutes and applies them. It only runs on PM2 installations; each version is tried at most 3 times, after which the page asks you to update manually.
- 4
If the licence has not been entered, is rejected or cannot be verified, the whole /admin area is replaced by the Activate licence screen. The owner enters the Licence key and clicks Activate (Kích hoạt), or Check again; staff only see a message asking them to contact the owner. The customer area and published landing pages are not affected.
Notes#
- 1
Backups live on the same server as the website; download important ones or use Send file via Telegram to keep a copy elsewhere.
- 2
Enable the Automatic backup failed event for the Telegram bot (Connections tab) to be alerted as soon as a scheduled backup fails.
- 3
Rolling back does not restore the database. If the new release changed the data structure, restore from the backup taken before the update.
- 4
Never run database delete or reset commands on a live server; restore-db.sh and restore.sh both overwrite the current data.