Piki - Backup

General

The data in the wiki consists out of two parts

Backup

Preparation steps

$ cd /<piki-base-path>
$ source venv/bin/activate

Dump the database content to <backup-path>/piki.json and <backup-path>/pages.json

$ python manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e sessions -e auth.Permission -e sessions -e pages --indent 2 > <backup-path>/piki.json
$ python manage.py dumpdata --natural-foreign --natural-primary -e contenttypes -e sessions -e auth.Permission -e sessions pages --indent 2 > <backup-path>/pages.json

Create an archive with all additional data to <backup-path>/piki.tar.gz

$ tar -czf <backup-path>/piki.tar.gz data/mycreole data/media

Recover

Preparation steps

These steps will clean up your piki. This means all data will be removed!!!

$ cd /<piki-base-path>
$ source venv/bin/activate
$ rm -rf data/pages data/media db.sqlite3
$ python manage.py migrate
$ python manage.py import_system_pages

Recover all your additional data from <backup-path>/piki.tar.gz

$ tar -xvzf <backup-path>/piki.tar.gz

Recover the database content from <backup-path>/piki.json and <backup-path>/pages.json

$ python manage.py loaddata <backup-path>/piki.json
$ python manage.py loaddata <backup-path>/pages.json