Backup and upgrade
Before upgrading a running server to the latest version of Newscoop, it is strongly recommended that you back up your publication database, templates, images, file attachments and configuration files. First, log in to the administration interface (see the Getting started chapter in this manual for details). Click on Actions in the main navigation menu. At the lower end of this menu, click Backup/Restore.
On the Backup/Restore page which opens, click the Make new backup link next to the green plus sign icon.
A dialog box will ask you if you are sure you want to make the backup.
Click the OK button, and a pop-up window will display the progress of the backup. Once the window reports Backup saved to file: you can click the Close link to return to the Newscoop administration interface.
On the Backup/Restore page, the backup you just made should be listed, together with any previous backups.
Click on the disk icon in the Download column to save the gzipped backup tarball (with the .tar.gz file extension) from your Newscoop server to your desktop computer.
To restore a previous backup into a running Newscoop system, click the Upload backup file link, and then select the backup from your desktop computer's file system.
Command line backup
Newscoop includes two scripts that can be used for backup and restore on the command line of your server. They are found in the bin/ subdirectory of your Newscoop installation, such as /var/www/newscoop/bin/ or a similar location. Because these scripts require access to your Newscoop configuration files, they must be run as the root user (with sudo on Ubuntu).
You can create backup archives using the following command:
$ sudo /path/to/newscoop/bin/newscoop-backup [--silent] [--default-dir] [--help]
The optional arguments to the newscoop-backup command are:
- --silent - don't display any message, whether successful or not
- --default-dir - save the backup archive in the backup directory /path/to/newscoop/backup ; without this argument, the script will create the Newscoop backup archive in the current directory
- --help - display usage information
The output of the command should resemble the following example:
$ sudo /var/www/newscoop/bin/newscoop-backup --default-dir Newscoop Backup Utility ----------------------- Backup script version: 3.5.3 "Bea" Backing up newscoop * Backing up the database...done. * Backing up the templates...done. * Backing up images...done. * Backing up file attachments...done. * Backing up configuration files...done. * Creating tarball...done. * Cleaning up...done. Backup saved to file: /var/www/newscoop/backup/backup-newscoop-2011-06-22-16-21-12.tar.gz
The archive file name is backup-newscoop-[date_time].tar.gz and this tarball contains the whole Newscoop instance: the database, templates, images, attached files and configuration files. You can find the size of the backup archive with the ls -lh command, for example:
$ ls -lh /var/www/newscoop/backup total 26M -rw-r--r-- 1 root root 26M 2011-06-22 16:21 backup-newscoop-2011-06-22-16-21-12.tar.gz
To restore from a specific backup archive, use the command:
$ sudo newscoop-restore -b backup_file [-t destination_database_name] [-e] [-c charset] [-s] [-l] [-f] [-h]
The -b backup_file argument is used to provide the full or relative path to the tarball previously created by the newscoop-backup script. For example:
$ sudo /var/www/newscoop/bin/newscoop-restore -b /var/www/newscoop/backup/backup-newscoop-2011-06-22-16-21-12.tar.gz Newscoop Restore Utility ------------------------ * Initializing... * Temp directory: backup-newscoop-2011-06-22-16-21-12 * Initialization done. * Extracting files into temp directory...done. * Backup database name is 'newscoop'. * Destination database name (to be replaced) is 'newscoop'. All files in the following directories will be deleted. (The backup files will be copied to these locations) /var/www/newscoop/templates /var/www/newscoop/images /var/www/newscoop/files /var/www/newscoop/templates_cache Are you sure you want to continue? (y/N) y * Removing files in /var/www/newscoop/templates...done. * Removing files in /var/www/newscoop/images...done. * Removing files in /var/www/newscoop/files...done. * Removing files in /var/www/newscoop/templates_cache...done. * Restoring templates...done. * Restoring images...done. * Restoring file attachments...done. done. * Upgrading templates...done. * Restoring the database newscoop...done. * Upgrading (if necessary)... * Upgrading the database from version 3.5.x...done. * Updating plugins (if necessary)... done. * Cleaning up...done. IMPORTANT! You must restart the apache server for the changes to take effect!
The optional arguments to the newscoop-restore script are:
- [-t destination_database_name] If provided, the script will use the database name specified instead of the one specified in the backup file. This is useful for transfer of a Newscoop website to another server, where database names may be different.
- [-e] Use the existing configuration files instead of the ones in the backup file. The existing configuration files in the current installation will not be replaced. This argument takes precedence over the -t argument; if both arguments are used together, the database name will be read from the existing database configuration file, not from the -t argument.
- [-c charset] Convert the data from charset to UTF-8.
- [-s] Convert the data from the database server character set to UTF-8.
- [-l] List all available character sets and exit.
- [-f] Don't prompt, assume 'yes' to questions.
- [-h] Display usage information.
The newscoop-restore script will replace all existing data with the contents of the backup archive. You must run the script from a directory that you have write access to, because this script needs to create a temporary directory. Note that your backup database and files will automatically be upgraded if they are older than the currently installed version of Newscoop.
Finally, restart Apache as suggested by the message from the newscoop-restore script.
$ sudo /etc/init.d/apache2 restart * Restarting web server apache2 ... waiting [ OK ]
With multiple installations of Newscoop on a single server, you must run the newscoop-restore script from the installation where you want to restore the matching data. For example, you may have installed Newscoop in two locations, /var/www/newscoop1 and /var/www/newscoop2. To restore the data for the newscoop1 installation, you must run /var/www/newscoop1/bin/newscoop-restore rather than the /var/www/newscoop2/bin/newscoop-restore script.
Running the upgrade script
After you have completed the backup successfully, update your Newscoop installation using either the automated or manual methods described in the following chapters. Then run the upgrade.php script in your web browser, for example: