EC Backup (easy-backup)
If you need a system easy to use that provides you a periodic (or at specific time) backup. This is your package.
Requirements
Right now this package is tested only on Ubuntu 20.04 LTS and you need to have the following packages in order to work:
How to install
Just npm i -g ec-backup
or use it with npx ec-backup
How to use
- First you need to create the config file that
ec-backup
will read its instructions (see section below for this). - You can validate your config file with:
ec-backup validate -f <yourconfigfilepath>
One single time
If you want to backup only one time (or to verify that your process works well) just: ec-backup backup -f <yourconfigfilepath>
Also, you can use --dry
to do not notify and upload your backup zip, but you can check that backup file is created where you specify in the config:
Cron
To create the process you must specify an ID, some examples:
ec-backup cron --id example-id -f <yourconfigfilepath>
: create a cron processec-backup cron --stop --id example-id
: try to stop a cron process with id example-idec-backup cron --list
: list all current cron precesses
Config
Configuration file is split in 3 main parts:
- Backup engine: what kind of data source we will backup
mongo
: backup your database from MongoDBfile
: choose files from your system to backup
- Notificator: how do you want to be notified
telegram
: uses a channel and a bot to notify all your backupsconsole
: just print to console
- Uploader: where we put your fresh backup
gcp
: Google Cloud Storagenone
: drop it where you specified in outputDir field
Skeleton
Use following examples (backup engines, notificator, uploader) to make your own config file, here is the skeleton:
{
"cron": "* * * * * *", // Cron schedule expression (https://crontab.guru)
"outputDir": "/tmp", // Temporary folder to store your backup until upload
"engine": { ... } // Backup engine config,
"notificator": { ... } // Notificator config,
"uploader": { ... } // Uploader config
}
Backup engines
mongo
{
"type": "mongo",
"databaseHost": "",
"databasePort": 27017,
"databaseName": "",
"username": ""
"password": ""
}
file
{
"type": "file",
"path": ""
}
Notificator
Telegram
{
"type": "telegram",
"chatId": "",
"botToken": ""
}
Note: You can obtain the chatId from this URL: https://api.telegram.org/bot/getUpdates. Substitute <putYourToken>
with your bot token
Console
{
"type": "console"
}
Uploader
Google Cloud Storage
{
"type": "gcp",
"storageKeyPath": "",
"backupsFolderPath": "",
"bucketName": "",
"projectId": ""
}