Skip to content

Skn0tt/purgeOS

Repository files navigation

purgeOS

purgeObjectStorage | purgeOldStuff

Purge old backup files from object storage. Awesome to reduce your cloud bill 💵

oclif Version Downloads/week License

Getting Started

purgeOS can be used to thinnen your backups. At the moment, it supports GCS and a tiered retention strategy, but it's trivial to add more!

You can use either the NPM package or the Docker Image.

$ yarn global add purgeos
$ purgeOS \
    --bucket=my-backup-bucket \
    --gcs-client-email=... \
    --gcs-private-key=...
$ docker run \
  -e BUCKET=my-backup-bucket \
  -e GCS_CLIENT_EMAIL=... \
  -e GCS_PRIVATE_KEY=... \
  docker.pkg.github.com/skn0tt/purgeos/purgeos:latest

I recommend setting up a cron job / scheduled container run to keep your backups tidy.

Storage Backends

More backends can be added easily, feel free to provide a PR! :)

Google Cloud Storage

Enable using --backend=gcs or BACKEND=gcs.

Configuration:

Flag Env var Description
--bucket BUCKET The bucket to prune
--gcs-client-email GCS_CLIENT_EMAIL The client email of the IAM account
--gcs-private-key GCS_PRIVATE_KEY The private key of the IAM account

Purging Strategies

More strategies can be added easily, feel free to provide a PR! :)

Tiered Retention

Enable using --strategy=tiered or STRATEGY=tiered.

Will retain hourly objects for the last day,
half-daily objects for the last week,
bi-daily objects for last month,
bi-weekly objects for last year,
bi-monthly objects for everything before.

Contributing

Feel free to make this better! 🎉
Every kind of contribution is welcome: docs, code, typo corrections, blog posts ... If you don't know where to start, don't hesitate to reach out ☺️