Closed bdollerup closed 5 years ago
Hey Bjarne,
First off, make sure you have a backup of the database. I assume your using SQL Azure so it should be happening automatically. https://docs.microsoft.com/en-us/azure/sql-database/sql-database-automated-backups
As for updating the software, you can leverage deployment slots. In a deployment slot you can update the files to the latest release. Make sure you copy over your sonar properties and plugins as needed. Then you can navigate to the deployment slot URL (https://webappname-slotname.azurewebsites.net) and append /setup (https://webappname-slotname.azurewebsites.net/setup) to initiate SQ to update the database schema. Once that is complete, swap the slot with the primary and you're done.
If something goes wrong before update is over you simply restore the database backup. If you notice something wrong after the update you can swap the deployment slots back and restore the database from back to get back to your green state.
I hope that helps and I'm glad this project came in handy.
On the subject of point releases (eg 7.9.1), your downloader script doesn't find them (it finds 7.9 in favour of 7.9.1)... I wrote a 'dirty hack' to your script to account for this:
$zipFiles = $allDownloads[0].Links | Where-Object { $_.href.EndsWith('.zip') -and !($_.href.contains('alpha') -or $_.href.contains('RC')) }
$zipFilesSorted = @()
foreach ($item in $zipFiles) {
$row = "" | Select-Object href,version
$row.href = $item.href
$version = (((($item.href -split "-")[1]) -replace ".zip","").Replace(".","")).padright(5,"0")
$row.version = $version
$zipFilesSorted += $row
}
$zipFiles = $zipFilesSorted | Sort-Object version
$latestFile = $zipFiles[-1]
I'm sure someone could write it better, and make it even more robust (eg, it assumes the binary filename uses '-' as the start of the version number). And I'm sure someone could write a better algorithm!
Thanks @Rincey , I opened another ticket to track that bug.
I just installed SonarQube using your work. I'm really impressed with the ease of the install as well as "moving" to a real database (Azure SQL) subsequently.
I've run into an issue with creating my own quality gate and the 7.9.1 version included a fix. Now, my challenge is upgrading the SonarQube instance.
I've read through the SonarQube guide, but I'm uncertain about how to "translate" that to upgrading the SonarQube instance I now have hosted in an Azure App Service. Any pointers are greatly appreciated.
Thanks, Bjarne