/mysql-dump-s3-sync

Dump a MySQL database and sync the backup to AWS S3.

Primary LanguageJavaScriptISC LicenseISC

repo npm

Dump a MySQL database and sync the backup to AWS S3.

Usage

npm install @ryanburnette/mysql-dump-s3-sync

Always configure AWS using the environment.

All other options can be configured in the environment or as an opts object passed to backup().

# .env

# Configure DB explicitly... or
DB_HOST=
DB_PORT=
DB_NAME=
DB_USER=
DB_PASS=

# Configure DB by URL
DB_URL=

# AWS
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_BUCKET=

# Other options
LOGGING=

Run a backup.

npx backup

Make it a scheduled service.

// service.js
require('@ryanburnette/mysql-dump-s3-sync/cron')({
  schedule: '0 0 * * *'
});

First, install go-serviceman so we can add services in the easiest possible way.

sudo serviceman add --system --path $PATH node service.js