An agnostic database backup tool fully implemented using Streams.
# Add to your dependencies using yarn
yarn global add "nxtep-io/heroback#master";
# Or, using NPM
npm install --global "github:nxtep-io/heroback#master";
Then, just call it from the command line.
# Minimal configuration takes only the database connection URL
heroback dump "<url>"
Heroback will try to understand the supplied connection URI to use one of the available providers in the library and dump its content to a file.
# Dumps to local file
heroback dump postgresql://localhost/test
# Restores from local file
heroback restore "20181118.052834.298000000.dump.sql" "postgresql://localhost/test";
# Dumps to local file
heroback dump mysql://localhost/test
# Restores from local file
heroback restore "20181118.052834.298000000.dump.sql" "mysql://localhost/test";
# Dumps to local file
heroback dump mongo://localhost/test
# Restores from local file
heroback restore "20181118.052834.298000000.dump.archive" "mongo://localhost/test";
Heroback will try to understand the supplied connection URI to use one of the available providers in the library and dump its content to a file.
File (Default): Streams the dump to/from a local file.
Amazon S3: Streams the dump output to a S3 bucket in AWS. Checkout the sample script.
This exporter depeneds on the aws-sdk module and its environment variables.
Google GCS: Streams the dump output to a Google Cloud Storage. Checkout the sample script.
This exporter depeneds on the @google-cloud/storage module and its environment variables.
You can use Heroback under the hood in your NodeJS / Typescript projects.
import Heroback from 'heroback';
// Prepare a new heroback instance
const heroback = new Heroback();
// Prepares to dump database to a local file
const dump = await heroback.dump({
exporter: 'file',
uri: 'postgres://locahost/test',
});
// Start the streaming to the local file
await dump.export();
console.log('Exported successfully!');
Check the samples/ directory in the repository.
The project is licensed under the MIT License.
Generated using TypeDoc