Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ckan backup and restore

Tags:

python

ckan

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?

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

Thanks. Alex

like image 316
Almalerik Avatar asked Sep 25 '22 05:09

Almalerik


1 Answers

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.

like image 114
D Read Avatar answered Nov 15 '22 10:11

D Read