TeamCity Data Backup
About Data Backup in TeamCity
TeamCity provides several ways to back up its data:
Backup from the Web UI: an action in the web UI (can also be triggered via REST API) to create a backup while the server is running. It is recommended for regular maintenance backups. Some limitations on the backed up data apply (see the related section below). This option is also available on upgrade in the maintenance screen: on the first start of a newer version of the TeamCity server.
Manual backup: is suitable if you want to manage the backup procedure manually.
You may need to back up the build agent's data only.
Restoring data from backup is performed using the
Backing up Data
TeamCity allows backing up the following data:
- Data stored in the database
Server settings, settings of projects and builds configurations (everything stored in
<TeamCity Data Directory>/config), and secure values
Supplementary data: settings history, triggers states, plugins data, and so on (everything under the
<TeamCity Data Directory>/system/pluginDatadirectory)
The following data is not included into backup:
Build artifacts (because of their size). These include explicit build artifacts and internal artifacts storing coverage report, finish build parameters, settings digest, and so on. If you need the build artifacts, please also back up the contents of artifacts directories manually.
For backup taken from UI: running builds and build queue state. If you want to back up these, use the command line maintainDB tool while the TeamCity server is not running.
TeamCity application logs (they also reside under
Any manually created files under
<TeamCity Data Directory>that do not fall into previously mentioned items.
The recommended approach is either to perform the backup process described under Manual Backup and Restore or run a backup from the web UI regularly (for example, automated via REST API) with the "Basic" level — this will ensure backing up all important data except build artifacts and build logs.
Build artifacts and logs (if necessary) can be backed up manually by copying files under
<TeamCity Data Directory>/system/artifacts.
If logs are selected for backup, TeamCity will search for them in all artifact directories currently specified on the server.
Note that for large production TeamCity installations, exporting and importing of data from/to the database may not be an optimal solution and maintaining database backup via replication might be a better option; for example, see the corresponding documentation for MySQL database.