Ledger-Home

SQL-Ledger Backup

revised: 27-Jun-2024

ensuring means to perserve data and the application - a two part process

a. Backup - Database only:

To backup the database structure and transactions, one selects within SQL-Ledger's table of actions: System->Backup->Save to File. A dialogue box should pop-up requesting one to save the backup file to one's download directory whose title should be in the form of:

[database-name]-[version of SQL-Ledger]-[current date].sql.gz.

For example: testdb-3.2.12-20240522.sql.gz Note: If one chooses "Send by Email" instead of the recommended "Save to File" in the default install then these backup files accumulate in the "users" directory on the server if the email dependencies and configuration is not properly setup.

It is recommended to do this daily, if not more frequently when many entries are posted.

Important Notice: It is critical not to rely on SQL-ledger backups alone but to regularly create backups using Postgres tools 'pg_dump'. Via Webmin->Tools->Terminal, follow this example:
root@imega:# mkdir /usr/local/backups if directory doesn't exist
root@imega:# chown postgres:postgres /usr/local/backups
root@imega:# cd /usr/local/backups
root@imega:# sudo -u postgres PGPASSWORD=[mysql-ledgerpasswd] pg_dump -U sql-ledger -d testdb | gzip > testdb-3.2.12-20240522.sql.gz
Thereafter this sql.gz file can be downloaded from the server. For restoring use 'pg_restore', see Ledger-Restore

b. To backup the SQL-ledger application together with users and templates

Via PuTTY, logon as the regular user (eg. sammy) and go to the /usr/local directory. One can compress the entire sql-ledger directory into a file named: [MyServerName]-SQL-ledger3.2.12-[date].tar.gz as follows:

sammy@imega:$ cd /usr/local
sammy@imega:/usr/local$ sudo tar -czvf [MyServerName]-SQL-ledger3.2.12-[date].tar.gz sql-ledger/
sammy@imega:/usr/local$ sudo mv [MyServerName]-SQL-ledger3.2.12-[date].tar.gz /home/sammy

With an FTP client (eg. FileZilla), download the file: [MyServerName]-SQL-ledger3.2.12-[date].tar.gz and store it well. It is recommended to do this application backup, particularly when there are many changes with users and/or templates.

Ledger-Home Ledger-Extras
Ledger-Backup Ledger-Restore