synchly
v1.1.0
Published
A CLI to automate database backups
Downloads
11
Maintainers
Readme
Synchly backups
- Description
- Features
- Prerequisites
- Installation
- Tab completion
- Usage
- Quick setup
- List of options
- Running as a daemon
- Examples
- Contributing
- Show your support
- License
Description
Automate database backups with customizable recurring schedules.
Features
- Backup scheme - Synchly uses a Grandfather-father-son backup rotation scheme (daily, weekly, monthly) that is fully customizable. Default schedule: 7 dailies + 8 weeklies + 6 monthlies (at max there will be 21 backups at a given instant).
- Flexible scheduling - Schedule the daily backups to fit your maintenance and development schedule, so that you get a clear picture of your database backups over time.
- Supported Databases
- MySQL
- MongoDB
- Compression - Compress the database backups to save up space.
- Cloud Storage Integration - Sync the local backups to remote storage of your choice.
- Restoration - Restore the database from the backups.
- Supported remote storages
- Google Drive
- SFTP
- Status notifications - Get daily status reports for successful and failed backups, delivered when you want them via SMTP to the specified email(s). Check Usage and the List of Options below.
- Multiple Backup Jobs - Run multiple backup jobs in parallel.
- Encrypt Config files - Encrypt job configuration files.
- Multiplatform Support - Run on any platform (Linux, Windows, macOS) which can run Node JS.
Prerequisites
- node >=8
Installation
The Synchly CLI is distributed as an NPM package. To use it, install it globally using:
npm install --global synchly
or using yarn:
yarn global add synchly
Tab completion
The synchly package includes a useful tab-completion feature. This feature is installed automatically after the installation of the package. However, you might need to restart the console after installing the package for the autocomplete feature to work.
If you use Bash, it will create a file at ~/.synchly/completion.sh and append a loader code to ~/.bash_profile file.
If you use Zsh, it appends a loader code to ~/.zshrc file.
If you use Fish, it appends a loader code to ~/.config/fish/config.fish file.
Usage
$ synchly [--config module]
$ synchly [--config module] [--file filepath]
$ synchly [--disablejob] [--job exampleJob]
$ synchly [--disable module] [--debug]
$ synchly [--enablejob] [--job exampleJob]
$ synchly [--enable module] [--stacktrace]
$ synchly [--help]
$ synchly [--job exampleJob] [--config module]
$ synchly [--jobs]
$ synchly [--reset]
$ synchly [--restore]
$ synchly [--start]
$ synchly [--version]
Quick setup
Synchly can be run with --help
flag to get a full list of flags.
The quickest way to get started is to run the synchly --config=db
command.
To start synchly use the command synchly --start
.
Synchly instance have to be restarted everytime you make a change to the configuration using the cli options.
To restore database from the backup files use the command synchly --restore
.
Configuration of modules (remote-sync and smtp) can be added or updated using synchly --config=module
command.
Initializing configurations can also be done using a file, synchly --config=module --file=filepath
, refer Configuration using file.
By default, remote-sync and smtp modules are disabled, to enable them, use synchly --enable=module
command.
To encyrpt the job configuration files use the command synchly --enable=cipher
and to disable it globally use the command synchly --disable=cipher
.
For the complete list of options and their behavior, refer List of options.
For running synchly as a daemon, refer Running as a deamon.
For creating multiple backup jobs, refer Running multiple jobs
List of options
Running as a daemon
Synchly can be run as a daemon, init.d and systemd unit files are bundled with the npm package to make this easier.
If installed using npm:
init.d
$ npm install --global synchly
$ sudo cp /usr/local/lib/node_modules/synchly/bin/synchly.conf /etc/init
$ sudo start synchly
systemd
$ npm install --global synchly
$ cp /usr/local/lib/node_modules/synchly/bin/synchly.service ~/.config/systemd/user/
$ systemctl --user enable synchly
$ systemctl --user start synchly
If the unit files are not there inside /usr/local/lib/node_modules
, use npm root -g
to get the global installation root path and copy the unit files from there.
The WorkingDirectory
field in the synchly.service
unit file also needs to be changed, if the global installation root path is different from /usr/local/lib/node_modules
.
If installed using yarn:
If installed using yarn global, the service init files will be located on
/usr/local/share/.config/yarn/global/node_modules/synchly/bin/
- if logged in as root~/.config/yarn/global/node_modules/synchly/bin
- if logged in as non-root
NOTE: Don't forget to restart the daemon everytime you make a change to the configuration using the cli options.
Examples
- Database configuration
- Cloud Storage (remote-sync) configuration
- Status notifications (smtp) configuration
- Enabling modules
- Disabling modules
- Stacktrace of errors
- Running multiple jobs
Contributing
I'd love your help! If you have ideas for new features or feedback, let me know by creating an issue in the issues list.
Show your support
Give a :star: if this project helped you!
License
Copyright :copyright: 2020 Hariprasanth S
This project is licensed under the Apache License, Version 2.0 You may also obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0