Index: openacs-4/packages/acs-core-docs/www/snapshot-backup.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/snapshot-backup.adp,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/acs-core-docs/www/snapshot-backup.adp 25 Apr 2018 08:38:28 -0000 1.4 +++ openacs-4/packages/acs-core-docs/www/snapshot-backup.adp 2 Mar 2019 19:30:06 -0000 1.4.2.1 @@ -1,5 +1,5 @@ -{/doc/acs-core-docs {ACS Core Documentation}} {Manual backup and recovery} +{/doc/acs-core-docs/ {ACS Core Documentation}} {Manual backup and recovery} Manual backup and recovery
  • Setup the export directory; this is the directory where backups -will be stored. We recommend the directory /ora8/m02/oracle-exports.

    [root ~]# mkdir /ora8/m02/oracle-exports
    -[root ~]# chown oracle:dba /ora8/m02/oracle-exports
    -[root ~]# chmod 770 /ora8/m02/oracle-exports
    +will be stored. We recommend the directory /ora8/m02/oracle-exports.

    [root ~]# mkdir /ora8/m02/oracle-exports
    +[root ~]# chown oracle:dba /ora8/m02/oracle-exports
    +[root ~]# chmod 770 /ora8/m02/oracle-exports
     
  • Now edit /usr/sbin/export-oracle @@ -83,25 +83,25 @@

  • -PostgreSQL.  -Create a backup file and verify that it was created and has a -reasonable size (several megabytes).

    [root root]# su - $OPENACS_SERVICE_NAME
    -[$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ pg_dump -f /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/before_upgrade_to_4.6.dmp $OPENACS_SERVICE_NAME
    +PostgreSQL. Create
    +a backup file and verify that it was created and has a reasonable
    +size (several megabytes).

    [root root]# su - $OPENACS_SERVICE_NAME
    +[$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ pg_dump -f /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/before_upgrade_to_4.6.dmp $OPENACS_SERVICE_NAME
     
    -[$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ ls -al /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/before_upgrade_to_4.6.dmp 
    +[$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ ls -al /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/before_upgrade_to_4.6.dmp 
     -rw-rw-r-x    1 $OPENACS_SERVICE_NAME  $OPENACS_SERVICE_NAME   4005995 Feb 21 18:28 /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/before_upgrade_to_4.6.dmp
     [$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ exit
     [root root]#
    -su - $OPENACS_SERVICE_NAME
    -pg_dump -f /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/before_upgrade_to_4.6.dmp openacs-dev
    -ls -al /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/before_upgrade_to_4.6.dmp
    -exit
    +su - $OPENACS_SERVICE_NAME
    +pg_dump -f /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/before_upgrade_to_4.6.dmp openacs-dev
    +ls -al /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/before_upgrade_to_4.6.dmp
    +exit
     
  • -Back up the file system.  Back up all of +Back up the file system. Back up all of the files in the service, including the database backup file but excluding the auto-generated supervise directory, which is unnecessary and has complicated permissions.

    In the tar command,

      @@ -117,25 +117,25 @@ backed up by the service owner. These files are autogenerated and we don't break anything by omitting them.

    • The --file clause specifies the name of the output file to be generated; we manually add the -correct extensions.

    • The last clause, /var/lib/aolserver/$OPENACS_SERVICE_NAME/, +correct extensions.

    • The last clause, /var/lib/aolserver/$OPENACS_SERVICE_NAME/, specifies the starting point for backup. Tar defaults to recursive backup.

    • -
    [root root]# su - $OPENACS_SERVICE_NAME
    +
    [root root]# su - $OPENACS_SERVICE_NAME
     
    -[$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ tar -cpsz --exclude /var/lib/aolserver/$OPENACS_SERVICE_NAME/etc/daemontools/supervise \
    -   --file /var/tmp/$OPENACS_SERVICE_NAME-backup.tar.gz /var/lib/aolserver/$OPENACS_SERVICE_NAME/
    +[$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ tar -cpsz --exclude /var/lib/aolserver/$OPENACS_SERVICE_NAME/etc/daemontools/supervise \
    +   --file /var/tmp/$OPENACS_SERVICE_NAME-backup.tar.gz /var/lib/aolserver/$OPENACS_SERVICE_NAME/
     tar: Removing leading `/' from member names
     [$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$
  • Suffer a catastrophic failure on your production -system.  (We'll simulate this step)

    [root root]# svc -d /service/$OPENACS_SERVICE_NAME
    +system. (We'll simulate this step)

    [root root]# svc -d /service/$OPENACS_SERVICE_NAME
     [root root]# mv /var/lib/aolserver/$OPENACS_SERVICE_NAME/ /var/lib/aolserver/$OPENACS_SERVICE_NAME.lost
     [root root]# rm /service/$OPENACS_SERVICE_NAME
     rm: remove symbolic link `/service/$OPENACS_SERVICE_NAME'? y
     [root root]# ps -auxw | grep $OPENACS_SERVICE_NAME
     root      1496  0.0  0.0  1312  252 ?        S    16:58   0:00 supervise $OPENACS_SERVICE_NAME
    -[root root]# kill 1496
    +[root root]# kill 1496
     
     [root root]# ps -auxw | grep $OPENACS_SERVICE_NAME
     [root root]# su - postgres
    @@ -154,14 +154,14 @@
     this with standard backup processes or by keeping copies of the
     install material (OS CDs, OpenACS tarball and supporting software)
     and repeating the install guide. Recreate the service user
    -($OPENACS_SERVICE_NAME).

  • -

    Restore the OpenACS files and database backup file.

    [root root]# su - $OPENACS_SERVICE_NAME
    +($OPENACS_SERVICE_NAME).

  • +

    Restore the OpenACS files and database backup file.

    [root root]# su - $OPENACS_SERVICE_NAME
     
     [$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ cd /var/lib/aolserver
     [$OPENACS_SERVICE_NAME aolserver]$ tar xzf /var/tmp/$OPENACS_SERVICE_NAME-backup.tar.gz
    -[$OPENACS_SERVICE_NAME aolserver]$ chmod -R 775 $OPENACS_SERVICE_NAME
    +[$OPENACS_SERVICE_NAME aolserver]$ chmod -R 775 $OPENACS_SERVICE_NAME
     
    -[$OPENACS_SERVICE_NAME aolserver]$ chown -R $OPENACS_SERVICE_NAME.web$OPENACS_SERVICE_NAME
    +[$OPENACS_SERVICE_NAME aolserver]$ chown -R $OPENACS_SERVICE_NAME.web$OPENACS_SERVICE_NAME
     
     
  • @@ -170,14 +170,14 @@

    Oracle. 

    1. Set up a clean Oracle database user and tablespace with the same names as the ones exported from (more information).

    2. -

      Invoke the import command

      imp $OPENACS_SERVICE_NAME/$OPENACS_SERVICE_NAME FILE=/var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/nighty_backup.dmp FULL=Y
      +

      Invoke the import command

      imp $OPENACS_SERVICE_NAME/$OPENACS_SERVICE_NAME FILE=/var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/nighty_backup.dmp FULL=Y
  • -Postgres.  If the database user does not -already exist, create it.

    [root root]# su - postgres
    -[postgres ~]$ createuser $OPENACS_SERVICE_NAME
    +Postgres. If the
    +database user does not already exist, create it.

    [root root]# su - postgres
    +[postgres ~]$ createuser $OPENACS_SERVICE_NAME
     
     Shall the new user be allowed to create databases? (y/n) y
     Shall the new user be allowed to create more new users? (y/n) y
    @@ -189,25 +189,25 @@
     create any out-of-order database objects. Next, restore the
     database from the dump file. The restoration will show some error
     messages at the beginning for objects that were pre-created from
    -the OpenACS initialization script, which can be ignored.

    [root root]# su - $OPENACS_SERVICE_NAME
    +the OpenACS initialization script, which can be ignored.

    [root root]# su - $OPENACS_SERVICE_NAME
     
    -[$OPENACS_SERVICE_NAME ~]$ createdb $OPENACS_SERVICE_NAME
    +[$OPENACS_SERVICE_NAME ~]$ createdb $OPENACS_SERVICE_NAME
     
     CREATE DATABASE
    -[$OPENACS_SERVICE_NAME ~]$ psql -f /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/acs-kernel/sql/postgresql/postgresql.sql $OPENACS_SERVICE_NAME
    +[$OPENACS_SERVICE_NAME ~]$ psql -f /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/acs-kernel/sql/postgresql/postgresql.sql $OPENACS_SERVICE_NAME
     (many lines omitted)
    -[$OPENACS_SERVICE_NAME ~]$ psql $OPENACS_SERVICE_NAME < /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/database-backup.dmp
    +[$OPENACS_SERVICE_NAME ~]$ psql $OPENACS_SERVICE_NAME < /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/database-backup.dmp
     (many lines omitted)
     [$OPENACS_SERVICE_NAME ~]$ exit
     [postgres ~]$ exit
     logout
  • -

    Activate the service

    [root root]# ln -s /var/lib/aolserver/$OPENACS_SERVICE_NAME/etc/daemontools /service/$OPENACS_SERVICE_NAME
    +

    Activate the service

    [root root]# ln -s /var/lib/aolserver/$OPENACS_SERVICE_NAME/etc/daemontools /service/$OPENACS_SERVICE_NAME
     
     [root root]# sleep 10
    -[root root]# svgroup web /service/$OPENACS_SERVICE_NAME
    +[root root]# svgroup web /service/$OPENACS_SERVICE_NAME