 Hi, I'm Ashley McNamara, a CDA. And I am Josh Gavant, Program Manager. And welcome to Microsoft Connect. Today we are going to do some fun stuff with Go. And to start off, Josh is going to talk us through a couple of slides and then we have a demo for you. Yes. We are going to deploy an API server backed by one of Azure's databases, Cosmos DB. Awesome. Cool. Actually, I was thinking we're going to use Athens, which is the modules proxy for this demo as an example of an app that you could deploy. That's very cool because that actually started here at Microsoft, yes? Yeah. Yeah. A lot of our developers have been working on that. Super cool. All right, so let's start. We have a couple of slides, so let's get through those and then we'll get off to the demo. Yeah. I was thinking it would help to kind of let people know how Athens works a little bit. Yeah. And then we'll dive into a couple examples. So Athens is a modules proxy, which basically means it goes and does your go get for you, pulls the code down from the repo, then caches it into some backend storage, could be disk, could be memory, could be Mongo. And then the next time you go and ask for that module, instead of it having to go out and get it fresh, it gets it from the cache. It's a caching proxy. Awesome. It also, of course, that API, I guess, well, what's special about it then is the API is unique. It's the protocol that was defined in the Vigo specs and stuff. Yeah. So it's pretty straightforward. It is pretty straightforward. And so we're going to deploy a couple of things now and you're going to walk through a couple of steps, yes? Yeah. We're not going to do the whole thing, but we have it running on Azure. We can show that. But here's the architecture that we have now and we'll show some bits about how that looks, how that works, some cool things you can do. So let's just talk about it like each one of these. We've got the proxy API server. How are we going to run that? So it's basically, it can be containerized. It's a single container. So there's a few options in Azure for running single containers. We're going to run this on Azure App Service, web apps. Got it. So we're basically going to tell the web app, hey, pull the container from here, run it for me and that's great. Yes. We're going to use for that container registry to store the container and any time the container registry gets updated, it will notify the app service to reload the app. Perfect. So that's kind of what these two represent. Down here for the proxy cache, Cosmos DB actually offers a Mongo API head. So we're just going to use Cosmos with that Mongo head. That's what this other bottom one here is. Then we can also send off metrics and telemetry that Athens collects to Azure App Insights. Awesome. All right. Demo time. Yeah. So I'm going to pop open VS Code first. Let's see if I can get over there. What you're looking at is I've cloned in the GoMods Athens repo. Like I said, I've already deployed this all to make sure the demo gods shined on us. I'm using here the app service extension in VS Code, which is really nice if you're working on the code locally and you want a quick view into the app. Actually, one of the best parts is this right-click here. The portal is good for viewing metrics or even just to see if my site is working and it is. Another cool thing, it wasn't about 10 minutes ago. Another cool, so I'll go ahead and just use the protocol that's been defined to retrieve a module there and you see it gets metadata about the module. Yeah. I wanted to show a couple of things we can do with that web app now that we have it up and running. One thing that's cool is the az web app log tail command, which lets me, we actually have this log streaming service, which is behind every app that runs an app service, and you can connect to it in a couple of different ways. This is one of them. I say log tail, I could make this a little bigger I think. I'll say name, that's a trick, I always end up forgetting to do this, but it's best for the name of your resource, JoshGab Athens package. Look at that, tab completion. Resource group is Athens, and now I will see streaming logs, it will, I think it concatenates the logs from spinning up the Docker container and the actual logs from within the Docker container, but that's enough for me. At least it's telling me what's happening. So we see we started the application, you saw where I did that get. Actually, let's do something fun while we're watching. Let's go ahead and go back to there. We will go proxy equals, hope this doesn't take too long. JoshGabAthensPackage.AzureWebsites.net, and then I could say, actually I need to CD into the folder, source Azure Athens, and then I could say, go get and it actually is going to use my proxy. What you'll see, unrecognized import path, github.com. So I did something slightly wrong there, but you see that I got it through. That is go get using this proxy, and that is web app log tail, we can see the logs coming out there. Let's show some more cool things that you can do here. Actually, the way I set this all up to begin with is azacr build. This lets me point at a repo, like the gomods repo and have it build the application right away. So I cloned this down here. We mentioned here's the Athens code here, app.go and the work that it does here to actually handle the incoming requests. But in here, there's a Dockerfile. So I can actually do azacr build, point it at that Dockerfile, CMD proxy Dockerfile. I can point it at that repo where this came from, gomods Athens. I can tell it, hey, put this in my repo as Athens. Is there anything else I'm forgetting? I do a dash, dash, tab, tab. No, that's it. If I hit enter here, it will actually kick off a build. I forgot the registry. I knew I was forgetting something. Registry is Athens package, and this will kick off a build in the background. So this actually just, yeah, in the background Azure container registry has this runner and it went and get cloned it down from that repo and is running the Dockerfile and we'll put it into my registry. If anything changes, it will push it up onto my site, which we just learned a few minutes ago that that can be risky because people did make some changes today. Yeah. So let's see. We used azacr build to pull a repo, to pull the Athens repo and build it, there we go, and build it and push it into our registry. We use web app log tail to make sure everything's going okay. We still see that running over there. That's nice to have it still going. Yeah. That's the main work. Let's see. Was there anything else that we should show on that? Yeah. Actually, let me show you within the portal how this stuff comes out. So I actually deployed that container, like I could come in here and make sure I've set everything up correctly. You see it's zoom in because it's a little hard to see there. But you can see that I've set up to point to an Azure container registry. I've set up continuous deployment, which is a nice thing that you can do with the command line. You could do it here in the portal and that sets up a webhook. So anytime that gets updated it pings this and you got the logs in here. All my application settings I did through the command line also, I use just dash dash settings and I pass up all these things. The Mongo URL, the Mongo Connection String and the Docker registry passwords and things. Yeah. Very cool. We only had a couple of minutes, but if you would like to see more, we have a couple of resources for you. We have a Slack channel. The Slack channel is really great. There's lots of information in there. There are a couple of channels that you should join for feedback, and then we have some videos and some code samples. Please check them out. Email us, tweet us if you have any questions and enjoy the rest of Connect.