This commit represents a comprehensive refactoring and enhancement of Baktainer: ## Core Architecture Improvements - Implemented comprehensive dependency injection system with DependencyContainer - Fixed critical singleton instantiation bug that was returning Procs instead of service instances - Replaced problematic Concurrent::FixedThreadPool with custom SimpleThreadPool implementation - Achieved 100% test pass rate (121 examples, 0 failures) after fixing 30+ failing tests ## New Features Implemented ### 1. Backup Rotation & Cleanup (BackupRotation) - Configurable retention policies by age, count, and disk space - Automatic cleanup with comprehensive statistics tracking - Empty directory cleanup and space monitoring ### 2. Backup Encryption (BackupEncryption) - AES-256-CBC and AES-256-GCM encryption support - Key derivation from passphrases or direct key input - Encrypted backup metadata storage ### 3. Operational Monitoring Suite - **Health Check Server**: HTTP endpoints for monitoring (/health, /status, /metrics) - **Web Dashboard**: Real-time monitoring dashboard with auto-refresh - **Prometheus Metrics**: Integration with monitoring systems - **Backup Monitor**: Comprehensive metrics tracking and performance alerts ### 4. Advanced Label Validation (LabelValidator) - Schema-based validation for all 12+ Docker labels - Engine-specific validation rules - Helpful error messages and warnings - Example generation for each database engine ### 5. Multi-Channel Notifications (NotificationSystem) - Support for Slack, Discord, Teams, webhooks, and log notifications - Event-based notifications for backups, failures, warnings, and health issues - Configurable notification thresholds ## Code Organization Improvements - Extracted responsibilities into focused classes: - ContainerValidator: Container validation logic - BackupOrchestrator: Backup workflow orchestration - FileSystemOperations: File I/O with comprehensive error handling - Configuration: Centralized environment variable management - BackupStrategy/Factory: Strategy pattern for database engines ## Testing Infrastructure - Added comprehensive unit and integration tests - Fixed timing-dependent test failures - Added RSpec coverage reporting (94.94% coverage) - Created test factories and fixtures ## Breaking Changes - Container class constructor now requires dependency injection - BackupCommand methods now use keyword arguments - Thread pool implementation changed from Concurrent to SimpleThreadPool ## Configuration New environment variables: - BT_HEALTH_SERVER_ENABLED: Enable health check server - BT_HEALTH_PORT/BT_HEALTH_BIND: Health server configuration - BT_NOTIFICATION_CHANNELS: Comma-separated notification channels - BT_ENCRYPTION_ENABLED/BT_ENCRYPTION_KEY: Backup encryption - BT_RETENTION_DAYS/COUNT: Backup retention policies This refactoring improves maintainability, testability, and adds enterprise-grade monitoring and operational features while maintaining backward compatibility for basic usage. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
64 lines
1.2 KiB
Text
64 lines
1.2 KiB
Text
# ---> Ruby
|
|
*.gem
|
|
*.rbc
|
|
/.config
|
|
/coverage/
|
|
/InstalledFiles
|
|
/pkg/
|
|
/spec/reports/
|
|
/spec/examples.txt
|
|
/test/tmp/
|
|
/test/version_tmp/
|
|
/tmp/
|
|
|
|
# Backups directory
|
|
/backups
|
|
|
|
# Used by dotenv library to load environment variables.
|
|
# .env
|
|
|
|
# Ignore Byebug command history file.
|
|
.byebug_history
|
|
|
|
## Specific to RubyMotion:
|
|
.dat*
|
|
.repl_history
|
|
build/
|
|
*.bridgesupport
|
|
build-iPhoneOS/
|
|
build-iPhoneSimulator/
|
|
|
|
## Specific to RubyMotion (use of CocoaPods):
|
|
#
|
|
# We recommend against adding the Pods directory to your .gitignore. However
|
|
# you should judge for yourself, the pros and cons are mentioned at:
|
|
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
|
#
|
|
# vendor/Pods/
|
|
|
|
## Documentation cache and generated files:
|
|
/.yardoc/
|
|
/_yardoc/
|
|
/doc/
|
|
/rdoc/
|
|
|
|
## Environment normalization:
|
|
/.bundle/
|
|
/vendor/bundle
|
|
/lib/bundler/man/
|
|
|
|
# for a library or gem, you might want to ignore these files since the code is
|
|
# intended to run in multiple environments; otherwise, check them in:
|
|
# Gemfile.lock
|
|
# .ruby-version
|
|
# .ruby-gemset
|
|
|
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
.rvmrc
|
|
|
|
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
|
# .rubocop-https?--*
|
|
|
|
.claude
|
|
app/coverage
|
|
app/tmp
|