Making the Right Decisions for Your Serverless Architecture (Google I/O'19)

Making the Right Decisions for Your Serverless Architecture (Google I/O'19)

Show Video

Hi. Thanks. Everyone for coming. I'd, also like to take a moment to. Thank. The back of the house they've been doing a wonderful job with this conference, and, round. Of applause for them. One, more group to quickly thank as you'll notice at the side over here we've got live transcriptions. Happening, that's, a person who's doing a great job and, trying to help make this event more inclusive, so, a quick one for them as well. And. I know this is the last session before the concert, you're all tired and we're excited for the concert so, uh. Well. Well. With that I'd like to first take. A moment to introduce my compete. RIA Myles Boren's he's. A developer advocate on, Google, cloud. He's. Also. A. Long-standing. Member of the node.js community. And in fact the director of the. Node.js technical. Steering committee. Fun, fact about him is the first time he used node was for an art installation so, he's also an artist. And a musician, it's. True um. Here. We have Noemi. Seifer, Naomi's. A senior software engineer on service, working, on cloud run how, many of you all in the audience have heard of cloud run before. By. The end of this presentation we'll, be all the hands and I'm excited about that. Naomi, is also working. On the K native client working group is the lead of that team you'll, hear a little bit more about that project as well as we get into the talk Naomi. Is a language polygon. Loves. Every single language but not necessarily, all of them equally um. Naomi. Back to you, so. This, talk is about service, what is even service, it's a buzz word that you may have been hearing it's, like hot, in the cloud compute, sphere. These days, so. Our. Conception. Of it is kind of a catch-all term it. Has a few components that, if a compute, product, meets. Them we, we, consider, it under the umbrella term observer list the first of those is that, you don't have to worry about infrastructure, management, you might hear me repeat this you don't have to worry about phrase, pretty often you, don't have to worry about his kind of the thena theme of serverless, so first you, don't have to worry about infrastructure, management no. VM provisioning, no. Metal, provisioning, no bare metal provisioning. Your. Scaling is going to be automatic. And. It, will scale up and down as. Your. Needs require. Another. Element. Of it is that your security is fully managed, you don't have to worry about some. Kernel, vulnerability. Or, or. For. A lot of the products, some, library, vulnerability. Happening, all of those are updated behind, the scenes so you don't have to worry about it and. You. Also don't have to worry about paying, for resources, that you're not using, the. Products, that we consider serverless, you, pay only for what you use you pay only for the CPU and memory and requests, that you're using and when. Nobody, is using the service it scales. Down to zero and you don't pay anything for that. So. In this talk we'll talk you through. The. Three server lists compute options, that Google Cloud has cloud. Functions, App Engine, and cloud run and when, you might want to use each of them because they each have their strengths and weaknesses. These. Options, lie along the spectrum of server list which is part, of kind, of a larger, spectrum of computation, where at one end you have you. Just write. A tiny bit of code and, you send it to a server and it runs it for you like, Google, Cloud functions, and on, the other end of that you have. Requisitioning. Blade. Servers, to go put in your data center but we won't talk about that because that's not serverless so. We'll talk about the spectrum of server, list compute, where, at, one end you have. More. Ease of use and at the other end you have more control though they're all with, good control and good ease of use. So. What, will be we build. So. What. We ended up collaborating on, is, a URL link shortening service it's, built entirely service, lis. An architecture, that will show you momentarily, but perhaps, the first thing that we should show you is. The product itself. So. I'm gonna come over here and. Get. On to the demo machine here. And. We're. Gonna go to min ki. Dot s H small. Knish and we. Could see the. Basic UI here this has been built with, material. For web we. Can click on the URL here and let's make a short link for We'll, submit that short link and. Get. This, minified. Link almost, right, away so, we can see that it has a, little. Sha here that we've generated and it, takes us to We. Could similarly go, here and create the short link and give it a specific short, link like goog. Submit. And wait and oh. We got a 409 that, the short link already exists, and goes somewhere else and, we got this really fun.

Cow. That's, giving us a little fortune as part of our 404. Page will. Similarly get errors if we try to go for, short links that don't exist or if, we try to go to routes, that don't exist with. The appropriate, errors and, get. Different fortunes, each, time, so, now if we move back to the presentation we, can talk a little bit more about. The architecture, that we're working with so. When, you come in you're going to be using a front-end, that's been built with Express and it's run on Google App Engine that's, routing all of the requests that are coming from the browser then. Depending, on the endpoint that you're hitting we're either creating, a short link or getting a short link and we're using a cloud, function, to make calls to the database there and for, any of the errors were actually hitting cloud run because we got some server list bash going but we'll show you that a bit later one. Of the things that I really love about this architecture is that, we've managed, to sandbox, the access. To the database, from, the front-end application, through. Iam roles we can even limit the access to the database altogether, so that it's only the function service accounts that can call it and. We're also making sure that we're sanitizing, the data before it ever gets to the database so, there's no way from that front-end. To directly access the database. At all now, the, first product that we want to dig into a little bit more is cloud functions, not, only would you like to tell us a little bit more about it so, any cloud functions, you write code to do one thing, you. Don't have to worry about your request plumbing, that's that's, handled, by the. Cloud functions, framework for you and. Your. Dependencies. Are resolved, in the clouds you don't worry about dependency, management you, don't worry about request plumbing, and you can save your functions up to trigger by, a variety of things so, you can set them up to trigger by someone. Creating, an object in a storage bucket you can set them up to, trigger by someone. Publishing, something to a cloud pub/sub topic. Or, by HTTP. Request from the outside we or from your, cloud which is what we've done here and you've. Got no worries about concurrency, you, only have one thread of execution in, your cloud function at once so it's really the. Easiest, to use of, our server. List compute environments. At. The same time in, cloud functions your language selection is a little bit more limited we've only got node Python, and go for that right now and. You. Have to code in, a way that's specifically, intended, for cloud functions, so if you've got a larger. Expressed, @j s or django web app that, you. Want to, bring. Into server lists, cloud, functions, might not be your choice for that that would need serious refactoring, to work in cloud functions. And. The, flipside of not worrying about concurrency, is you don't have access to concurrency, you. Can't say you, know give me a hundred requests that run at once I can run a hundred threads. You're. Limited. To one request. At once per instance. So. Miles will walk you through some, of the cloud functions we've got so. The, first function that we created was create, short link this, is the function that we're gonna call to make, new short links or alternatively, fail, if it doesn't work it takes, a URL and a, short link as a parameter and it. Stores it in the database the. Next function that we created. Was. Get. Short link and that takes, a URL as a parameter and then, it it, takes a short link as a parameter and then it gives you back, the URL, itself that you're supposed to go to so. Let's. Take a look at this turtle here and what they're asking us to do it's telling us to go to the demo and I, always listen to what turtles tell me to do so. Here. We're in the cloud console again and this is the landing page for functions we've. Got the create short, link function and the get URL short, the get URL function, let's. Dig into the create URL function and see what's going on here the first thing that we'll notice is we. Got some really great insight into the usage we, can see the most recent invocation. That was the demo that I just showed you earlier we. Could see the usage over the last 30 days and we can see the, day that I sent this, service to all my friends to, try to break it before I used it onstage we, also get access to a couple other things we have the trigger itself right here so we can click this link and you, could see we, get an error because we haven't sent the right request, we. Can see the source code as well by, clicking on source. If. We look at index J s here we.

Can See there's a couple helper, functions that we've made for interacting, with the database and here, you can see the. General. Way in which we create functions, I'm giving. I'm, exporting, the function with the name of what, my service will be called and that. Export. Is an asynchronous function, this will allow me to use the await keyword, I don't know how many people here are familiar with Java Script and async await oh. Very. Cool I think, it's like made the language infinitely. Better to work with and. A really cool thing with cloud functions as you can it export async functions which, makes, it far simpler to start doing some asynchronous stuff you. Get a request in a response for an HTTP, function and it's. More. Or less the exact same contract, as an Express app if you're used to using Express so. Here we have a couple different things that we're doing to. Make sure that we've gotten a good request and sending. Proper warnings when we haven't and. Then when. We actually make the call to the database here we, can send, the right information if the result was successful, and warned if it wasn't now, we, also in the function's thing here have the ability of testing. The, function itself so. We, can go ahead and give. The long link. To., and, try to test. That function and see what happens and it, gave us back a warning. That we should also include the short link so, let's do that right, now and we'll give it the short link Google. We. Could test the function and it successfully, returned the short link which means that the service worked so, if we go back really quickly to get URL, and. We can jump right to testing, it we, can call get. URL with. The, short link. Google. We. Could test the function and we, can see that we got back the, URL that we created one, of the things you will notice with this service is that, we're not baking, in any of the host names so, it's really cool about this is this. Service, can sit on top of n number of different URLs in the database could even transfer around for. Other services. So. That's what to show right now for the functions if we go back to the slide deck we're, gonna look at the next technology that we used which was App Engine which we used for the front end and Niomi. Will walk us through a little bit about App Engine and why you might want to use that specific, product. Where. As functions, was, one, operation and you're done you just do. One function. Return, the response, to that and done. In App Engine you write a service, that can deal with a variety of paths and can do a variety of related. Operations. You. Still have a lot of the benefits of functions, like. The. Automatic. Security. Patching. Of libraries, the libraries are, still resolved, in the cloud. But. You have a few. More language. Runtimes, available, we have Java Python go PHP, and node. And. You can bring your own web. Application, framework or mobile backend application framework, if you want to write in Django you can write in Django flask. You can write in flask can you tell that I'm a Python person rather than a node person, mostly. And. You. Can have the idiomatic. Language. To what you're used to sue, write the. Code, that you're used to using deploying. To any other kind of situation, you, write that you, send it up to your right you write that you send the code up to us in the cloud we. Resolve, the dependencies, for you in a language idiomatic, way and. We. Make your code run and we scale it automatically. And do the server list thing for you in all, the ways that I described server list before. Miles. Will describe the, front-end that we wrote in. App Engine so. We have a couple different routes that were handling in App Engine with. The Express app that we built the, first route is just slash, it's what happens at the root and for, that we serve a form, for a new short link the.

Next Route that we have is a post to slash link, this. Is the endpoint that we post to to create new short links that will then proxy, that request to the cloud function, that I was showing earlier finally. We, have a post to. Get. Short, link this, is very similar to just get, on the root except we, catch. Any other words that are there to be used as a parameter, for figuring out hey what's short link are we asking for and then, we serve the appropriate, redirect, for the browser. So. I think, the turtle is telling us it's time to, show. Off a demo again so. Here, we're in the App Engine console and if you were trying to figure out how to get it if you click the navigation menu here you can see that we've pinned it but, if you just were to scroll, down on the products page to compute it's right in there and you can click. On App, Engine and then click on dashboard to get to the page that I'm on right now, we. Can see the. Requests that have come through you. Know and take, a look at them we can see, services. We, have one default service that's deployed right now but you can deploy multiple services, multiple. Independent. App Engine, instances, all on the same project, you're not limited to one we. Have various versions, these. Are all the different versions that we've deployed of this application, as you can see we've made some changes over time one, of the things that I really love about this is the traffic allocation. Bit that you can see here it makes, it really, intuitive and straightforward, with a couple clicks to, split traffic, a couple, across, a couple different instances, one. Time where I find this extremely useful, is hey, we've made a small change and we're not a hundred percent whether or not this is going to break some people you, can do, a new version not, automatically, deploy its production, and just, read about maybe ten percent or five percent of traffic to that service you can, even run that service with special, headers in the logger so it's easier to see exactly what's going on and progressively. Roll out that service over time instead, of just transitioning, all the traffic at once, you'll. Be, able to see there's a handful of other things in the menu here we're not going to dig too much into those right now but. I would say the cron jobs are also one of my favorite things and cloud. Scheduler, is another product you can look into but. Let's take a look at the code, that. We're using here in. Our front-end service, here we, have, you. Know it's a package.json it's, a. Idiomatic. Nodejs app we have a handful of different dependencies not, many dead dependencies, the, one main thing that you definitely need when you're doing things with App Engine is the app dot yamo file this. Runtime, line right here is actually the only thing that you need to include to get something deployed and we're, saying you know which runtime we're using these, handlers that you see below here what are we're using to specify, the, static content so, during the deployment everything, that's in slash, stylesheets in slash scripts, and slash, star, are going to be cached by a CDN, at the edge we.

Know That all these assets are static so by creating these handlers App Engine smartly knows how to how to cache, that and then, we have app dot j/s here which is the main entry point into our application, we've. Got a little bit of song-and-dance, here, and the code is available online we'll give you a link at the end of the presentation, but, the two biggest things to check out here are these. Two bits. Right here and this is idiomatic. Express for saying hey here, are particularly, hit. Those routes let's, use these particular middlewares. And you'll, notice that we have two different routes that we're doing one, being the index route that's handling both the case of hitting, slash. As well as hitting any of the parameters, and then, link which is the endpoint that we're posting to to. Create a new link, so. One of the things that I wanted to show really quickly. Is how, we can quickly update and redeploy the application, so we're, in the front end app now if we go here in the front end and we take a look at our view and. We have indexed pub here and you can see that this. Is where we get that header. For, URL shortener and let's just change that to hello. IO and, we're gonna save that we're, gonna see, the get status, we can see the diff by, the way what we're using, right now is called, the cloud shell and we're, also using the cloud editor this is all built right into Google cloud we're. Changing. This all live on the stage with a Chromebook, you can do this on the road with pretty much anything that has a keyboard and a browser and. If you're in cloud, source repositories. Which is where I was showing this for it allows, you to push git repositories, right, to cloud you can literally click this button right here edit code and that's, gonna open up this cloud shell environment, that you see me working in so. We've now changed hello, IO and we're, gonna run g-cloud, app, deploy. And. It's. Going to say. Hey you sure you want to do this I'm pretty sure I want to do and, no. Such component. Oh, I. Know what's going on here we, need to just npm install really, quickly. Thank. You for being patient with me this, is what happens when, you try to do things on stage live how, many people have done live demos before, okay. Hold. On keep your hands up for a second lower. Your hand if you've ever had a live demo not blow up in your face. So. We're almost done here we're. Just about done I'm, doing a really good job of stalling and, now. We'll g-cloud, app deploy. They'll, say yes. The. Reason why that happened is because I'm doing some fancy thing with symbolic links, I, should have learnt the lesson about symbolic, links at some time in the past but I didn't so. Let's. Just go back I want to show you one more thing in app engine well that's deploying that I didn't show you here, in the settings you'll notice when we were on the site that we're at min, knish, not, at like an app engine specific, site, app. Engine supports custom domains, so, you'll notice here that I've created a custom domain it. Gives me all the rules to set up I just put that into my DNS settings and now, that domain will always forward to the App Engine instance App Engine, will also provision, all the SSL certificates, for you so. As you noticed we were doing everything at HTTPS and I believe if I just go to HTTP you. Can see my muscle memory won't even let me go to non secure. It. Automatically, upgrades, the traffic for you as well. So I really highly suggest. Just. Using that right off the bat so, we go back to the cloud shell it's already I've been talking long enough that it works and. If we refresh now it says hello IO, so. Not, the most exciting change, that we're doing live but I didn't want to change too much but, you can get a little bit of an idea now about the end-to-end workflow, of working with App Engine, and, you could take any idiomatic, framework that you want to work with if you're more into happy or into. FASTA Phi or just you know writing something, by hand with net you. Can deploy anything, that's idiomatic, node, with.

App Engine so. If we head back to the. Deck right now we. Had one last service that we haven't talked about yet which, is the one that I'm most excited about which, is cloud run the product that I only helped build sooner. I made you want to tell us a little bit more about what cloud run is sure, cloud, run. Anywhere, as an app engine you write with, your favorite framework, in cloud run you can include arbitrary, software cloud run is our service container runtime, so. With containers, these are these are just your normal docker containers, for people who are familiar with that you can use any language any. Libraries. You want any, binaries. You want if you, have software that comes prepackaged, as a binary and, you can use the whole ecosystem, of docker base images, that. Already exists, in places like docker hub so you. Can have an Ubuntu, base image, or, or. Even, a node.js base. Image, and, docker. Containers, have become the industry standard for, software. Transmission. Basically. Each, docker container. It contains, all that's necessary for the software on it to pretend it's running in its own computer, though, it's not actually that's all operating. System fakery that. Gives it that impression it's, much faster than provisioning, a VM. So. The product we have for our container runtime, is cloud run container. To production in seconds, while still being server, list without and having to provision, anything, or, anything like that it. Scales up fast and down to zero when you're not using it. And. You. Pay for the exact usage, that you're you're, using so. We actually have two versions of cloud run cloud, run fully managed, is the. One that we, mostly. Talk about but, there's also cloud run on gke cloud. Run fully managed Google, is your ops team Google. Does all the management of scaling, up and down for you it, uses our proprietary, back-end, and cloud. Ronan gke is, an, alternative, form of cloud run that has the exact same developer. Experience, you, still use the same commands to deploy it feels the same to deploy it, still scales up fast and down to zero but. It's actually, running on a gke cluster, that you, or your company manage, so you if you have an ops. Team that, demands that they have full control over wherever. Your stuff is running or or a platform, team that demands full control, they. Can provision a cloud run on gke cluster, you. You, your, organization, pays for the cluster and. Then. You. Have the same developer experience. For cloud run and it still feels serverless, to the developers. In your organization. Any. Cloud run fully managed you. Pay exactly, per use at the, hundred millisecond, time scale so, per. Seat you rent CPU, you, rent memory and your rent request. Handling, and. Then. In cloud. Run on gke, you. Can do basically. The same thing, from the perspective of, a, development. Team within an organization. You, can use the gke usage, metering, feature. So that the development, team can get billed by the operations. Team in this, same serverless, way. So. When, we're talking about deploying, and building for cloud run, there's, a couple different ways to do it the base is that you have a docker image and that docker image is on GC R which is Google Cloud repository. That's the right name right Nayomi. Google. Container container, repository, I knew I was wrong that's why I asked. So, with cloud build. You. Can create, those images, automatically. Based on git repos you can also do it yourself with docker build, locally, and push upstream, and you can also do that within your own CI CD infrastructure, as long, as the image is on GC our Google, container registry you'll, be able to deploy it with cloud run and, you.

May Have been asking what is a container registry a container. Registry is a place to store container, images publicly. Or privately, it. Works, via using the docker push and pull command for, GC are you pay only for the storage so when you push a container, you can kind of think of that container like a series of tarballs, you're storing that inside of a bucket you're only getting billed for the on disk, space that you're taking up, one. Of the great things that we do offer as well when you push containers, through our container registry is that. You get, container vulnerability, scanning so, we had mentioned before that for like App Engine, and for, cloud functions, because. Everything. From the platform. Such as nodejs, or Ruby down is managed by Google if there's, new versions of node or new versions of the operating system, or patches, that need to be applied to system libraries, we do that all for you under the hood and the next time we spin up your containers, they just have those updates automatically. You still need to manage your own dependencies, within your application, but when you're deploying containers. You've, contained, everything everything, is in there and you're maintaining that yourself, so you're responsible for making sure that all that stuff is secure. That's part of the the spectrum, that Naomi, was talking about earlier you have more control but that comes with more responsibility, but we, still got your kernel we still we still got your kernel and in in, cloud run but. Your libraries, you. Rely. On the vulnerable, a scanner and the, vulnerability, scanner will let you know if your images that you have in GCR have, any vulnerabilities. In them I'm personally a big fan of that. Technology, so. When, you want to go to deploy, this. Is the command that you would run and you. Start with, the registry, and. You. G-cloud, betta, run deploy, because the thing is still in beta image. And then the link to the registry cloud. Run takes that container registry image, deploys, it and gives you a URL that, you can then visit. To. See your service in production, and similarly. To App Engine you can also set up custom domains and those, custom domains will have manage SSL for you, so. Your whole deployment, can just be g-cloud betta, run deploy, and if any of you have any experience, with cloud build it's, fairly intuitive, to set that up to be automated, based on pushes to a git repo or, all sorts of other triggers, that can set this off to. Automate, a continuous, deployment for, you. Cloud. Run is based on K native, which. Is a. Common, API and, runtime. Environment, for serverless containers, so. One, of the wonderful, things about cloud run is if. You obey, the, contract, for what a container should and shouldn't do, you. Can port, that container, to. Anywhere, that runs k native. Now. You you, might have to like dig yourself access holes to any other. Google. Cloud, services. That. You use but. If you follow the container contract, it should be reasonably, portable, between. K. Native deployments, so cloud run is a kind of K native deployment. Cloud. Run on GK e and K native is actually, open source software, so, you can take. K native and, install. It on a kubernetes, cluster of, your choice the reference. Implementation is, based on kubernetes, or go. To another k. Native, cloud. Provider, and take, your same container and put it there so. You might have heard about problems. With lock-in, and locking into one Clow Fahd, run is what you might want to choose if you want to run a multi cloud deployment. Or, not. Have to worry about lock-in, you, can actually take, your container. And leave Google with it and get a very similar environment not. Only the runtime environment, but, also the deployment, workflow is is, both the same it uses the same API and, the. Same runtime environment. The. Container runtime contract, that I've mentioned has a few things in it I'm just, gonna give some highlights. This. Is the key native container runtime contract, the first thing is you. Need to make your container. Have a stateless, service, in it so, if you need a database, you need to put that out of your container and connect to it if you, need access. To files you need to put them in some kind of cloud bucket. Google. Cloud Storage is one of the possibilities there, but, basically anywhere. On the, cloud that you can store your files. I only, just a quick question for you statelessness. Isn't that something we need to worry about all the time and server lists it is something you need to worry about all the time in service both functions, and App Engine do, require statelessness, in their operation.

The. Next thing is whatever, your container is it. Needs to listen for HTTP, requests, on dollar-sign port that's how stuff gets in and the response is how stuff gets out. If. You. Like. A little a little thing, is in. Cloud run mostly that's the same port all the time but. If you want to be able to be porting, from cloud, run to other cañedo, installations. You, want to listen on dollar side port because they might set that to something else, and. Another. Thing that you have to worry about is. Not. Using, CPU, outside, of requests, you're only guaranteed, to get access to the CPU while, you're answering requests. The, system reserves the right to scale you down at any time when you're not answering a request. There's. Like a few, other things about like handling, signals, and things like that and that's. Documented. With key native and with cloud run you can look that up on our documentation. So. In our container anything, unix goes. So. We decided to just use a few old-school UNIX programs and write as a server, list bash program for. Handling. Our 404s, so, we we use the UNIX program fortune to. Pipe. It to the UNIX program cows a and serve, the results, with the UNIX program netcat, and it's n cat variety, high. Net cat. All. Right let's see it. So. Over here we're in the cloud. Run dashboard. And we have one service called fortune-telling, cow. And. I'm gonna click, on that to take a peek at it. And. It has a lot of revisions, and very similar to the App Engine world you can you. Can, see. All your revisions, you can manipulate them, you, can even go to the yamo view and see the kubernetes style yeah mol that you have that. Has to do with the K native API and you can get all the details there. So. I'm, going to go over to the cloud, shell and show. How a workflow, might work here and how our app works. Here's. Our repository. Here with. Our served SH and. I'm. Going to increase. The size of this window briefly. And. You can see that the served Sh. Sets a port if they if it, isn't provided. But. We're going to connect to the port environment, variable, we traps against to. Kill. Things and then. What. We do is we start the program n cat tell. It to listen and keep. Listening for more connections, even after the first one on the port. Dollar sign port see also the container contract, and then, whenever it gets a connection exact the following things echo. HD, beginning. Of an HTTP, response give. It a content type header of, plain text and then, pipe the result of fortune two to cow say. And. So. Let's, look at what happens when. When, I run. That to run that what I need to do is I need to do a docker build. And. And I'm going to give it a. Tag. Of the of the image environment, variable. Right. Dot love, oh. I. Need. To be in the right directory before I do that and I, give it I. Give. It the image environment, variable and I'll as, soon as soon as this finishes, I'm, going to give I'm. Going to show you what's in the image environment. Variable it's not complicated. It's. Just where I'm going to put this thing on on. GCR. Okay. So now I I want to do, docker. Run. -. - RM to finish. When I'm done - - I T so, it's interactive. And gets the terminal. And. -. P and then I want to map port 8080 - 8080. And. So. This is just how, you might run an image and now, we can see over in the cloud shell we can preview this on port 8080 to. See what's going on here and we have our wonderful fortune-telling. Cow. Kill. That window, control. C control C, out of this business. Alright, so, in our cloud run workflow, I might, want to change, this let's say I don't want a turtle to say this I want a different or I want to don't want a cow to say this I want a different kind of of.

Cow. Which is turtle. In. Terms of cows a turtle is a kind of cow who knew. And. I, want to save this file and now. I want to do another docker build. That. Happens very fast because I'm only changing the one layer of this. Docker file that I that. I have here, by the way let's take a brief, look at the docker file all, this, docker file says it's it's based on Alpine Linux we. Want to install the. Few programs that we use here's. The installation of N the, installation of fortune we, have a more complicated installation, of, cows a because we're installing it from a git repository, copy. Every, file from this directory, into the image. Build, a set, of wholesome fortunes because we don't want to demo unwholesome, fortunes for you. Set. Up and set, up our path environment variable and, set, the command to be this served Sh that we that, we viewed fun. Story it was originally called server but. I only noticed that we wouldn't be serverless if we, call this server Sh, so, it's just sir there, is no server involved. So. Now that we've know, that we've built that docker container. We. Can push it to GC our. Docker. Pushed dollar sign image so. That pushes although, all of those layers that we've created one. Of them already exists, probably, the base image and. As. Soon as we get our prompt. Back we. Can do. G. Cloud beta. Run. Deploy. And. The. Name. Of our service is fortune. -. Telling. -. Cow and, -. - image, and. Our. Image. Cool. Let's. Deploy that to, our cloud. Run service and you, see it tells you it tells you what it's doing well it's deploying. I'm. Actually in charge of the command line so I'm like proud of all this interactiveness. It. Health checks it before it migrates any traffic to it so if as, soon as you send any request to your thing it crashes, it won't migrate any traffic it will let you know that there's an error cool. It's deployed and is serving traffic so. We can go. And check out, this. URL. Fortune-telling. Cow, oh. Dear. Did, I misspell turtle. I'm. Sorry - F turtle. Now. I need two docker build and deploy very, quickly I. Think. This is a really great example though, of how quick, this workflow is and for. Those of you have experience, with GCF, vs. app engine it takes a little bit more time because all of its infrastructure, is all being managed by us at once but. Just in the time that it took me to, stall and talk to you all. We're almost done deploying, this whole service, upgrading. All the traffic, and rerouting. It I think, it's probably going to only be about another 10 or the. Healthcheck we're routing traffic assigning. Traffic to the latest ready revision. And. We're done and we're.

Done And you should be able to. Hit. Refresh on this. Instance. Turtle. Stay. With me turtle. I'm. Sorry we, have a turtle turtle yeah we have a turtle. And. And. Now. If we go in and in. Our in. Our micro, services based app hit something that we don't know, we. Can see that. We have a turtle instead of a cow that mile instead of the cow that miles showed you before. Now. If we can go back to the slides so. We've, gone through a handful, of different service, offerings that we have at Google we. Primarily focused, on our computer, frames which are the ones in the center so I was cloud functions, App Engine, and cloud. Run which, is you know the, new exciting. Technology. That we've got we, also showed some other technologies, that you may not have the mental model of thinking about is service selection as cloud sequel, which is being managed by us and can scale to zero now, there's other database, technologies, that we have that we consider server list there's messaging, services, such as bub sub DevOps. Services, such as cloud scheduler, that I was mentioning before which is basically managed, cron so, if there's anything that you ever wanted to do that's based on a timing it, just thinks is so easy to do we, made sure machine, learning API is as well as well, as stuff around. And, chat. But. You can build large, services. With all of those a really, quick summary though. Functions. Do. One thing apps. Do. Many things run. Do, anything and thank. You so much I'm Myles this is Naomi, if. You take a look at, the. Next slide you, can see mndot, knish slash source is a short. Link that will take you to the git repo for the project also check out. Comm. Slash serverless. You. Know we're on Twitter and email and all those things grabbed, us afterwards if you have questions thank, you all so much for sticking around so late.

2019-05-11 20:44

Show Video


How can I make my cloud function accessible only from my app?


Why the weak attendance? It's not the content; there's a gap that needs a bridge.

Other news