Backup Restore - RCOSDP/weko GitHub Wiki

Full Backup

Backup WEKO3 data

  1. Open a terminal where you can run the command-line tools.

  2. Move to the root directory of WEKO3 repository.

  3. Run below backup command.

./script/demo/backup.sh {target dir} 

Restore WEKO3 data

  1. Open a terminal where you can run the command-line tools.

  2. Move to the root directory of WEKO3 repository.

  3. Run below restore command.

./script/demo/restore.sh {target dir} 

Custom Backup

Index tree

Backup index tree

  1. Backup tables related to index tree.
docker-compose exec postgresql bash -c "pg_dump -c -t 'index*' invenio -U invenio > index.sql"
docker cp $(docker-compose ps -q postgresql):/index.sql index.sql
  • please change into proper DB name and username.
  1. Add CASCADE option into dumped SQL.
ALTER TABLE ONLY public.index DROP CONSTRAINT uix_position CASCADE;
ALTER TABLE ONLY public.index_style DROP CONSTRAINT pk_index_style CASCADE;
ALTER TABLE ONLY public.index DROP CONSTRAINT pk_index CASCADE;
ALTER TABLE public.index ALTER COLUMN id DROP DEFAULT;
DROP TABLE public.index_style CASCADE;
DROP SEQUENCE public.index_id_seq CASCADE;
DROP TABLE public.index CASCADE;

Restore index tree

  1. Restore tables related to index tree.
docker cp index.sql $(docker-compose ps -q postgresql):/index.sql 
docker-compose exec postgresql psql -U invenio invenio  -f /index.sql