- 26 May 2021
- 5 Minutes to read
- Print
- DarkLight
- PDF
Backing Up & Restoring
- Updated on 26 May 2021
- 5 Minutes to read
- Print
- DarkLight
- PDF
Your Inedo products should be backed up frequently.
Critical data to back up for each product:
Item | Note |
---|---|
Configuration File | the installation configuration file that contains your database connection string and encryption key, which is used to encrypt secrets like passwords |
Database | the SQL Server database that contains all of your Inedo product's configuration data |
Package Files (ProGet only) | the disk paths that contain all the files for packages stored in ProGet |
Artifact Files (BuildMaster only) | a path on disk that contains all the files for artifacts you created within BuildMaster |
You may also back up your extensions (plug-ins) folder, which is stored in the path defined in the Extensions.ExtensionsPath advanced configuration setting. This will make restoring to a new server as easy as possible, in that you'll just need to copy the backup files to the same location on the new server.
Installation Configuration File Backup
The installation configuration file contains sensitive information, so it's important to consider how (or even if) you want to back this file up.
The most important piece of information in this file is the EncryptionKey
setting. This is used to decrypt secrets stored in the database, such as passwords for connectors in ProGet, or agent
credentials in BuildMaster and Otter. Without the encryption key, your Inedo product will be unable to decrypt these secrets, and may exhibit unexpected errors as a result.
On the same token, someone with access to both the database and the encryption key would be able to decrypt the secrets, so you should be careful where you back it up. This file also contains your database connection string, which may contain a password to connect to the database.
Database Backup
If you've never worked with Microsoft SQL Server before, not to worry - you won't even know you're working with it. But if you're already familiar with Microsoft SQL Server and know how to back up and restore databases, you can skip this section.
We're not doing anything special, so you are free to use whichever strategy works in your organization. So long as that strategy involves backing up the database.
If you installed your Inedo product with the built in database, then the installer also installed Microsoft SQL Server Express Edition with an instance named INEDO
. One of the tools installed with SQL Express is the command-line execution osql.exe
; it's located in the SQL Server tools directory, which is typically C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn
.
You can use a single command to back up the database, which you may need to run as an administrator if you have UAC enabled in Windows:
Product | Back up command |
---|---|
BuildMaster | osql -S .\INEDO -E -Q "BACKUP DATABASE [BuildMaster] TO DISK=N'C:\Backups\BuildMaster.bak' WITH FORMAT" |
ProGet | osql -S .\INEDO -E -Q "BACKUP DATABASE [ProGet] TO DISK=N'C:\Backups\ProGet.bak' WITH FORMAT" |
Otter | osql -S .\INEDO -E -Q "BACKUP DATABASE [Otter] TO DISK=N'C:\Backups\Otter.bak' WITH FORMAT" |
You can customize the path on disk as needed. To run this command on a regular basis, just set up a scheduled task using the Task Scheduler. Note that you can back up your Inedo product at any time without having to stop any of the services.BUILDMASTER
PROGET
OTTER
Package Files Backup
This only applies to ProGet
All package files should be backed up regularly.
By default, a feed's package files are stored on disk in the %ProgramData%\ProGet
directory. However, this directory can be changed by either editing the default directory or by setting the Disk Path property on a feed. See Package File Storage & Retention to learn more.
Artifact Files Backup
This only applies to Buildmaster
All artifact files should be backed up regularly.
By default, artifacts are stored in a location (defined in Artifacts.Base.Path settings
) that contains all the files for artifacts you created within BuildMaster
Restoring an Installation
There are generally three reasons why you might want to restore an Inedo product installation from a backup.
- Rolling back to an earlier version of your Inedo product - if there were issues with or during the installation of a new version of the product
- Moving your Inedo product to a new server - see our guide for migrating BuildMaster to a new server
- Undoing a Serious Error - such as making a mistake in the software itself
The Easy Way (Restore from the same version)
The easiest way to restore an Inedo product installation is to first ensure that you have a working installation that has the same version number as your backup. That means you'd want to restore a ProGet 2.6.1 back-up to a working 2.6.1 installation, etc.
If you're not sure what version your backup is (perhaps your server blew up and you only have the .bak file), then you'll have to use the advanced way described after this section.
If you backed up your database using the command above, then you can use the following command to restore:
Product | Restore command |
---|---|
ProGet | osql -S .\INEDO -E -Q "RESTORE DATABASE [ProGet] FROM DISK = N'C:\Backups\ProGet.bak' WITH FILE = 1, NOUNLOAD, STATS = 10" |
BuildMaster | osql -S .\INEDO -E -Q "RESTORE DATABASE [BuildMaster] FROM DISK = N'C:\Backups\BuildMaster.bak' WITH FILE = 1, NOUNLOAD, STATS = 10" |
Otter | osql -S .\INEDO -E -Q "RESTORE DATABASE [Otter] FROM DISK = N'C:\Backups\Otter.bak' WITH FILE = 1, NOUNLOAD, STATS = 10" |
Just make sure the Inedo product's Windows Service(s) are stopped; otherwise, SQL Server will complain with a "database in use" error.
After you get the database up, just make sure your artifact files (BuildMaster) and/or packages files (ProGet) are where they are expected to be, and start the service(s).
The Advanced Way (Restore from any version)
This isn't really that much harder, but it does involve some knowledge of Microsoft SQL Server or the willingness to contact us for assistance. Firstly, you won't be able to restore a newer backup to an older version (i.e., a BuildMaster 3.0.0 back-up to 2.6.1). But since you should never need to do that anyway, there's nothing to worry about.
If you're using your own SQL Server, then all you need to do is make sure your Inedo Product’s Database has been restored before running the installer of the version you want. The installer will make sure the restored database is up-to-date as part of the installation.
If you want to use the built-in database, then start by running the installer. It will install the files and create a new Inedo Product database for you. From here, restore your database back-up (you can use the command above) and then run the Database Tool (available from inedo.com) for the version you are installing. That will ensure the database is up to date.