1.0.2 • Published 3 years ago

rinty v1.0.2

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

Rinty

Rinty is a PostgreSQL database server backup tool with built-in file rotation written in JavaScript and NodeJS.

It also compresses and encrypts the backup files (AES) and uploads them to cloud services supporting AWS S3-compatible storage.

Getting Started

You can run Rinty supplying the right Environment Variables to the start script of the app. I recommend using a daemon process manager like PM2.

NOTE: Rinty is using pg_dump and it will throw a version mismatch if the pg_dump version and database server versions are different. So you either need to run Rinty in the same server with your database or if you are using different servers for your database and Rinty, the pg_dump and PostgreSQL versions on both servers should match.

Using PM2

First clone the repository and make a copy of .env.example file and name it .env. Then edit the new file according to the table below to configure the app:

Variable NameDescription
VERBOSEOutputs the process of backup, compression, encryption and uploading of the files. Useful for debugging. set it to false in production
DB_TYPEcurrently only supported database is PostgreSQL
DB_SERVERIP address or hostname of the database server
DB_PORTPort number of the database server. For PostgreSQL the default port is 5432
DB_USERNAMEDatabase username
DB_PASSWORDDatabase password
BACKUP_INTERVAL_IN_HOURSDaily backup interval in hours. default value is 6
DB_NAMES_BLACKLISTRinty will try to backup all the databases accessible to the specified db username. This option is a comma separated db names to ignore while taking backups.
ENCRYPTION_ALGORITHMAlgorithm used by Node.js Crypto API. Recommended value is aes-256-cbc
ENCRYPTION_KEYEncryption key according to the algorithm type. for aes-256-cbc algorithm you should use a random 32 character string (256 bit)
UPLOAD_ENABLEDShould upload the backups. Set to true in production
UPLOAD_HANDLER_PROVIDERCurrently supporting two options aws and abrarvan
UPLOAD_HANDLER_BUCKETAWS S3-compatible storage bucket name
UPLOAD_HANDLER_ACCESS_KEYAccess key to your selected upload handler
UPLOAD_HANDLER_SECRET_KEYSecret key to your selected upload handler

To start Rinty using PM2 just run

$ pm2 start index.js --name rinty --env production 

Reminder: Restarting PM2 with the processes you manage on server boot/reboot is critical. Read more about PM2 startup script generator.

After running Rinty using PM2, you can view its logs by:

$ pm2 logs

And that's it. Rinty will start backing up the databases right away.

How backup rotation works?

If you're backing up big things, every day, storage quickly gets expensive. One way to combat that is to expire old archives, perhaps via some algorithm. A second way to combat that is to generate backup filenames that overwrite previous archives. Sounds scary? Maybe. Yes. But so does automatically purging old archives. Rinty uses the latter approach by using rotation package to to generate backup filenames. You can read more about this approach in rotation readme file.

Feedback & Pull Requests

You are welcome to use GitHub issues of the project to report problems or sending feedback.

Any pull requests to improve the code or add new database server types or upload handlers is appreciated.

License

MIT, see LICENSE.md for details.

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

4 years ago