Changes between Initial Version and Version 1 of Public/Docs/CinnamonBackupRestore


Ignore:
Timestamp:
Sep 11, 2019, 10:04:30 AM (5 years ago)
Author:
Administrator
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Public/Docs/CinnamonBackupRestore

    v1 v1  
     1= Backup and restore a standard Debian-based Cinnamon repository
     2== Backup
     3* Switch to superuser context, using the {{{su}}} command.
     4* Create a file {{{/opt/cinnamon/cinnamon-system/backup.sh}}} with the following content:
     5{{{
     6killall -SIGTERM supervise
     7kill $(ps aux | grep mono | awk '{print $2}')
     8service tomcat stop
     9
     10# Dump DB into cinnamon-data folder
     11export PGPASSWORD=<postgres_password>
     12pg_dump -U postgres  -h localhost  -w content > /opt/cinnamon/cinnamon-data/content.sql
     13export PGPASSWORD=
     14
     15# Delete empty folders in content store and archive data files in file system:
     16find /opt/cinnamon/cinnamon-data/content -empty -type d -delete
     17
     18# rsync over ssh
     19# this is available by many hosting providers and suits the backup needs of a Cinnamon repository very well
     20rsync -av --delete --rsh="/usr/bin/sshpass -p <password> ssh -p23"  /opt/cinnamon/cinnamon-data/ <storage_url>
     21
     22service tomcat start
     23
     24sleep 60
     25supervise /opt/cae/bin &
     26}}}
     27
     28* Set the permissions on the file to EXECUTE for root.
     29
     30> **IMPORTANT:** A password for the {{{postgres}}} user must be specified to enable pg_dump.
     31* Create a cron job running {{{backup.sh}}} at a suitable time.
     32* If the hosting provider offers such functionality, configure daily snapshots of the backup target at a time when all backups have been finished.
     33
     34== Restore
     35* Delete old DB and create a new one
     36{{{
     37service tomcat stop
     38sudo -u postgres psql
     39drop database content;
     40\q
     41sudo -u postgres psql template1
     42create database content with owner=cinnamon;
     43\q
     44sudo -u postgres psql content < /home/install/content.sql
     45}}}
     46
     47* Restore the content
     48Depending on where the content is available, restore it to the original content path ({{{/opt/cinnamon/cinnamon-data/content}}}).
     49> **NOTE:** In the configuration shown in the backup documentation, restore is most easily done by a reverse {{{rsync}}} command.
     50
     51> **NOTE:** Make sure that the account owning tomcat has read and write permission on the content.
     52
     53=== Recreate the index
     54> **NOTE:** If the system to restore to has no index for the restored repository yet, no further action has to be taken. In case of a restore over an existing repository, existing index files should be deleted before restore.
     55{{{
     56sudo -u postgres psql content
     57insert into index_jobs select id,false,'cinnamon.ObjectSystemData',id from objects;
     58insert into index_jobs select id,false,'cinnamon.Folder',id from folders;
     59}}}