|dave 4c147219a7||5 years ago|
|bin||5 years ago|
|datadb||5 years ago|
|.gitignore||5 years ago|
|README.md||5 years ago|
|requirements.txt||5 years ago|
|setup.py||5 years ago|
Effortless program data deployment and backup
git clone http://gitlab.xmopx.net/dave/datadb-cli.git datadb-cli
cd datadb-cli ; pip3 install -r requirements.txt
python3 setup.py install
Just python3 and requests.
For one, this is beta and some things are hard-coded. In datadb.py it is recommended to change the DATADB_HTTP_API URL. This URL should be the cgi-bin path of an http server running datadb-scripts.
Next, a config file must be created for each directory to be restored/backed up. It lives at /etc/datadb.ini and contains many entires of this format:
[profile_name] uri=<procotol>://<server>/<backup_name> dir=/local/path keep=5 auth=username:password restore_preexec= restore_postexec= export_preexec= export_postexec=
Each [section] defines one backup task. At present, all fields must be there even if their value is blank.
uri: Destination/source for this instance’s data. Must be this format:
dir: Local dir for this backup/restore
keep: Number of historical copies to keep on remote server
auth: Not implemented. Username:password string to use while contacting the datadb via HTTP.
restore_preexec: Not implemented. Shell command to exec before pulling/restoring data.
restore_postexec: Not implemented. Shell command to exec after pulling/restoring data. For example, loading a mysql dump
export_preexec: Not implemented. Shell command to exec before pushing data. For example, dumping a mysql database to a file in the backup dir.
export_postexec: Not implemented. Shell command to exec after pushing data
Datadb makes some assumptions about it’s environment.
curlcommands are assumed to be in $PATH
datadb [--force] <profile_name> restore
Restore operations have a degree of sanity checking. Upon a successful restore, a file named .datadb.lock will be created in the local dir. Datadb checks for this file before doing restore operations, to prevent overwriting live data with an old backup. This check can be overridden with the
--force command line option.
datadb <profile_name> backup
datadb <profile_name> status
Command line usage is agnostic to the underlying transport protocol used.