1.0.7 • Published 3 years ago

backup-mysql-google-driver v1.0.7

Weekly downloads
106
License
MIT
Repository
-
Last release
3 years ago

backup-mysql-google-driver

This library will help you to perform backups of the mysql database and send them to the google drive

Backup mysql google driver

Custom your backup mysql and save in Google drive

This is just a bunch of encapsulated libraries to make it easier to back up the database and to store it in the cloud with more comfort and practicality. see below how you can customize.

backup

PropsValue TypeDescriptionDefaultRequired
hoststringhost from mysql database-true
userstringroot name mysql database-true
passwordstringpassword mysql database-true
keep_filesnumbernumber of backups that will be kept10false
folder_backupsstringname folder to create and save all backup./backupfalse

Cron

Use this link https://crontab.guru/ from generated a time cron running

PropsValue TypeDescriptionDefaultRequired
activeboolenable the cronfalsetrue
timestringtime the cron running/2 * * *true
timezonestringtimezone the cronAmerica/Sao_Paulotrue

Google Drive

See how to configure this step below api google drive

Configure Google drive

Use this link https://developers.google.com/drive/api/v3/quickstart/nodejs to enable google drive api and get your client_id and client_secret

PropsValue TypeDescriptionDefaultRequired
activeboolenable the google drivefalsetrue
client_idstringthe client key id-true
client_secretstringthe client key secret-true
folder_idstringthe id folder-false

Mail

PropsValue TypeDescriptionDefaultRequired
activeboolenable sending notification mailfalsetrue
hoststringhost to send mail-true
portnumberport to send mail-true
secureboolsecure to send mail-true
userstringuser to send mail-true
passstringpassword to send mail-true
fromstringemail from send mail-true
tostringemail to send mail-true
subjectstringsubject to send mailNew backup performed successfullyfalse
textstringtext to send mailNew backup performed successfullyfalse

What are you doing

  • Backup Database Mysql
  • Dinamic login with Google driver
  • Send backup file to Google Driver
  • Limited backup files upload
  • Delete files localy and google driver
  • Limited files in Google driver
  • Generated log control
  • Send email alert
  • Cron Dinamic

Install

yarn add backup-mysql-google-driver

Usage :

const monitor_backup = require('backup-mysql-google-driver')

monitor_backup({

    backup: {
        host: '',
        user: '',
        password: '',
        database: '',
        keep_files: 10,
    },

    cron: {
        active: false,
        time: `*/10 * * * *`,
        timezone: `America/Sao_Paulo`,
    },

    google_drive: {
        active: false,
        client_id: '',
        client_secret: '',
        folder_id: '',
    },

    mail: {
        active: false,
        host: '',
        port: 465,
        secure: true,        
        user: '',
        pass: '',

        from: 'Name <email@email.com>',
        to: '',
        subject: '',
        text: '',
    }
})