Database Management¶
Move to a different database or engine¶
Use cases:
move to a different database storage (e.g. provided by a different database host)
change the database engine (e.g. from SQLite to PostgreSQL)
migrate the data to a different host with a different database engine
Procedure:
stop the running grouprise service (e.g.
service grouprise stop
)dump the current database content in a database-neutral format:
grouprisectl dumpdata \ --natural-primary \ --natural-foreign \ --exclude sessions \ --exclude admin.logentry \ --indent 4 \ --all \ >grouprise-export.json
prepare the new desired configuration (below
/etc/grouprise/conf.d/
)create new database (see Database Initialization)
populate the database structure:
grouprisectl migrate
load the export data:
grouprisectl loaddata --format=json - <grouprise-export.json
start the grouprise service (e.g.
service grouprise start
)
Import content into another host¶
Use cases:
migrate to a new deployment host
experiment with real production data in a local development setup
Please take a close look at the steps below and adjust these, before executing them. Your local database will be wiped completely.
Use grouprisectl
instead of python3 manage.py
, if the target setup is based on the
deb-package of grouprise (instead of a local development checkout).
# delete the content of the local development database
python3 manage.py sqlflush | python3 manage.py dbshell
# repare the minimal database structure
python3 manage.py migrate
# export the live database content and import it into the local instance
ssh root@$GROUPRISE_HOST \
grouprisectl dumpdata \
--natural-primary
--natural-foreign
--exclude sessions
--exclude admin.logentry
--indent 4
--all
| python3 manage.py loaddata --format=json -
You may need to align your local configuration with the one of the remote host, if you enabled optional modules (e.g. matrix_chat).