Database Archive Management
This project automates the backup and management of database archives for different EverQuest expansions. It ensures that database versions are tracked, and only the latest archives are kept while older ones are deleted. If a new database version is detected, the previous version is protected and not deleted.
Features
- Dumps specific tables from multiple databases.
- Compresses and uploads the database dumps to a web server.
- Keeps track of the database version and marks new versions as protected.
- Automatically cleans up old archives, retaining only the latest 30 days of backups.
- Protects weekly (Sunday) backups and any backups with a version change.
Configuration
Process Script (process.sh)
This script dumps tables from multiple databases, compresses them, and uploads them to the web server.
Configuration Variables
DB_USER: Database username.DB_PASSWORD: Database password.DB_HOST: Database host address.DB_PORT: Database port (e.g.,4406).DB_IDENTIFIERS: Array of database identifiers (e.g.,Classic,Kunark).BACKUP_DIR: Directory where backups are temporarily stored.WEB_SERVER: Web server URL.UPLOAD_URL: Full URL for the upload handler on the web server.UPLOAD_KEY: Secure key for authenticating the upload request.SCHEMA_URL: URL to download the latestdatabase_schema.hfile.SCHEMA_FILE: Local path to store the downloadeddatabase_schema.hfile.
Upload Handler (upload_handler.php)
This PHP script handles the uploaded database archives, marks versions as protected if needed, and cleans up old archives.
Configuration Variables
uploadDir: Directory where uploaded files are stored.maxAgeDays: Maximum number of days to keep unprotected archives.uploadKey: Secure key for authenticating the upload request (defined inconfig.php).
Database Schema
The archive_logs table should have the following structure:
CREATE TABLE `archive_logs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`archive` varchar(255) NOT NULL,
`size` bigint(20) NOT NULL,
`created` datetime NOT NULL,
`db_identifier` varchar(255) NOT NULL,
`db_version` varchar(255) NOT NULL,
`protected` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
);
Description
Languages
PHP
57.4%
CSS
31%
Shell
11.6%