Sentinel is a robust, modular backup system designed to secure your MySQL/MariaDB databases and files to S3-compatible storage solutions, with support for various compression formats and flexible scheduling.
- Modular backup system supporting multiple backup sources:
- MySQL/MariaDB database backups using mysqldump
- File and directory backups with pattern matching
- Easy to extend with new backup handlers
- Advanced compression options:
- Support for gzip and zstd compression
- Configurable compression levels
- Flexible storage options:
- Compatible with S3, Cloudflare R2, MinIO, and other S3-compatible storage
- Configurable upload parameters (part size, concurrency)
- Configurable via TOML configuration file
- Debug mode for troubleshooting
- Temporary directory management
- Docker support with optional container database backup
- Go 1.16+ (for building from source)
- Docker (optional, for containerized deployment)
- MySQL/MariaDB (if database backup is enabled)
- S3-compatible storage account
Sentinel uses a TOML configuration file. Here's a sample configuration with all available options:
# Backup system configuration
schedule = "0 4 * * *" # Daily at 4 AM (if not specified, backup will run immediately)
temp_dir = "" # Optional: temporary directory for backups
debug = false # Enable debug logging
[compression]
format = "gzip" # Supported: "gzip", "zstd"
level = 3 # Compression level (1-9)
[mysql]
enabled = false # Enable/disable MySQL backup
host = "localhost"
port = "3306"
user = "backup_user"
password = "backup_password"
database = "myapp"
docker_container = "" # Optional: MySQL docker container name
[filesystem]
enabled = true
base_path = "/path/to/backup"
include_patterns = [ # Glob patterns for files to include
"*.txt",
"*.pdf",
"config/**",
"data/**"
]
exclude_patterns = [ # Glob patterns for files to exclude
".git/**",
"node_modules/**",
"tmp/**",
"*.tmp"
]
[s3]
endpoint = "https://your-endpoint.com"
region = "auto" # Use "auto" for services like R2
bucket = "your-bucket"
access_key_id = "your-access-key"
secret_access_key = "your-secret-key"
max_concurrency = 10 # Maximum concurrent uploads
part_size = 0 # Multipart upload part size (0 for auto)
-
Clone the repository:
git clone https://github.com/mcpt/sentinel.git
-
Build the Docker image:
docker build -t sentinel .
-
Create your config.toml file based on the example above.
-
Run the container:
docker run -d --name sentinel \ -v /path/to/your/config.toml:/app/config.toml \ -v /path/to/backup:/data \ sentinel
-
Clone the repository:
git clone https://github.com/yourusername/sentinel.git
-
Navigate to the project directory:
cd sentinel
-
Build the binary:
go build -o sentinel sentinel/backup-system/main.go
-
Create your config.toml and run:
./sentinel --config /path/to/config.toml
Sentinel uses a modular architecture with the following components:
- Backup Handlers: Implement the
BackupHandler
interface for different backup sources - Storage: S3-compatible storage implementation
- Compression: Supports multiple compression formats
- Configuration: TOML-based configuration system
To contribute to Sentinel:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Implement the BackupHandler
interface to add support for new backup sources:
type BackupHandler interface {
Backup(ctx context.Context) (string, error)
}
Distributed under the GPL-3.0 License. See LICENSE
for more information.
- The Go community
- Contributors to the AWS SDK for Go
- Open-source backup solution developers