Alex Alex - 1 year ago 72
Python Question

Ckan backup and restore

I'm trying to write some documentation on how to restore a CKAN instance in my organization.

I have backuped and restored successfully CKAN database and resources folder but i don't know what i have to do with datastore db.

Which is the best practice?


to dump the database or initialize it from the resources folder (if there is a way)?


Answer Source

Backup CKAN's databases (the main one and Datastore one if you use it) with pg_dump. If you use Filestore then you need to take a backup copy of the files in the directory specified by ckan.storage_path (default is /var/lib/ckan/default)

Restore the database backups (after doing createdb) using psql -f. Then run paster db upgrade just in case it was from an older ckan version. Then paster --plugin=ckan search-index rebuild. In an emergency use rebuild_fast instead of rebuild, but I think it might create some duplicates entries, so to be certain you could then do rebuild -r to do it again carefully but slowly.

initialize [the datastore database] from the resources folder (if there is a way)

I don't think the CKAN Data Pusher has a command-line interface to push all the resources. It would be a good plan for you to write one and submit a PR for everyone's benefit.