Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compressed snapshots #618

Open
FalsePhilosopher opened this issue Sep 28, 2024 · 1 comment
Open

Compressed snapshots #618

FalsePhilosopher opened this issue Sep 28, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@FalsePhilosopher
Copy link
Contributor

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

You got your hands on a FZ, but are stuck on limited data bandwidth and/or data usage on sat internet or "borrowing" your neighbors wifi and want to setup your newly acquired fz with ubers repo/all of it's submodules. To run git clone --recursive that's 6.7GB of data to be downloaded. To save on data usage it would be cool if there was a compressed snapshot of the repo/submodules in the releases that you could pull instead.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Zstandard when faced with a lot of small files such as 90% of what is in Flipper and it's submodules does very favorably in compression ratio(near 50%)/decompression speed(up to 1.8GBs per core) when a dictionary is trained against the data set. I propose that the machine that's used to update the submodules for this repo also does a bi-weekly cron job to create a compressed snapshot of the repo and upload it as a release. I have an example in my Infosec-Cheatsheets repo releases that you can demo it's functionality as the end user. I achieved a 56% original size ratio saving 5GB of data as compared to git pull.

Your workflow looks like

zstd --train -T0 -r Flipper/*
tar --use-compress-program "zstd -T0 -19 -D dictionary" -cf - Flipper/ | split --bytes=2GB - Flipper.tar.zst
gh release create Snapshot-Sample-Date /Pathtofiles/*

If you add this script named zst.sh to your repo

#!/bin/bash
cd /tmp
gh release download -p 'Flipper.tar.zst*' -p 'dictionary' -R UberGuidoZ/Flipper
cat Flipper.tar.zst* > Flipper.tar.zst
rm Flipper.tar.zsta*
tar --use-compress-program "zstd -d --rm -T0 -D dictionary" -xvf "Flipper.tar.zst" --directory $HOME/Downloads
rm dictionary Flipper.tar.zst

then the end user can pull/extract it with this one liner

wget -q -O - https://raw.githubusercontent.com/UberGuidoZ/Flipper/refs/heads/main/zst.sh | bash

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Pray to the internet gods for more data/bandwidth lol.

Additional context
Add any other context or screenshots about the feature request here.

@FalsePhilosopher FalsePhilosopher added the enhancement New feature or request label Sep 28, 2024
@FalsePhilosopher
Copy link
Contributor Author

@UberGuidoZ I created a branch in my fork called compress, it contains a working release script to create an automated release containing a stripped zstd compressed archive and scripts to download/extract/checksum everything for windows and linux. The release and download scripts work on the linux side, I have yet to test the windows side of things. If the windows tests are successful, the only thing you would need to do to deploy all of it would be to download the files and change the working dir path in Release.sh/cron job entry(details of how to make a cron job entry in the comments of Release.sh.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants