Azure Spring Apps Unboxing Experience
In the past few weeks of working at VMware for my co-op, I had the opportunity to help the Tanzu team improve Azure Spring Apps, one of Tanzu team’s many amazing products. Azure Spring Apps is a platform-providing service for Spring developers, allowing users to manage the lifecycle of their spring boot applications with comprehensive monitoring and diagnostics, configuration management, service discovery, CI/CD integration, and blue-green deployments.
When I was first introduced to the product, there were various options to get started, which I found overwhelming at first. I then found a quick-start documentation guide online that uses IntelliJ to build and deploy an application to Azure Spring Apps through the use of Java. However, while following the guide, I ran into an issue because deploying to Azure Spring Apps requires the paid IntelliJ Ultimate Version and I was using the free IntelliJ community version. So I looked for ways to deploy the app to Azure Spring apps without using?IntelliJ Ultimate. The solution I came up with was using Terminal.
Overall, the experience I’ve had with Azure Spring App was eye-opening. The trials and errors required me to learn a lot of new things. Despite a few bumps in the beginning, with the help of a lot of the documentation online, I was able to teach myself how to use it.
The rest of this blogpost recounts my experiences in more detail, documenting everything that occurred throughout this process.
This link points to a simple app that was built using Terminal and deployed to Azure Spring Apps
Timeline
I started off by first creating a free Microsoft Azure account, in addition to downloading IntelliJ along with the java 11.0.16 jdk.?
Inside Microsoft Azure, I created a new App Service, and then hit create.
Inside the creation settings, I chose my free azure subscription, and for resource group, I created a new resource group, naming it something simple like Samtestingazure.
I also named my web app name something simple, and chose to publish this app as code. For my runtime stack, since I was using Java 11 on IntelliJ, I chose Java 11.
For the rest of the settings, I had left them as what was already set as default, and then hit create.
After creating the app service plan, I went back and found a quick starter code online. In order to be able to create a new app, I needed to also download and sign into Azure on IntelliJ. In the beginning, my starter code was this:
I had generated my starter code from a Spring initializer:?https://start.spring.io/#!type=maven-project&language=java&platformVersion=2.5.7&packaging=jar&jvmVersion=1.8&groupId=com.example&artifactId=hellospring&name=hellospring&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.hellospring&dependencies=web,cloud-eureka,actuator,cloud-config-client
When clicking on the link from above, It takes the user to this page, where it allows me to configure the Project's metadata. However, because everything was set up for the user already, I just needed to make sure I was on a valid Spring Boot version and hit generate. Doing so downloads a zip file of the code to your computer, where you can unpackage and open up the code in IntelliJ.
However, some problems arose when I tried following along with the documentation, where IntelliJ wouldn't recognize me adding a -DskipTests in the command line textbox. What was supposed to happen was that the plug-in should have run the command mvn package -DskipTests on the hellospring app and deploy the JAR generated by the package command.?
A problem that showed up was when I tried to deploy to Azure Spring Cloud - a button in the screenshot of the guide that I found online (bottom picture) - it wasn't an available button on my IntelliJ (top picture). After researching a little about it, I found that "Spring support relies on the?Spring?and related plugins, which are bundled and enabled by default in IntelliJ?IDEA Ultimate. This functionality is not available in?IntelliJ IDEA Community Edition." (https://www.jetbrains.com/help/idea/spring-support.html)?I'm currently using the community edition, which is the free version that I was able to get using my school email.?
After poking around the web for a solution, I found this youtube video (https://www.youtube.com/watch?v=wrTRCojRDgQ)?that I followed along for reference. In the video however, he had deployed to Azure, which wasn't an option for me either.
These are the options that are available to me:
When I tried deploying to Azure Spring Apps, it would return this error:
And so, I tried to deploy to Azure Web apps instead, and after fiddling around with the code, this was the end code that I ended up with that wouldn't cause errors. In addition, I had realized that when deploying to Azure Web Apps, if I didn't add the "package -DskipTests" conversely to what the documentation was telling me to do (However, the -DskipTests was for Deploying to Azure Spring Cloud, not Azure Web Apps, which may be the reason why errors were showing up in the beginning), the program was able to run successfully with no failures in the tests. By doing so, I was able to deploy the short message I intended it to display to the web app. (The documentation itself wasn't wrong, but I had a hard time figuring out what to do if the "Deploy to Azure Spring Cloud" isn't there, as the documentation never specified what to do if it's not showing up)
领英推荐
This is the error that would show up when trying to deploy with "package -DskipTests" :?
Another error that would come up when creating the Spring Boot cloud config application was "No spring.config.import property has been defined." It took me a while to figure out this problem, but eventually, I looked up the problem on Stack Overflow to see if others had the same problem. I tried copying over the code that would fix the problem into the pom.xml file, which fixed the problem and allowed for the package to deploy successfully
However, what I really wanted was to deploy my app on Azure Spring Apps and not Azure Web Apps. So back to the drawing board ...
Experience with building and deploying a sample Spring Boot app to Azure Spring Cloud using Terminal?
After creating the web app using Java, I tried creating and deploying an app to Azure Spring Cloud instead of Azure App services. I decided to use Terminal to do this.
Timeline
As I had done in the beginning in the previous project, I started off by hitting create, but this time, I created an Azure Spring App.
I used an existing resource group that I had created already. For the service name, I decided to call it springbootapptest, and set my region to East US.?
I then opened terminal, created a local directly, and then cloned the given code from a github that I was able to find from?https://spring.io/guides/gs/spring-boot-for-azure/
While working on this project, I realized that I needed to download Maven in order to be able to configure and deploy the app to Azure Spring Cloud. I downloaded the latest version and followed a quick tutorial I found on Youtube (https://www.youtube.com/watch?v=j0OnSAP-KtU)
After successfully installing Maven, I built the JAR file using Maven and configured my web appp with Maven Plugin for Azure Spring Cloud by using the command "./mvnw com.microsoft.azure:azure-spring-cloud-maven-plugin:1.3.0:config" By doing so, Maven gets me logged in with the azure-maven-plugin automatically.
After inputting the command, Terminal allows me to select the cluster that was just created, after which I accepted default for the app name, and then returned y to expose public access for the application. After I configured all the needed settings, I deployed my web app to Spring Cloud.?
After being deployed successfully, there are activity logs that show me my progress
I have added below what the finished app now looks like when clicking on the link:
Conclusion
Some may find the difference between Azure Web Apps and Azure Spring Apps confusing, and wonder what exactly each one achieves.?
Azure Web Apps is a cloud computing-based platform;?its main purpose is to host websites. Created by Microsoft, this service allows users to publish web apps that are run on numerous frameworks and written in different programming languages.?On the other hand, Azure Spring Apps (which used to be called Azure Spring Cloud service) is a service created by VMware. It consists of open-source projects that supply the users with a smooth Spring integration using Azure services. ASA has numerous benefits that allow the user to:
Azure Spring Apps is a completely managed service for Spring Boot applications that allows users to build and run apps without the hassle of managing infrastructure. For instance, one can simply deploy a code for a Spring Boot app, and ASA will immediately wire the user's apps with Spring service runtime and built-in app lifecycles, allowing one to monitor the apps' performance, fix errors, and rapidly improve applications. Furthermore, it?includes full integration into Azure's ecosystems and services, which streamlines communication and increases outflow of information.
If you would like to learn more about Azure Spring Apps and how it works, feel free to check out the link below!
Strategy & Operations @ Dell EMC
2 年Very nice Samuel!
Teaching people about Computer Vison and Image Processing. Developer Relations expert and Founder of Tech Raven Consulting, specializing in: AI, Geospatial Data Analytics, Data Science, and Cloud Native Applications,
2 年You did really nice work!
CMO | Marketer, Builder, Innovator | AI Trailblazer, Kubernetes Enthusiast | Help Tech Companies Articulate Product Value and Differentiate it in the Market
2 年Thank you Samuel Wang it was a great experience and I learned quite a lot about Azure Spring Apps by reviewing your work.
Tech Marketing @Hedgehog - M.Sc, Kubestronaut, CCIE 9961 Emeritus, VCIX, CISSP
2 年It was great working with you on this Sam! Thanks for looping me in!