Deploying Java Applications to Azure using Continuous Delivery

April Edwards

Join us for episode 3 in our series DevOps for Java Shops! In this episode Brian Benz walks us through how to deploy a Java application to Azure App Service using GitHub Actions and continuous delivery!

April: [00:00:00] Tune in into this week’s episode of the DevOps lab, where we have episode three with dev ops, for Java shops. So tune in to see what we do next with feature flags and get hub actions.

Welcome back to this week’s episode of the DevOps lab. We’re going to kick off our series DevOps for Java shops. We’re back with episode three and we’re welcoming back. Brian Bens. Welcome Brian,

Brian: glad to be

April: here. Great to have you back. We have bit joining us on this episode as well. He’s very interested to see how this app is going to come about.

And in this one, we’re going to talk about our Java app deployment into Azure app service, and we’re going to complete that GitHub action and get that full end to end development into our app.

Brian: Yep. Great. Yeah. In the last episode I did a build which completely failed and [00:01:00] then we actually deployed out to Azure, but that’s not going to work either.

So this is what the app is supposed to look like here on my screen. It’s supposed to look like this, but if I go into our GitHub repo. If you see here it deployed and it’s got a green check mark it’s successfully deployed to dev ops lab, BB, that Azure But when I click here, you get an error message.

So, this is what the error message looks like. It’s just telling you that the application is not working. And I can do something kind of cool here. I can go do dev ops lab, BB, that Azure, but I can also add a SCM here. So dev ops lab, BB dot SCM got Azure, and this works for any Azure app service and it creates a little environment called kudu for you and inside of kudu, [00:02:00] you can check out your site.

You can see the jar file did indeed deploy. So the. Get hub action here. When I go in, it’s not lying. It did deploy. It did actually deploy to my app app service using the app dot jar, which is my job, a file. However, it has, it’s missing an important part. So if we actually go back in and I refresh my dashboard on Azure, you’ll see.

That dev ops lab, BB is the app service and inside the configuration, there’s something I need to set up. So this is like a real world situation where you would have something like a database connection or something else. So the app has actually deployed the jar file is there and it’s running, but the application is failing because you haven’t set up the configuration yet.

But what you need to do there is actually just set up a new application settings. [00:03:00] And in this case is called app configuration connections, connection string. If you recall, In the first episode, I talked about feature flags using our app configuration service and inside those feature flags, there’s a connection string that you get provided with and that connection string can be used anywhere.

You still have to connect your application to the actual feature flag manager and app configuration through some kind of connection string. And in this case, the app is set up to use this app configuration connection string to point to this. So it’s actually going to connect to that feature flag service.

It’s updating the web app right now. So now when I actually go back into my application here, we still see an error, but it’s a different error now. [00:04:00] And this is a good error because if we type welcome, we see. There we go. Yay. So this is the original application that I already had working. This is the application that we just created at dev ops lab.

VB got Azure and it’s fully running now just by adding that connection string. And if I go into the feature manager now here’s the cool part. I can turn off the feature flag. I mentioned before this feature flag can be set and it can connect to any kind of application running on Azure, not running on Azure.

I can, it’ll actually remove bit from here, but it’ll also removed bit from our old application as well. There we go. So the idea here is you can create one feature flat. That actually controls whoops, feature flag that actually controls multiple applications. So if you want, if you’ve got 12 different applications, one’s running on an app, service ones are running in Kubernetes.

One’s running on [00:05:00] AWS, one’s running on local prem. All you have to do is press that button. Set up a time window or set up a geographic location. And all of those features will be enabled or disabled depending on your settings. When you change the feature. That’s awesome.

April: Cause I think most of our customers are not entirely in Azure.

They’re either in a hybrid environment where they’re running on prem and another cloud. So this is perfect and they probably have applications running across multiple data centers in Azure or anywhere else. And again, we see a lot of people running. You said at Brian and applications in Azure web apps, a K S and all sorts of places.

So this is really cool. It’s great to see that we can affect our app and multiple locations on multiple services and leverage features.

Brian: Right. Yeah. Before feature flags, you would have to deploy a new version of the application somewhere else. Kind of figure out how to deploy and link to that application and all the other stuff.

So this is a great way to do that. For those of you who want to follow along at home you can find [00:06:00] all of the demos and the code that I use today, and a step by step instructions at dev ops for Java shop. So Slash dev for Java.

April: Awesome. Thank you, Brian. And for everyone out there, we will have this link up here for you.

We’ll also put it in the show notes, so please go out, give it a shot, enable some feature flags, get your application to a get hub action and see what you can do with it and put some stuff in the comments about the cool things you’ve done with your apps. And. So thank you everyone for tuning in and stay tuned.

We might have Brian Ben’s back for another episode here on the dev ops lab.

Learn about DevOps and subscribe:

The DevOps Lab on YouTube
Azure DevOps YouTube Channel

Recommended resources:

Azure DevOps Hands on Labs
Get started with Azure DevOps learning path
Azure DevOps: Start Free! Microsoft Azure: $200 Free Credit

Follow us on Twitter:

April Edwards | @TheAprilEdwards The DevOps Lab | @TheDevOpsLab Brian Benz | @bbenz