twhoffma / geeklistanalyser

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Improve backup script using jq #97

Open twhoffma opened 2 years ago

twhoffma commented 2 years ago

Right now we're using couchdb-dump. Move to curl and jq with something along the lines of

curl -X GET 'http://localhost:5984/mydatabase/_all_docs?include_docs=true' | jq '{"docs": [.rows[].doc]}' | jq 'del(.docs[]._rev)' | xz > db.json.xz

We can probably also consider separate backups for boardgames and stats..

twhoffma commented 2 years ago

Needs to be researched more - crashes since jq closes pipe

https://github.com/stedolan/jq/wiki/FAQ#streaming-json-parser

twhoffma commented 2 years ago

Might be as easy as

curl -X GET 'http://localhost:5984/mydatabase/_all_docs?include_docs=true' | jq '{"docs": [.rows[].doc]} | del(.docs[]._rev)' | xz > db.json.xz