Backups
This section describes the backup procedures for the License Plate Recognition System.
Automatic Backups
The postgres-backup service creates periodic backups of the PostgreSQL database. The schedule for these backups is defined by the BACKUP_SCHEDULE environment variable, which should be in cron format.
The retention period for automatic backups is controlled by the BACKUP_RETENTION_DAYS environment variable. Backups older than this number of days will be automatically deleted.
If the BACKUP_SCHEDULE variable is not set, no periodic backups will be performed.
The backups are stored in the directory specified by the BACKUP_DIR environment variable.
Manual Backups
You can perform a manual backup at any time using the manual_backup.sh script.
Usage
<DB_HOST>: The hostname of the database to back up.[DB_PORT]: The port of the database. Defaults to5432.
Example
To back up a local database running on the default port:
The script will create a compressed backup file in the directory specified by the BACKUP_DIR environment variable. The filename will be in the format <DB_NAME>_manual_<TIMESTAMP>.dump.gz.
.env File
The manual_backup.sh script requires the following environment variables to be set in the .env file in the project root:
DB_NAMEPOSTGRES_ADMIN_USERPOSTGRES_ADMIN_PASSWORDBACKUP_DIR