vanderby / SonarQube-AzureAppService

Instructions and files to host SonarQube on an Azure App Service without a container.
MIT License
90 stars 165 forks source link

Scaling down the App Service Plan #51

Closed buzzer70 closed 3 years ago

buzzer70 commented 3 years ago

Is it possible to scale down the service plan that the app uses to the F1 (Free) sku?

I have been using your solution for a while now and it works great. One of the niggles I have is to look into being able to power it down when it is not needed. I ran into a wall quickly trying to set the Service Plan to the free sku as the app has the 'Always On' set to True so i added to my todo list. Looking at your script, it looks like the 'Always on' property is set based on the environment variable Env:WEBSITE_SCM_ALWAYS_ON_ENABLED.

When i set it to false in general settings for the app, a quick refresh puts it back again and i assume this is because the environment is overwritten somehow?

I can sort of achieve what i want by issuing the following shell commands:

az webapp config set --name myapp --resource-group myapp-rg --always-on false az appservice plan update --name myapp-asp --resource-group myapp-rg --sku F1 az appservice plan update --name myapp-asp --resource-group myapp-rg --sku S1

but when i issue the first one, Sonarqube stops working as again, i assume i have changed something directly that the environment doesnt like and there is some refreshing going on.

you'll have to forgive me because I am not that familiar with the process that is going on, i have tried various other solutions as well so i know more than i want about a lot of different solutions (docker containers, azure container instances, azure repo with custom docker, the problems with the elastic search etc. etc.) and all i want to do is get SQ up and running centrally but with the ability to scale up / down quickly as part of a build in Devops or via turned on in the working day for review of the current analysis.

I would be just as happy with a solution like yours that ran on linux and was able to run the later versions of SQ for the latest fixes / rules and I already have a database with analysis in

vanderby commented 3 years ago

I'm glad you found the project helpful!

I know there was an issue running under the free tier, but I don't recall the specifics. That definitely could have changed in the last year, so give it a shot and see!

As for the always on, did you hit save after toggling it to off in the Azure portal UI? I am not aware of anything to automatically turn it back on. The references to Env:WEBSITE_SCM_ALWAYS_ON_ENABLED are just when reporting telemetry.

For a Linux solution, look into Linux containers running SQ hosted in App Service. This solution this project gives does allow for the latest SQ. To upgrade simply FTP to your web app and unzip the latest bits on top of the current SQ bits. Or update the bits in a staging slot and do a slot swap so you can fall back if needed!

vanderby commented 3 years ago

Closing due to inactivity.

buzzer70 commented 3 years ago

Sorry, long holiday weekend here so i didnt have chance to look properly at your response - Thanks for the reply. I did hit save after toggling it to off in Azure portal but now you have said that there is nothing automatically turning it back on then I will investigate further when i have chance.