Commit Graph

262 Commits

Author SHA1 Message Date
2becde8077 feat: add database migration between servers
- Add 'migrate cluster' command for full cluster migration
- Add 'migrate single' command for single database migration
- Support PostgreSQL and MySQL database migration
- Staged migration: backup from source → restore to target
- Pre-flight checks validate connectivity before execution
- Dry-run mode by default (--confirm to execute)
- Support for --clean, --keep-backup, --exclude options
- Parallel backup/restore with configurable jobs
- Automatic cleanup of temporary backup files
2025-12-13 18:25:28 +01:00
1ccfdbcf52 ci: add mirror job to push to GitHub 2025-12-13 16:30:11 +00:00
11f3204b85 ci: add mirror job to push to GitHub 2025-12-13 16:29:54 +00:00
b206441a4a fix: Add cross-compilation and fix QEMU ARM64 compatibility
- Added --platform=$BUILDPLATFORM to builder stage for cross-compilation
- Added TARGETOS and TARGETARCH build args
- Pinned Alpine to 3.19 for better QEMU emulation stability
- Split apk add commands to prevent trigger failures under QEMU
- Fixes ARM64 build failures in CI/CD pipeline
2025-12-13 09:45:25 +00:00
0eed4e0e92 ci: trigger pipeline 2025-12-13 10:22:17 +01:00
358031ac21 ci: trigger pipeline 2025-12-13 10:16:30 +01:00
8a1b3a7622 docs: rewrite README with conservative style
- Remove emoticons and bloated content
- Clean professional documentation
- Include all TUI screenshots
- Match actual application features
- Reduce from 1537 to ~380 lines
2025-12-13 09:58:54 +01:00
e23b3c9388 ci: trigger pipeline 2025-12-13 09:45:02 +01:00
b45720a547 Clean up README.md for conservative style
- Update repository URL to git.uuxo.net/UUXO/dbbackup (main)
- Add GitHub mirror reference
- Remove all emojis and icons for professional appearance
- Fix section order: Recent Improvements, Contributing, Support, License
- Remove duplicate Support/License sections
- Clean up output examples (remove emoji decorations)
2025-12-12 14:33:37 +01:00
3afb0dbce2 Fix build_all.sh: replace 'env' command with direct export
- The 'env GOOS=x GOARCH=y command' syntax fails on some systems
- Using 'export GOOS GOARCH' before go build for better compatibility
- Updated version to 3.1.0
- All 10 platform builds now succeed
2025-12-12 13:57:10 +01:00
9dfb5e37cf Fix cluster backup auto-confirm and confirmation Init
- Skip confirmation dialog in auto-confirm mode for cluster backup
- Call confirm.Init() to trigger auto-confirm message
2025-12-12 13:19:27 +01:00
d710578c48 Fix MySQL support and TUI auto-confirm mode
- Fix format detection to read database_type from .meta.json metadata file
- Add ensureMySQLDatabaseExists() for MySQL/MariaDB database creation
- Route database creation to correct implementation based on db type
- Add TUI auto-forward in auto-confirm mode (no input required for debugging)
- All TUI components now exit automatically when --auto-confirm is set
- Fix status view to skip loading in auto-confirm mode
2025-12-12 12:38:20 +01:00
5536b797a4 ci: skip docker push if registry secrets not configured 2025-12-11 21:22:08 +01:00
4ab28c7b2e ci: test runner 2025-12-11 20:31:20 +01:00
9634f3a562 ci: limit parallelism to 8 threads (GOMAXPROCS + max-parallel) 2025-12-11 20:16:30 +01:00
bd37c015ea ci: add Docker build and push to Gitea registry 2025-12-11 20:00:46 +01:00
4f0a7ab2ec ci: remove Windows builds - who needs that anyway 2025-12-11 19:44:30 +01:00
c2a0a89131 fix: resolve go vet linting issues
- Add WithField and WithFields methods to NullLogger to implement Logger interface
- Change MenuModel to use pointer receivers to avoid copying sync.Once
2025-12-11 19:32:17 +01:00
abb23ce056 fix: use single package build instead of ./... 2025-12-11 19:15:49 +01:00
914307ac8f ci: add golangci-lint config and fix formatting
- Add .golangci.yml with minimal linters (govet, ineffassign)
- Run gofmt -s and goimports on all files to fix formatting
- Disable fieldalignment and copylocks checks in govet
2025-12-11 17:53:28 +01:00
6b66ae5429 ci: use go install for golangci-lint instead of curl script 2025-12-11 17:43:46 +01:00
4be8a96699 fix: trust .dump extension when file doesn't exist in DetectArchiveFormat
The format detection now returns PostgreSQL Dump format for .dump files
when the file cannot be opened (e.g., when just checking filename pattern),
instead of falling back to SQL format.

This fixes the test that passes just a filename string without an actual file.
2025-12-11 17:39:19 +01:00
54a0dcaff1 fix: add missing WithField and WithFields methods to NullLogger
NullLogger now fully implements the Logger interface by adding:
- WithField(key string, value interface{}) Logger
- WithFields(fields map[string]interface{}) Logger

Both methods return the same NullLogger instance (no-op behavior),
which is appropriate for a null logger used in testing.
2025-12-11 17:05:19 +01:00
6fa967f367 ci: upgrade to Go 1.24 (required by go.mod) 2025-12-11 15:28:49 +01:00
fc1bb38ef5 ci: use public Gitea URL (https://git.uuxo.net) for checkout 2025-12-11 15:09:42 +01:00
d2212ea89c ci: use git clone instead of actions/checkout (no Node.js needed) 2025-12-11 15:07:36 +01:00
baf36760b1 ci: fix YAML syntax error (duplicate with) 2025-12-11 15:05:19 +01:00
0bde99f1aa ci: trigger 15:03:37 2025-12-11 15:03:37 +01:00
73b3a4c652 ci: test after db schema fix 2025-12-11 15:01:39 +01:00
4ac0cc0606 ci: retrigger workflow 2025-12-11 14:56:53 +01:00
56688fbd76 ci: use shallow clone (fetch-depth: 1) for faster checkout 2025-12-11 14:51:21 +01:00
3bbfaa2766 ci: trigger workflow 2025-12-11 13:43:28 +01:00
d5c72db1de ci: trigger after db fix 2025-12-11 13:42:58 +01:00
0ac649924f ci: force workflow trigger 2025-12-11 13:42:17 +01:00
f9414b4da0 ci: test workflow execution 2025-12-11 13:39:51 +01:00
a4fc61c424 ci: trigger workflow run 2025-12-11 13:37:52 +01:00
eadd6f3ec0 ci: trigger workflow 2025-12-11 13:29:34 +01:00
1c63054e92 ci: Add Gitea Actions CI/CD pipeline
- Add workflow with test, lint, build, release jobs
- Add goreleaser config for multi-platform releases
- Add golangci-lint configuration
2025-12-11 13:23:47 +01:00
418c2327f8 fix: Fix indentation for workdir warnings and force flag 2025-11-29 11:06:18 +00:00
730ff5795a fix: Respect --force flag for disk space checks
causing it to always run even with --force flag.

This is critical for NFS mounts with automatic capacity extension where
reported disk space is lower than actual available space.

Use case: Auto-extending NFS storage that shows limited capacity but
expands on demand.
2025-11-29 10:42:26 +00:00
82dcafbad1 fix: Improve encryption detection for cluster backups
- Check cluster metadata first before single DB metadata
- For cluster backups, mark as encrypted only if ANY database is encrypted
- Remove double confirmation requirement for --workdir in dry-run mode
- Fixes false positive 'encrypted backup detected' for unencrypted cluster backups

This allows --clean-cluster and --workdir flags to work correctly with unencrypted backups.
2025-11-28 16:10:01 +00:00
53b7c95abc feat: Add --clean-cluster flag for disaster recovery
Implements cluster cleanup option for CLI (matches TUI functionality).

Features:
- --clean-cluster flag drops all user databases before restore
- Preserves system databases (postgres, template0, template1)
- Shows databases to be dropped in dry-run mode
- Requires --confirm for safety
- Warns user with 🔥 icon when enabled
- Can combine with --workdir for full disaster recovery

Use cases:
- Disaster recovery scenarios (clean slate restore)
- Prevent database conflicts during cluster restore
- Ensure consistent cluster state

Examples:
  # Disaster recovery
  dbbackup restore cluster backup.tar.gz --clean-cluster --confirm

  # Combined with workdir
  dbbackup restore cluster backup.tar.gz \
    --clean-cluster \
    --workdir /mnt/storage/restore_tmp \
    --confirm

Chef's kiss backup tool! 👨‍🍳💋
2025-11-28 13:55:02 +00:00
cfa51c4b37 chore: Replace production paths with generic examples
Sanitized all production-specific paths:
- /u01/dba/restore_tmp → /mnt/storage/restore_tmp
- /u01/dba/dumps/ → /mnt/backups/

Changed in:
- cmd/restore.go: Help text and flag description
- internal/restore/safety.go: Error message tip
- README.md: All documentation examples
- bin/*: Rebuilt all platform binaries

This ensures no production environment paths are exposed in public code/docs.
2025-11-28 13:27:12 +00:00
1568384284 docs: Sanitize production data in TUI examples
Replaced actual production database names with generic examples:
- test00, teststablekc, keycloak, stabledc → myapp_production, myapp_analytics, users_db, inventory_db, reports_db
- Updated archive filenames to generic examples
- Changed dates to generic future dates
- Adjusted database counts (7 → 5)
- Modified file sizes to be more generic

This ensures no production-specific information is exposed in public documentation.
2025-11-28 13:06:02 +00:00
bb6b313391 docs: Add Database Status and Backup Manager TUI displays
Completed TUI documentation with missing screens:

- Database Status & Health Check:
  * Connection status with checkmark
  * Database info (type, host, port, user, version)
  * Backup directory location
  * Database count
  * Health status indicator

- Backup Archive Manager (List & Manage):
  * Total archives and size summary
  * Sortable table with filename, format, size, date
  * Status indicators (✓ valid, ⚠ old, ✗ invalid)
  * Cursor navigation
  * Keyboard shortcuts for restore/verify/info/delete/refresh

All TUI screens now documented accurately!
2025-11-28 12:58:56 +00:00
ae58f03066 docs: Update Backup Execution TUI display in README
Replaced outdated backup progress view with actual TUI implementation:

- Backup Execution (in progress):
  * Shows type, database, duration
  * Spinner animation with status message
  * Cancel instruction

- Backup Completed (success):
  * Completion status with checkmark
  * Backup details (filename, size, location, databases)
  * SHA-256 verification confirmed
  * Return to menu instruction

Removed old progress bar style (45%, ETA, Speed) that's not in current TUI.
Now accurately reflects the actual backup execution screen.
2025-11-28 12:48:49 +00:00
f26fd0abd1 docs: Add Restore Preview and Restore Progress TUI displays
Added missing TUI screen examples for restore operations:

- Restore Preview screen showing:
  * Archive information (file, format, size, date)
  * Cluster restore options with existing databases list
  * Safety checks with status indicators (✓/✗/⚠)
  * Cleanup warning when enabled
  * Keyboard shortcuts

- Restore Progress screen showing:
  * Current phase and status with spinner
  * Database being restored with size
  * Elapsed time
  * Cancel instruction

Both screens match actual TUI implementation.
2025-11-28 12:44:14 +00:00
8d349ab6d3 docs: Add --workdir flag documentation to restore sections
Enhanced documentation for --workdir flag:
- Added to Cluster Restore command reference section
- Added example to restore examples with clear "special case" comment
- Explained use case: VMs with small system disk but large NFS mounts
- Clarified it's NOT needed for standard deployments
- Prevents confusion about when to use this flag
2025-11-28 12:28:00 +00:00
c43babbe8b docs: Update Configuration Settings TUI display in README
Updated to match actual TUI implementation:
- Shows all 13 configuration fields with current values
- Includes database type cycling (PostgreSQL/MySQL/MariaDB)
- Shows Current Configuration summary section
- Displays keyboard shortcuts (↑/↓ navigate, Enter edit, 's' save, 'r' reset, 'q' menu)
- Matches screenshot appearance
2025-11-28 12:23:18 +00:00
631e82f788 docs: Update README with current TUI menu structure
The interactive menu display was outdated. Updated to match current implementation:
- Shows database engine switcher (PostgreSQL/MySQL/MariaDB)
- Lists all 13 menu options with separators
- Includes new features: Sample backup, Cluster operations, Active operations, History
- Matches actual TUI appearance from screenshots
2025-11-28 12:17:05 +00:00