Manual Backup and Restore
Server Manual Backup
Other ways to create backup are TeamCity Data Backup. You can use these instructions if you want fine-grained control over backup process or need to use specific procedure for your TeamCity backups.
The following is needed to be backed up:
TeamCity data directory
TeamCity Data Directory directory stores:
server settings, projects and build configurations with their settings (i.e. all that is configured on Administration web UI)
build logs and build artifacts
current operation files, internal data structure, etc.
You may refer to TeamCity Data Directory section on the directory structure and more details. If necessary, you can exclude parts of the directory from backup to save space — you will lose only the excluded data. You may safely exclude "system/caches
" directory from backup — the necessary data will be rebuild from scratch on TeamCity startup. If you decide to skip data backup under < >/system
directory, make sure you note the most recent files in each of artifacts
, messages
and changes
subdirectories and save this information. It will be needed if you decide to restore the database backup with TeamCity Data Directory corresponding to a newer state then the database. The < >/system/buildserver.*
files store internal database (HSQLDB) data. You should back them up if you use HSQLDB (the default setting).
database_dataDatabase data
Database stores all information on the build results (build history and all the build-associated data except for artifacts and build logs), VCS changes, agents, build queue, user accounts and user permissions, etc.
If you use HSQLDB, internal database (default setting, not recommended for production), the database is stored in the files residing directly in
< >/system
folder. All files from the directory can be backed up. You may also refer to the HSQLDB backup notes.If you use external database, please back up your database schema used by TeamCity using database-specific tools. External database connection settings used by TeamCity can be looked up in the
< >/config/database.properties
file. See also Setting up an External Database.
Application files
You do not need to back up TeamCity application directory (web server alone with the web application), provided you still have original distribution package and you didn't:
place any custom libraries for TeamCity to use
install any non-default TeamCity plugins directly into web application files
make any startup script/configuration changes
If you feel you need to back up the application files:
If you use non-war distribution: back up everything under <TeamCity Specific Directories> except for
temp
andwork
directories.If you use war distribution, pursue the backup procedure of the servlet container used.
Log files
If you need TeamCity log files (which are mainly used for problem solving or debug purposes), back up <TeamCity home directory>/logs
directory.
Manual Restoration of Server Backup
If you need to restore backup created with the web UI or maintainDB
utility, please refer to Restoring TeamCity Data from Backup. This section describes restoration of manually created backup.
You should always restore both data in <TeamCity data directory> and data in the database. Both database and the directory should be backed up/restored in sync.
TeamCity Data Directory restoring
You can simply put the previously backed up files back to their original places. However, it is important that no extra files are present when restoring the backup. The simplest way to achieve this is to restore the backup over a clean installation of TeamCity. If this is not possible, please make sure the files created after the backup was done are cleared. Especially the newly appeared files under the artifacts
, messages
, changes
directories under < >/system
.
TeamCity Database restoring
When restoring database, please ensure there are no extra tables in the schema used by TeamCity.
Restoring to a new server
If you want to run a copy of the server, make sure the servers use distinct data directories and databases. For external database make sure you modify settings in < >/config/database.properties
file to point to another database.