Piki - Backup

General

The data in the wiki consists out of two parts * The page, attachments as files (in the folder ./data/mycreole * The django User data stored in the db e.g. db.sqlite3

Backup

Preparation steps

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

Dump the database content to /piki.json and /pages.json

$ python src/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 src/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 /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 src/manage.py migrate
$ python src/manage.py import_system_pages

Recover all your additional data from /piki.tar.gz

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

Recover the database content from /piki.json and /pages.json

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