YouTrack Database Backup
The YouTrack Database Backup recipe creates a new database backup for a YouTrack instance using the YouTrack REST API and verifies that the backup completed successfully. Combined with a schedule trigger, backups can be started and monitored regularly from TeamCity.
| Recipe ID | jjideenschmiede/youtrack-database-backup |
| Marketplace | YouTrack Database Backup |
| Source code | GitHub |
How It Works
- The recipe starts the backup via the YouTrack REST API
- It then checks the status of the backup every 10 seconds and logs the progress in the build log
- As soon as YouTrack reports the backup as finished, the build step ends successfully
The build step fails if the backup cannot be started, is cancelled, YouTrack reports an error, or the backup does not complete within 60 minutes.
The backup is created by YouTrack itself and stored in the location configured there. The recipe does not download a backup file.
Installation
The recipe requires TeamCity 2025.03 or later. How to add it to a build configuration is described under Using a Recipe.
Inputs
| Input | Required | Description |
|---|---|---|
| YouTrack Base URL | Yes | Base URL of the YouTrack instance, for example https://youtrack.example.com |
| YouTrack Permanent Token | Yes | Permanent token for authentication with the YouTrack API |
Regular Backups
- Create a separate build configuration for the backup
- Add the recipe as the only build step
- Add a Schedule Trigger, for example daily at night
- Set up a notification for failed builds, so that a failed backup is noticed
Technical Details
| Property | Value |
|---|---|
| Starting the backup | POST /api/admin/databaseBackup/settings |
| Status check | GET /api/admin/databaseBackup/settings/backupStatus, every 10 seconds |
| Maximum duration | 60 minutes |
| Timeout per request | 30 seconds for connecting, 60 seconds for the start, 30 seconds per status check |
Error Messages
| Message | Cause |
|---|---|
Failed to trigger backup (HTTP 401) or (HTTP 403) | The token is invalid or the user lacks the permission |
Failed to trigger backup (HTTP 404) | The base URL is not correct |
Backup was cancelled | The backup was cancelled in YouTrack |
Backup failed with error | YouTrack reports an error while creating the backup; the message from YouTrack is included |
Backup did not complete within 60 minutes | The backup takes longer than 60 minutes |
Notes
-
The base URL is given without
/api; a trailing slash is ignored. -
The user the token belongs to needs the permission to manage database backups in YouTrack.
-
The input field for the token is a text field. Store the token as a parameter of the type Password and reference it in the input field, so that it is not kept in plain text in the configuration.
-
The TeamCity agent must be able to reach the YouTrack instance over the network.