pathwaycommons/rethinkdb-backup
Enables a client to dump and retrieve from a running RethinkDB instance
603
This app provides a capability to backup a RethinkDB instance. Data is dumped to a compressed archive. This app can attach to a file synchronization service (e.g. rClone) and initate a request to copy dumps to a remote store.
The system is configured to initiate a backup when changes are made to the RethinkDB factoid
database document
table:
document
is addeddocument
's status
field is updated to public
document
with status = public
is updated (//TODO)Each backup request can be configured to occur with a given delay (default is 3 hours). When a backup is scheduled, further requests are ignored during this period enabling the system to aggregate or 'batch' changes.
A built-in webserver provides the following HTTP endpoints:
/
: list the database dumps (naming convention <DB_NAME>_dump_<DATETIME>.tar.gz
)/backup
: initiate a backup (requires apiKey
as URL param, when configured)/<dump name>
: download a database dumpYou must also have access to a running instance of RethinkDB and a file synchronization service like rClone.
Clone this remote
git clone https://github.com/PathwayCommons/rethinkdb-backup.git
Install packages
cd rethinkdb-backup
npm install
Run the app
npm run start
Point your browser at http://localhost:3000/
The following environment variables can be used to configure the server:
General:
NODE_ENV
: the environment mode; either production
or development
(default)BASE_URL
: used for logging currentlyPORT
: the port on which the server runs (default 3000
)LOG_LEVEL
: minimum log level; one of info
(default), warn
, error
DUMP_DIRECTORY
: name of the directory where database dumps are placed (archives
)DUMP_PATH
: the url path prefix to addAPI_KEY
: the API key for protected endpoints (i.e. /backup
)Database:
DB_NAME
: name of the db (default factoid
)DB_HOST
: hostname or ip address of the database host (default localhost
)DB_PORT
: port for the database host (default: 28015
)DB_USER
: the db userDB_PASS
: the db passwordDB_CERT
: the path to the certificate if db uses TLSBackup:
DUMP_DATE_FORMAT
: format for the date stamp used in naming the zipped archive - i.e. ${DB_NAME}_dump_<date stamp>.tar.gz
(default yyyy-MM-dd_HH-mm-ss-SSS
)BACKUP_DELAY_MIN
: the time to wait before triggering a backup (default 180
)Sync Service:
SYNC_ENABLED
: Use the Sync service (default true
)SYNC_HOST
: Sync service host name (default localhost
)SYNC_PORT
: Port that the sync service is bound to (default 5572
)SYNC_LOGIN
: User name for authentication.SYNC_PASSWORD
: Password for authentication.SYNC_CMD
: Sync service commmand to execute (for rClone its sync/copy
)SYNC_SRC
: A remote name string e.g. "drive:src" for the sourceSYNC_DST
: A remote name string e.g. "drive:dst" for the destinationImages are maintained on Docker Hub.
npm run lint
npm version
, in accordance with semver. The version
command in npm
updates both package.json
and git tags, but note that it uses a v
prefix on the tags (e.g. v1.2.3
).npm version patch
.npm version minor
.npm version major.
npm version 1.2.3
.git push origin --tags
docker pull pathwaycommons/rethinkdb-backup