May 18th, 2022

Deploy a Java application to Azure App Service using GitHub Actions

April Yoho
Senior Developer Advocate

Join us for episode 1 in our series for 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. Brian also covers off feature flags!

April: Welcome to this week’s episode of the dev ops lab. This week, we’re kicking off a brand new series dev ops for Java shops. So with us today, we have a very special guest Brian Benz. Welcome Brian !

Brian: Great Thanks!.

April: Great. So excited to have you on the show. You and I have worked together in the past, but for those that are out there watching that don’t know who the amazing Brian Benzes, could you take a moment and tell everyone what did you do for microbes?

Brian: Sure. So thank you. I’m a cloud advocate and that means that I speak at different events. I build [00:01:00] documentation and other things to inform developers about our cloud services at Microsoft on Azure and also other Microsoft products as well. And I focus on the job. Audience the Java community.

I haven’t to be a Java champion as well, which is a, an honor bestowed upon about 300 people around the world. And I’m just part of that community and sharing what we have to offer for Java developers.

April: That’s awesome. Cause a lot of times when I’ve worked with job developers, they go, well, Microsoft doesn’t support Java and they’re wrong.

So I’m really excited for the series and all the cool stuff we’re going to do today. So I think in this first episode, we’re going to do some cool stuff with feature flags and some testing configuration. So why don’t you go ahead and take it off.

Brian: Sure. Thank you. It’s great to be here. And yeah, I’ll just get started into a demo.

So what I’m going to do, this is the first part of the series. I’m going to talk about what I have built for all of the demos that we’re going to use in the series [00:02:00] and how they’re actually built. So what you’re looking at right now is the Azure portal. For those of you who might not be familiar portal that azure.com is where you go.

If you haven’t yet. On Azure already. If you don’t have an account, you can get a free trial. But I organize my portal into dashboards and the dashboards themselves are organized by presentations that I do. And here’s some of the things that I work with when I’m doing demos and presentations for this particular series.

And I put this together just for the dev ops lab. This is a resource group here in this square. A resource group is a basic sort of lowest common denominator of. Items that you have you can group together and work with, and it’s also handy for billing but you have to have a resource group for everything you do.

And I asked her, so this is mine for DevOps. And this particular resource group had called dev ops for Java shops over here on the right. I’ve got some links. I’ll be using this. But the sample application, I just got to start at the, at the end, basically showing you the sample application we’re gonna use today.

It’s [00:03:00] written in Java, it’s a spring boot application and it has a couple of cool and unique features, which we’re going to talk about in this episode. Specifically I use feature flags enabled by this Azure service called app configuration and app configuration. This is our mascot. For our developer advocates here at Microsoft.

He’s his name was bit. And there he is. If I want to get rid of bit, I can go over here to. My app configuration. So this is my actual feature manager for this tool. And if I go down to my feature manager I’ve got this little thing here called beta, and I’ll explain what this is this second, but when I just able it up here, it says it’s updating the feature flag.

I’m going to go back to the app and every frame. A couple of times, there we go. So bit’s gone now. And what happens here is it’s just a silly little demo that I’ve created to turn on and off a bit. And the idea behind this is in the real world, if you’re using an [00:04:00] application, you can set up some code inside of your application that enables feature flags.

So bit is basically a feature flag that I’ve set up. And I can turn that on and off through app configuration. And by the way, I can have multiple different. Applications being controlled by this one app configuration feature flag. So when I turn it back on, sometimes it takes a second here, but there we go.

He’s back. So yeah. So the idea here is you can turn it on and off and you can have feature flags. You can also do some cool things for testing. If you want to do AB tests. And the dev ops world, or you want to do blue, green deployments. Those can be enabled through feature flags as well. You don’t have to manually turn things on and off.

So let me go in here and I’ll show you how that works. If I go in and I add a feature I can create a new feature flag and let me just zoom in a little bit more on that looks a little small. And the feature flag name can be a dev ops lab. And [00:05:00] in there. I actually can’t. I can put a label description and some of the filters I can do are kind of cool.

So I can enable a filter. I can target a specific geographical area, specific users or groups to see bit. So some of them will see bit someone. I can also set up a time window. So if I only want to have bits showing up this Saturday, I can turn that on and off this way as well. And it’ll automatically display when I set the time.

And when I don’t, there’s also one more. What you use for blue-green deployments and things. There’s a percentage and you can do a percentage here. Let me see if I do 50 and the percentage here, and then I can save this and what’s going to happen is and, and I could add another filter at the bottom here as well, so I can add a time window.

So only on Saturday, 50% of the people will see bit. Feature that we call AB testing. So we can do is you can watch the application itself and see what happens with that [00:06:00] application. It follow the user traffic and the user behavior to see if the new feature has the intended. Benefits or outcome or activity that you’re looking for.

So that’s why you do that. And then blue-green deployments can be done because you can change that percentage slowly from 50 to 60, 70, 80, and slowly deploy that out until everyone’s seen the new feature across all of your applications. And this works on. Most of the Azure services that we have, and it can also work on other services outside of Azure.

If you have something on prem or another cloud platform, all you need to do is link it through a. Through a connection string that you get as part of the service, and we’ll go into the connection string in future services as well. But that’s it, that’s all I wanted to show you today. We’re just introducing you to the application spring boot application, using feature flags, and it turns bit on and off.

It’s a, you’d probably want to do something a little more serious than that in [00:07:00] the real world, but it’s a good sort of graphical representation of what you could do with feature for. And I think feature

April: flags are a very critical component component to develop it, not just for Java shops, but anyone else writing code.

And they’re so heavily underutilized. So when we talk to shops about, you know, deploying something in a dev ops mindset, using a feature flag to turn something on and off, if it fails. Like you’ve done with bit, turn off the feature flag or turn it on so you can use it in your deployment, methodologies, your testing methodologies.

And then also how you’re, how you’re just deploying. And again, you set it to geographical regions for global companies. This is a perfect feature. So, so many ways we can manipulate feature flags and we need to encourage more developers to do it. So thank you, Brian. It’s a great feature and everyone stay tuned to the next episode.

We’ll we’ll, we’ll be back with dev ops for Java shops and Brian’s going to show some very cool. On the next episode.[00:08:00]


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

Author

April Yoho
Senior Developer Advocate

April is a senior developer advocate and DevOps practice lead for GitHub specializing in application transformation and DevOps ways of working. Her focus is working on Microsoft Azure to take customers of a journey from legacy technology, to serverless and containers, where code comes first, while enabling them to take full advantage of DevOps. April was previously a cloud consultant and solution architect for various partners in the UK and brings her years of experience in helping customers ...

More about author

0 comments

Discussion are closed.