Using terraform to deploy a Spring boot azurerm_app_service with upload of jar - azure

I have been attempting this for a good chunk of today but still have not found a solution.
I have a built spring boot application in the form of a jar.
I push this to a storage account container as a blob with azurerm_storage_blob
I reference this from a azurerm_app_service in app_settings.WEBSITE_RUN_FROM_PACKAGE using a data.azurerm_storage_account_sas
I see that it has pulled the blob from storage in the app-service but it has exploded it under D:\home\site\wwwroot
I have set site_config.java* (java_version, java_container and java_container_version) but it makes no attempt to start the application
I see there is a site_config.app_command_line but none of the examples I have found set this.
Has anybody gotten a spring boot application in a windows app service running using terraform?
Is there a better way to get the application jar to azure using terraform?

There are various ways to deploy your application to Azure App Service. For your scenario, I recommend not to set WEBSITE_RUN_FROM_PACKAGE and make sure your executable jar is called app.jar and it is dropped to the root of your Web App's content folder (/site/wwwroot).
App Service will automatically take care of setting the appropriate SERVER_PORT environment variable behind the scenes, so that when your Spring Boot application starts, it will start listening to the correct port.
If you need to set parameters, you can always set JAVA_OPTS in the App Service Settings section in the Azure portal and those will travel as environment variables and ultimately used by java.exe upon start.
If you hit any rough edge, feel free to open a ticket in Azure portal and we will be able to assist you better to make sure your app runs well in Azure App Service.
Other popular mechanism to deploy is using Maven:
https://learn.microsoft.com/en-us/azure/java/spring-framework/deploy-spring-boot-java-app-with-maven-plugin

Related

Best approach to manage serilog.json location in Azure environment

We have a Web application, developed with ASP.Net Core and deployed on Azure using Docker container. The Web App uses serilog library (https://serilog.net/) as internal logging engine. The configuration of Serilog is stored in the file serilog.json, included in the Visual Studio Solution Explorer and, obviously, in the final Docker container.
Using a special admin panel included in the Web App, an administrator can change the active Serilog log level to any supported value (Fatal, Error, Warning and so on). This feature simply updates the file serilog.json, and ASP.NET Core reloads on-the-fly the new log level.
It works like a charm, but now the problems begins.
We use Azure DevOps to deploy every nighty a new version of our Web App, so every night the current Docker container is overwritten with the newest one. Also the file serilog.json, so every night we lose the log level configuration.
What are we wrong with this approach?
We need to move 'serilog.json' outside the Docker container and store it in another location?
Any idea?
Thanks for your help, support and discussion!

Azure web hosting using FTP / MS WebDeploy

Can I host a web application created on .net core 2.1 with sql server as database to azure web app service using CI tools / MS WebDeploy?
The following points I want to take care:
The application is using file system for temp storage and file storage
Deployment should be managed by some CI tools such as jenkins
After deployment, the app settings file should be modified with some keys/server details
Log files(stored on app root) should be accessible by application administrator
Is there a way to create a virtual directory same as in IIS and upload the files using FTP or similar protocols..?
All your doubts about deploying .net core 2.1 web app are achievable.
Suppose our projects are all completed and uploaded to github.
Questions and explanations about your concerns:
About the connection configuration using the database, you can directly configure it in web.config. If you are using azure sql server, find the connection string, set up the firewall, and pass the SSMS test, you can test the connection in the code. It can also be added in the Configuration -> Application settings -> Connection strings in the portal. After the addition, the priority is higher than the configuration in web.config, which will override the configuration and not modify the web.config file.
Regarding the use of file storage, you can use azure storage services or not. Looking specifically at the business, for example, very small pictures, documents and other files can be stored in the current program running directory, which is consistent with the original development at the code level. When publishing, you need to include the MyFiles file in the publishing process, or wait for the publishing to be completed and add folders manually in kudu, or the program can judge. It is recommended to use the program to judge that the subsequent program upgrade will not lose data.
The confidential information in the app settings file can actually be configured in web.config or appsetting.json. Make sure that the offline project is running properly when you are debugging locally, and then you can publish it. The rest is configured in the portal as in the first explanation.
The Log Files file storage can fully achieve the effect you want. It should be enough to set the owner permissions of this app services. For details, please refer to the official documentation.
Virtual directories and virtual applications, I have a better answer in another post here, you can refer to it.
Steps:
First of all, we can create a web app in portal and select .net core 2.1. Create appservices, and click Deployment Center when finished.
Follow the prompts step by step, and wait until the Action in github is completed, and the release is successful.

How FTP deploy .NET Core WebApp to Azure Linux App Service plan

I want do deploy code to Linux App service plan over FTP but I fail because I am missing a step how to "say to app service to use app DLL instead of default one".
Code is copied, I even uploaded test zip file and I can't download it, getting error 404 so how did Microsoft imagine to deploy code over FTP? I couldn't find any info in their documentation regarding this exact case.
I want to avoid using docker file, If this can't be done I'll simply switch to using Windows based App service plan.
In application setting screen of your WebApp mention the startup file name
dotnet

Troubleshooting Azure Service Fabric: "The ServiceType was not registered within the configured timeout."

I have deployed a Web API written with .net Core to a local dev Azure Service Fabric cluster on my machine. I have plenty of disk space, memory, etc, and the app gets deployed there. However, success is intermittent. Sometimes it doesn't deploy to all the nodes, and now I have it deployed to all the nodes, but within the Azure Service Fabric Manager page, I see each application in each node has an Error status with the message: "The ServiceType was not registered within the configured timeout." I don't THINK I should have to remove and redeploy everything. Is there some way I can force it to 're-register' the installed service type? Microsoft docs are really really thin on troubleshooting these clusters.
Is there some way I can force it to 're-register' the installed service type?
On your local machine you can set the deployment to always remove the application when you're done debugging. However, if it's not completing in the first place I'm not sure if this workflow would still work.
Since we're on the topic, in the cloud I think you'd just have to use the Powershell scripts to first compare the existing app types and version and remove them before "updating". Since the orchestration of this is complicated I like to use tools to manage it.
In VSTS for instance there is an overwrite SameAppTypeAndVersion option.
And finally, if you're just tired of using the Service Fabric UI to remove the Application over and over while you troubleshoot it might be faster to use the icon in the system tray to reset the cluster to a fresh state.

Azure: Deploying a Ruby on Rails app in the Cloud

I've just completed an automation script that:
downloads a project build to local storage (worker role)
installs ruby, apache, and other dependencies
configures apache and the RoR application to serve requests via port 81
This is all working locally. I'm working with visual studio; running the application successfully pulls the local machine from "blank slate" to "serving requests".
I'm now trying to push this up to Azure - no longer using the local machine, but an actual worker role.
I've packaged the project and uploaded it to a production environment via my Azure subscription portal, but navigating to the site URL doesn't give me anything (site not found).
I'm a bit new to Azure. What steps do I need to take to ensure that this application will work up in the cloud? I feel like I've forgotten to configure something, like the endpoint port (81). Any advice or recommended reading would be super helpful; thank you so much for your time!
If you need some real assistance to troubleshoot the problem, tt would be best to see the following 3 things:
Your automation script (Startup Task)
Your worker role OnStart() function
Your ServiceDefinition and ServieConfiguration
Are you using ProgramEntryPoint to luanch your RoR app or you are doing all of this in Startup task? Based on above info, it is easy to understand the application architecture and some suggestions can be made.
However, the best way to troubleshoot this problem is to enabled RDP access to your Azure Worker Role VM and then Log into your Azure VM to understand what is going on. RDP access to Azure VM will validate that your install script ran correctly and all the modules were started.
As your are new to Windows Azure there could be several things could be missing and if you provide more info you will get accurate help instead of some guess work.

Resources