Backing up and restoring Crucible data
Crucible data can be backed up from the admin interface or command line. This page contains the command syntax, options and the required procedure to backup and restore your Crucible instance.
Backing up Crucible data
The Crucible admin backup process
1. Navigate to the Crucible Admin area (click the Administration link in the footer of any Crucible page).
2. Click Backup (under 'System' heading in the left navigation bar).
3. The File Path field indicates where the backup file (in .zip format) will be stored. You can manually edit this path to change it. Under 'Include', a list of check boxes is shown, with the following items:
On this page:
- Plugins and their configuration data
- SQL database
- Web templates
- Uploaded files and local copies of files under review.
- Repository and application caches.
Repository and application caches contain temporary data stored from repository scans and library caches that improve startup time. Both will be recreated automatically by re-scanning the source repositories, so the backup files can be reduced by a significant amount by excluding these (if the cost of re-scanning is acceptable).
4. Once you have chosen your options, click Create Backup Now.
Screenshot: The Crucible Backup Screen
The Crucible command line backup process
Your Crucible instance must be running during the backup.
- Open a command line interface on the Crucible server computer.
- Navigate to the
<Crucible home directory>/bin/
directory. - Run the backup command on the command line with the desired options.
- The backup is created as a new Zip archive file and placed in the
FISHEYE_INST/backup/
directory.
Note that if your Crucible instance uses a customFISHEYE_INST
directory; make sure the environment variable is properly set when running the backup command.
Components of a Crucible backup
The Crucible backup is highly configurable and allows for many different configurations. This table shows the various components of the backup, what they are for and how they can be used.
Component | Purpose | Defaults |
---|---|---|
SQL Database | Refers to the SQL content database (used by both Fisheye and Crucible and containing all user profile data, reviews and their comments). | Backed up by default. |
Cache | The cache contains data that reflects the state of Fisheye's repositories. Without it, Fisheye must re-scan its repositories after a backup is restored. The cache also contains OSGI library data that increases startup time. These too can be excluded and will be generated automatically when the application is started. | The cache is not backed up by default as it tends to be large (running a risk of pushing the maximum file size for Java backups), while also representing replaceable data. |
Plugins | Plugins are 3rd-party extensions that you may have installed, and configuration for all plugins (this includes configuration for Crucible's set of standard plugins). | Configuration data for all plugins are backed up by default, as well as all plugins installed in |
Templates | In this context, these are custom freemarker templates that you or your users have created. They live in | Templates are backed up by default. You can choose to exclude them from the backup if your templates directory is covered by some other backup mechanism. |
Uploads | In this context, uploads refers to files which are added to Crucible via the web interface (such as patch file reviews). It also includes each repository-backed file that went under review, when Crucible is configured to make a local copy of every reviewed file. | Uploads are backed up by default. You can choose not to back them up for example when the |
ActiveObjects | Configuration data stored by plugins | Backed up by default |
Note that the backup will always include the configuration data (config.xml
), your license file and the Fisheye user data.
Backup command line options
These examples are for use in a Linux-like operating system. When using these commands on Windows, use the file name fisheyectl.bat
and use the correct slashes. Run the command from the
directory.<Crucible home directory>
/bin/
The basic syntax of the backup command is as follows:
$ ./fisheyectl.sh backup [OPTIONS]
To see inline help for all backup options, run the following command in the
directory:<Crucible home directory>
/bin/
$ ./fisheyectl.sh backup --help
Option | Switch | Description | Default |
---|---|---|---|
Quiet mode | -q OR --quiet | Suppresses output | No |
Output filename | -f OR --file | Specify a different path and filename to the |
|
Compression level | --compression OR -c | Sets the Zip compression level, from 1-9. Runs at level 6 if no argument is passed. | Yes (6) |
Anonymize | -a OR --anonymise | Anonymizes the SQL database by replacing all text with 'x'. This is only useful when sending a backup to Atlassian as part of a support case. Please do not anonymize data unless the Support Engineer handling your support case has specifically requested the data anonymized (as often anonymized data will not help reproduce the issue). | No |
Cache Backup | --cache | Include the repository caching files in the backup. These hold information gained from scanning the repositories and can be quite large (many gigabytes). However, it can shorten the time needed to re-scan the repositories after data is restored. | No. By default, the cache data is excluded from backups. |
Command line examples
These examples are for use in a Linux-like operating system. When using these commands on Windows, use the filename fisheyectl.bat
and use the correct slashes. Run the command from the
directory.<Crucible home directory>
/bin/
Backing up with compression of 9, quiet mode and setting an output location
$ ./fisheyectl.sh backup --compression 9 -q -f /application_backups/fisheye/20090215.zip
Backup including cache data (also includes all default components)
$ ./fisheyectl.sh backup --cache
Restoring a backup with cache data (also restores all default components)
$ ./fisheyectl.sh restore --cache
Advanced backup command line settings
In some cases it might be preferable to only backup a limited set of items. This could be useful when your instance uses an external database such as MySQL or PostgreSQL and your DBA has already configured automatic backups in the database. The commands below allow this.
Option | Switch | Description | Default |
---|---|---|---|
Exclude Plugins | --no-plugins | Excludes plugins from the backup. | No. By default, plugins are included in every backup. |
Exclude Templates | --no-templates | Excludes templates from the backup. | No. By default, templates are included in every backup. |
Exclude Uploads | --no-uploads | Excludes uploaded files (such as patch reviews, stored in Crucible's internal database) from the backup. | No. By default, uploads are included in every backup. |
Exclude SQL Database | --no-sql | Excludes the SQL content database used by both Fisheye and Crucible. | No. By default, this data is included in every backup. |
Show help | --help OR -h | Shows inline help on the command line. | No |
Known limitations
Please note that the below limitations are common for any Java based backup tool.
Archives Containing Over 65535 Files
Versions of Java earlier than v1.6 (b25) are incapable of handling zip files that contain more than 65,535 files. The solution for this problem is to either upgrade to a version of Java later than v1.6 (b25), or ensure that the archive does not exceed the threshold (contains less than 65,535 files). The Fisheye cache (not included in backups by default) can be a contributor of many small files. Hence, exclude the cache from backups if this is likely to be a concern.
Archives Larger Than 4GB
Java has trouble reading and writing zip files that are larger than 4GB. As of release 1.5 Java appears capable of reliably creating archives that are over 4GB, but remains unable to extract them. For details see Sun's bug report. Also be aware of the fact that some file systems (including FAT32) have trouble with files larger than 4GB.
As a workaround, make sure you do not create archives that are larger than 4GB. The Fisheye cache (not included in backups by default) can be a contributor of a lot of small files (although these tend to compress very well). If you still want to archive everything and end up with an achive that is too large, consider creating separate backups for the Fisheye cache and uploaded files respectively.
Scheduling Crucible backups
To set a schedule for automatic backups, open the administration screen and click 'Backup' under 'System' on the left navigation bar. The 'Backup' page opens. Now, click the link 'Manage Scheduled Backups' at the bottom of the page. The 'Scheduled Backups' page opens.
On the 'Scheduled Backups' page, click 'Edit' to adjust the backup schedule. Set the desired options and click 'Save'.
The options for scheduled backups are detailed in the table below.
Option name | Description | Allowed Values |
---|---|---|
Disable Scheduled Backups | Stops regular backups from taking place. | On (disabled) or Off (enabled) |
Backup path | The path where the backup .zip file will be stored. | Any system or network path that Fisheye or Crucible can access. |
Backup file prefix | Characters that will be added to the beginning of the backup file name. | Any string of characters that can be used as part of a filename on the local operating system. |
Backup file date pattern | Sets a date for the next (or initial) backup to take place. | Any valid date in the format |
Backup frequency | Sets how often the backup will take place. | Can be set to 'every day', 'every Sunday', 'Monday to Friday' and 'first day of the month'. |
Backup time (HH:mm) | The time when the backup will take place. | Any valid 24-hour time in the format |
Include | Specifies which items must be included in the backups (these components are explained at the top of this page). | As per the options for regular on-demand backup (These components are explained at the top of this page). |
Screenshot: Scheduling Backups in Fisheye and Crucible
Be aware that scheduled backups can fill up disks unless you regularly move or delete old archives.
Restoring Crucible data
Restoring Crucible data from the command line
There is currently no way to restore a backup from the web interface because Crucible must be shut down during a data restore.
Restoring a backup will irreversibly overwrite the data of your installation with the data from the backup archive.
If you made a backup from production which connected to an external database, and restore this backup to a test server without specifying another database to restore too, you will drop and restore to your production database. Thus when restoring to a test server, always ensure you specify the correct database to restore to (or restore to an in-built database).
- Install Crucible into a new, empty directory (this must be the same version that the backup was created from, or later).
Note that you cannot restore data into versions of Crucible which are older than the version that created the backup. - Make sure the Crucible instance is not running.
- Open a command line interface on the Crucible server computer.
- Run the restore command on the command line with the desired options.
- The specified elements will be restored.
- Start the Crucible instance.
- When using Fisheye integrated with Crucible, you will need to re-index your repositories after restoring data, unless the backup archive was created with the
--cache
option.
Command line restore options
These examples are for use in a Linux-like operating system. When using these commands on Windows, use the filename fisheyectl.bat
and use the correct slashes. Run the command from the
directory.<Crucible home directory>
/bin/
The basic syntax of the restore command is as follows:
$ ./fisheyectl.sh restore -f /path/to/backup_2009-10-02_1138.zip [OPTIONS]
To see inline help for all backup options, run the following command in the
directory:<Crucible home directory>
/bin/
$ ./fisheyectl.sh restore --help
Restores a Fisheye/Crucible backup instance.
If you are using an external database (as opposed to the default built-in database), make sure the JDBC driver file is present in the FISHEYE_INST/lib
directory when running restore.
Option | Switch | Description | Default |
---|---|---|---|
Suppress output | --quiet OR -q | Suppress the output messages from the restore program on the command line. | No |
Choose file to restore from | --file PATH/FILENAME OR -f PATH/FILENAME | Restore the backup from PATH/FILENAME. | Yes (required) |
Show inline help | --help OR -h | Displays help for options on the command line. | No |
Advanced command line restore settings
By default, the restore program will restore all items found in the backup archive (so if you included the caches using the --cache
option, these will automatically be restored). However, it is possible to only restore a subset of items from the backup, by explicitly specifying the item names on the command line and only those will be restored.
Option | Switch | Description |
---|---|---|
Restore Fisheye cache | --cache | Restore the repository cache backup. |
Restore plugins | --plugins | Restore 3rd-party plugins and their configuration data. |
Restore templates | --templates | Restore freemarker templates from the backup (the restored instance will use the built-in templates). |
Restore uploads | --uploads | Restore uploads (e.g. patch files uploaded into Crucible and contents of files under review). |
Restore Crucible reviews | --sql | Restore the SQL database containing user profiles, reviews and review comments. |
Set database type | --dbtype OR -t | SQL database type ( |
Set JDBC URL | --jdbcurl OR -j | JDBC URL of the SQL database. Only required when restoring to a database location different to that used at used at backup time (not applicable for |
Set JDBC username | --username OR -u | JDBC username of the SQL database. Only required when restoring to a database location different to that used at used at backup time (not applicable for |
JDBC password | --password OR -p | JDBC password of the SQL database. Only required when restoring to a database location different to that used at used at backup time (not applicable for |
JDBC class | --driver OR -d | Specifies the JDBC driver class name needed to access the SQL database. Only required when restoring to a database location different to that used at used at backup time and when using a different JDBC driver than the standard driver associated with the database specified through |
Notes on migrating backup data
When the process restores a SQL database, it looks at the configuration data (config.xml
) included in the backup archive to learn which database product was used and how to connect to it. When Crucible uses the built-in HSQLDB database (which is the default), the restored instance will also use that.
However, when the restored instance will use a different database than the backed up instance (for instance, HSQLDB was used at the time the backup was created, but it needs to be restored on MySQL), use the command line options to point the process to the new database.
Command line example: migrating backup data to MySQL
These examples are for use in a Linux-like operating system. When using these commands on Windows, use the filename fisheyectl.bat
and use the correct slashes. Run the command from the
directory.<Crucible home directory>
/bin/
Restoring to a Crucible instance that uses a different database (ensure the mysql driver jar file is present in the FISHEYE_INST/lib
directory)
$ ./fisheyectl.sh restore \
--username john \
--password smith \
--jdbcurl jdbc:mysql://localhost:3306/crucible \
--dbtype mysql \
--file /path/to/backup_2009-10-02_1138.zip