1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2025-12-12 17:36:01 +00:00
Claas Flint 1b833be760 Replace pigz with zstd for backup compression (#6897)
* Replace pigz with zstd for backup compression

This change replaces pigz (parallel gzip) with zstd (Zstandard) as the
compression algorithm for mailcow backups while maintaining full backward
compatibility with existing .tar.gz backups.

Benefits:
- Better compression ratios (12-37% improvement in tests)
- Improved compression speed with modern algorithm
- Maintains rsyncable functionality for incremental backups
- Full backward compatibility for restoring old .tar.gz backups
- Wide industry adoption and active development

Changes:
- Backup compression: pigz --rsyncable -p → zstd --rsyncable -T
- Backup decompression: pigz -d -p → zstd -d -T
- File extensions: .tar.gz → .tar.zst
- Added get_archive_info() function for intelligent format detection
- Updated backup Dockerfile to install zstd alongside pigz
- Restore function now auto-detects and handles both formats
- Updated FILE_SELECTION regex to recognize both .tar.zst and .tar.gz
- Updated comments to reflect new file extension

Backward Compatibility:
- Restore automatically detects .tar.zst (preferred) or .tar.gz (legacy)
- Existing .tar.gz backups can still be restored without issues
- pigz remains installed in backup image for legacy support
- Graceful fallback if backup file format not found

Testing:
- Added comprehensive test suite (test_backup_and_restore.sh)
- 12 automated tests covering all scenarios:
  * Backup creation (both formats)
  * Restore (both formats)
  * Format detection and priority
  * Error handling (missing files, empty dirs)
  * Content integrity verification
  * Multi-threading configuration
  * Large file compression (8.59 MB realistic data)

Test Results:
✓ zstd compression working
✓ pigz compression working (legacy)
✓ zstd decompression working
✓ pigz decompression working (backward compatible)
✓ Archive detection working
✓ Content integrity verified
✓ Format priority correct (.tar.zst preferred)
✓ Error handling for missing files
✓ Error handling for empty directories
✓ Multi-threading configuration verified
✓ Large file compression: 37.05% improvement
✓ Small file compression: 12.18% improvement

* move testing script into development folder

---------

Co-authored-by: DerLinkman <niklas.meyer@servercow.de>
2025-11-12 10:06:36 +01:00
2017-03-02 11:23:23 +01:00
2025-08-26 09:58:18 +02:00
2017-06-30 07:03:10 +08:00
2024-08-15 11:32:28 +02:00
2025-10-02 09:22:35 +02:00
2017-05-18 09:48:22 +02:00
2025-09-01 12:32:27 +02:00
2022-07-11 21:06:23 +02:00

mailcow: dockerized - 🐮 + 🐋 = 💕

Translation status Twitter URL Mastodon Follow

Want to support mailcow?

Please consider a support contract with Servercow to support further development. We support you while you support us. :)

You can also get a SAL which is a one-time payment with no liabilities or returning fees.

Or just spread the word: moo.

Many thanks to our GitHub Sponsors ❤️

A big thank you to everyone supporting us on GitHub Sponsors—your contributions mean the world to us! Special thanks to the following amazing supporters:

100$/Month Sponsors

50$/Month Sponsors

Info, documentation and support

Please see the official documentation for installation and support instructions. 🐄

🐛 If you found a critical security issue, please mail us to info at servercow.de.

Cowmunity

mailcow community

Telegram mailcow channel

Telegram mailcow Off-Topic channel

Official 𝕏 (Twitter) Account

Official Mastodon Account

Telegram desktop clients are available for multiple platforms. You can search the groups history for keywords.

Misc

Important: mailcow makes use of various open-source software. Please assure you agree with their license before using mailcow. Any part of mailcow itself is released under GNU General Public License, Version 3.

mailcow is a registered word mark of The Infrastructure Company GmbH, Parkstr. 42, 47877 Willich, Germany.

The project is managed and maintained by The Infrastructure Company GmbH.

Originated from @andryyy (André)

Description
No description provided
Readme GPL-3.0 60 MiB
Languages
JavaScript 54.7%
PHP 15.9%
Perl 9.9%
Twig 8.4%
CSS 4.5%
Other 6.4%