I would like to know if it's possible to deploy a spring boot application with MySQL database to the azure cloud. I couldn't find any instructions or tutorials.
Spring Boot App on Microsoft Azure
8.9k Views Asked by Daniel Pinkpank AtThere are 4 best solutions below
If you are looking at general Azure IAAS (Infrastructure as a service) part, then this question should not arise, since it is as good as any other IAAS offerring from other cloud service providers like Amazon. It can pretty much run anything, and yes, including Spring boot applications
If you are talking about a micro-service based hosting through Service fabric, question will be interesting, since Service fabric in itself provides the micro service hosting part and a plug and play there will be interesting.
This worked for me with an Azure API-App:
- Create the API-App in Azure
- Create the war file from Spring Tool Suite (File -> Export -> Web -> War-File) or via maven build
- Name the war file "ROOT.war"
- Put it in a folder "webapps"
- Push the webapps-folder and the containing war to a git repository
- Add the git repository to the Api-App Deployment Options in Azure
If the App is setup correctly (correct Java and Tomcat version selected), the war should be extracted automatically.
Additionally you can add a web.config file (parallel to the webapps folder), for more configuration options.
If the ROOT.war is not extracted, try removing the existing ROOT folder.
In additional to general information about java web apps, there's some Spring Boot-specific info in the Azure documentation:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-java-custom-upload/#springboot
In order to get a Springboot application running you need to upload your JAR or WAR file and add the following web.config file. The web.config file goes into the wwwroot folder. In the web.config adjust the arguments to point to your JAR file, in the following example the JAR file is located in the wwwroot folder as well.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar "%HOME%\site\wwwroot\my-web-project.jar"">
</httpPlatform>
</system.webServer>
</configuration>
Yes;
Create the web-app on the azure portal (tomcat or Jetty) (info)
create the war file from spring boot using your gradle/maven build scripts (info)
upload to Azure using the FTP options (info) & this
And you are done - it will be served on the default URL..