Skip to content

CodeLit/super-easy-file-backups

Repository files navigation

🪄 Super Easy backups 🪄

✨ Easy to set up (about 5 minutes)

✨ No code needed

✨ Daily automatic backups

✨ Removes old backups (rotation) for saving space on your device; tar gzip compression

✨ Multiple annual, monthly, weekly copies by your choice

Tested on: Windows 11, Ubuntu 22.02

Usage:

  1. Install Docker
  2. Add the your-project/backups-config.json to project which folder you want to back up. Example:
{
  "type": "local-storage",
  "copies": {
    "daily": 4,
    "weekly": 3,
    "monthly": 2,
    "annually": 2
  }
}

More examples you can find in config-examples folder

  1. Create projects/super-easy-file-backups folder and docker-compose.yml inside it.
# docker-compose.yml

version: '3'
services:
  super-easy-file-backups:
    image: 'ghcr.io/codelit/super-easy-file-backups'
    restart: always
    volumes:
      - C:/Users/Adam/projects/your-project:/app/projects/your-project # from
      - C:/Users/Adam/backups/your-project:/app/backups/your-project # to
      # OR seek for backups-config.json in entire projects folder
      - C:/Users/Adam/projects:/app/projects
      - C:/Users/Adam/backups:/app/backups

You can find more examples in docker-compose.override-example.yml.

  1. Run this command inside super-easy-file-backups folder
docker-compose up
  1. ✅ Check out the result
📦backups
 ┣ 📂annually
 ┃ ┣ 📜bkp_2022-08-01.tgz
 ┃ ┗ 📜bkp_2023-08-01.tgz
 ┣ 📂daily
 ┃ ┣ 📜bkp_2023-09-17.tgz
 ┃ ┣ 📜bkp_2023-09-18.tgz
 ┃ ┣ 📜bkp_2023-09-19.tgz
 ┃ ┗ 📜bkp_2023-09-20.tgz
 ┣ 📂monthly
 ┃ ┣ 📜bkp_2023-08-01.tgz
 ┃ ┗ 📜bkp_2023-09-01.tgz
 ┗ 📂weekly
   ┣ 📜bkp_2023-09-06.tgz
   ┣ 📜bkp_2023-09-13.tgz
   ┗ 📜bkp_2023-09-20.tgz

⭐️ Star this repository if you like it! ⭐️

🛠️ Advanced configuration

You can also exclude files and folders from backup. Use filter option with patterns.

Example of backups-config.json:

{
   "type": "local-storage",
   "copies": {
     "daily": 2,
     "weekly": 1,
     "monthly": 1,
     "annually": 1
   },
   "filter": [
      "node_modules/**",
      "**/*.log",
      "data/folder/*",
      "package.lock",
     "**/*_file-ending.*"
   ],
  "compression_level": "default"
}

🔧 type option:

Type of backup, local or cloud

🔧 copies option:

How many copies need to be in according folders, file tree will look like this:

📦backups
 ┣ 📂annually
 ┃ ┗ 📜bkp_2023-09-06.tgz
 ┣ 📂daily
 ┃ ┣ 📜bkp_2023-09-06.tgz
 ┃ ┗ 📜bkp_2023-09-10.tgz
 ┣ 📂monthly
 ┃ ┗ 📜bkp_2023-09-06.tgz
 ┗ 📂weekly
 ┃ ┗ 📜bkp_2023-09-06.tgz

🔧 filter option:

  • Exclude files inside node_modules folder recursively
  • Exclude all .log files recursively
  • Exclude all inside data/folder not-recursively
  • Exclude package.lock
  • Exclude files recursively by ending _fileending

🔧 compression_level option:

  • default: default compression, compromise between speed and compression
  • fast: fastest compression
  • best: best and slowest compression
  • none: no compression

🔧 filter_commonly_ignored_folders option:

  • true (default): ignores all .git, node_modules, vendor, etc folders; adds it to filter option
  • false: does nothing

🔧 filter_ignored option:

  • false (default): does nothing
  • true: ignores records in .gitignore file; adds it to filter option

Ⓜ️ Mega Online Cloud storage integration

Mega provides a 20gb free space for your cloud backups. It's amazing! ✨

You just need the login and password to make a cloud backups working.

Link to official mega website

Config example:

{
  "type": "mega-storage",
  "email": "email-name@mail.me",
  "password": "!test24passWord",
  "backups_path": "path/to/backups/my-project",
  "copies": {
    "daily": 1
  },
  "filter": [
    "**/*.log"
  ]
}

docker-compose.override.yml for Mega:

services:
  super-easy-file-backups:
    volumes:
      - C:/Users/Adam/Desktop/Projects/gameServer:/app/projects/gameServer:ro

⭐️ Star this repository if you like it! ⭐️