Backup and sync your data with ease.
Supported backup:
- Local
- MongoDB
- MySQL
Supported sync:
- Local
- Google Drive
- Dropbox
- AWS S3
npm i -g @ayoubamine/backsyncGenerate config file backsync.json:
backsync initAdd backup source:
backsync add backupAdd sync source:
backsync add syncUpdate default settings:
backsync settingsRun the backup and sync manually:
backsync runSchedule the backup and sync in the background:
backsync scheduleShow the sync history:
backsync statusInstall PM2 to run the process in the background:
npm i -g pm2Create ecosystem.config.js file in the same directory that backsync.json exists and add the following content:
module.exports = {
apps: [
{
name: 'backsync',
script: 'backsync',
args: 'schedule',
},
],
};Then to start:
pm2 start ecosystem.config.jsDisplay the logs:
pm2 logs backsyncTo stop and delete:
pm2 delete backsyncFollow these steps to create a service account and download your credentials.json file:
Create service account
- Go to https://drive.google.com.
- Create new folder.
- Right-click on the folder, select Share, add the service account email with the Editor permission and click Done.
- Browse to the new folder and copy the folder id from the url. 'https://drive.google.com/drive/u/0/folders/FOLDER_ID'
- Go to https://dropbox.com/developers/apps/create.
- Choose Scoped access on the first step.
- Choose App folder on the second.
- Give your app a name. That name will become a folder in your Dropbox account.
- Click Create app.
- Go to Permissions tab and enable
files.content.writescope. - Go to Settings tab, scroll down to OAuth 2 block, select 'No expiration' and click Generate.
- Go to https://aws.amazon.com.
- Navigate to IAM > Users and click 'Add users'.
- Fill the username, enable 'Access key - Programmatic access', click 'Next: Permissions', select 'Attach existing policies directly', enable the AmazonS3FullAccess permission and click 'Next: Tags' > 'Next: Review'.
- Go to https://s3.console.aws.amazon.com.
- Click 'Create bucket', fill the bucket name and click 'Create bucket'.
| Name | Type | Required |
|---|---|---|
| name | string |
Yes |
| description | string |
No |
| Name | Type | Required |
|---|---|---|
| path | string |
Yes |
| Name | Type | Required |
|---|---|---|
| filename | string |
No, Default: Original name. |
| Name | Type | Required |
|---|---|---|
| uri | string |
No, Default: mongodb://localhost:27017 |
| database | string |
Yes |
| Name | Type | Required |
|---|---|---|
| filename | string |
No, Default: Database name. |
| Name | Type | Required |
|---|---|---|
| host | string |
No, Default: hostname |
| port | number |
No, Default: 3306 |
| user | string |
No, Default: root |
| password | string |
No |
| database | string |
Yes |
| Name | Type | Required |
|---|---|---|
| filename | string |
No, Default: Database name. |
| Name | Type | Required |
|---|---|---|
| path | string |
Yes |
| Name | Type | Required |
|---|---|---|
| credentials | string |
Yes |
| folderId | string |
Yes |
| Name | Type | Required |
|---|---|---|
| token | string |
Yes |
| Name | Type | Required |
|---|---|---|
| accessKeyId | string |
Yes |
| secretAccessKey | string |
Yes |
| bucketName | string |
Yes |
| Name | Type | Required |
|---|---|---|
| cron | string |
No, Default: 0 0 * * * |
| prefix | string |
No |
| filename | string |
No |
Feel free to contribute to this project.
If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue. If you fixed a bug or implemented a new feature, please send a pull request.