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.
Backup via maintainDB command-line tool: same as via the UI. To include all data, use the tool when the server is stopped.
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.
Backing up Data
You can choose what data is backed up either in the UI or by adding the respective parameters in maintainDB.
TeamCity allows backing up the following data:
Server settings, settings of projects and builds configurations (everything stored in
<TeamCity Data Directory>/config
), and secure valuesCustom plugins (installed under
<TeamCity Data Directory>\plugins
) and database drivers (from<TeamCity Data Directory>/lib
directory)Supplementary data: settings history, triggers states, plugins data, and so on (everything under the
<TeamCity Data Directory>/system/pluginData
directory)Build logs
Personal changes
The following data is not included into backup:
Build artifacts (because of their size). These include build artifacts, internal NuGet feed packages, coverage report, finish build parameters, settings digest, and so on. If you need to back up the artifacts, save the contents of artifacts directories manually before restoring TeamCity data from backup.
For backup from the UI: running builds and build queue state. If you want to back up these, stop the TeamCity server and use the maintainDB tool.
TeamCity application manual customizations under
<TeamCity Home>
, including used server port number, which are stored in the<TeamCity Home>/conf/server.xml
file.TeamCity application logs (under
<TeamCity Home>/logs
).Any manually created files under
<TeamCity Data Directory>
that do not fall into previously mentioned items.
The recommended approach is either to perform the manual backup process or run a backup from the 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.