 and welcome to another Dead Mission Live. As you can see in our chat right now, we have people from all over the planet and that makes me very excited. I'm always happy to see so many people coming in from India and South America and Europe and of course North America here in the United States where we are even up in Canada. So welcome to all of you here. We actually have a bunch of great content to talk about today. We're going to be showing you more about the serverless capability that we actually started just two weeks ago. Just hopefully you know that you're getting this Dead Mission Live content about twice a month. You'll get an email from me that basically talks about what's coming next, but just keep looking for us to keep coming out about twice a month with these great shows. Today we have Kamesh Sampath. He's coming to us from India also and he's going to be walking us into the next layer of serverless architecture with the Kubernetes and OpenShift capability that you guys hopefully know and love. And of course how does a Java developer engage some of this content? How do they build their first serverless functions? So Kamesh we're ready for you. Go ahead and take it away. Thank you so much for hello everyone. So I'm really going to share my screen for you guys. So just quickly get started and it's going to be more of a demo than slides from my side. So here we go. So I guess you guys are seeing my screen now. So just a quick start of window like I'm just showing you a couple of things. So the first two things you see on my screen are those tutorials which you can learn by yourself. And the last one is the link, the big link is for the slide deck that I'm going to run through you today. So my slides are not going to be really fast. I'm just going to hit only a few content and then I'm just going to quickly jump into demos, show things how it works actually for us. And just a quick intro about myself. This is what I am. I think you can pick up from my slides and then I have an active contributor to OpenBisk and Eclipse Chain Fabricate platform and paid-up vertex band plugin. And I work with Burr as part of the team and as a director of developer experience at Red Hat. And I'm really happy to see you and meet you developers and talk to you guys today. Just quickly about serverless quick, very short definition from CNCF. So what serverless is all about just quickly a couple of words saying that you do not require server management. This doesn't mean that I don't have my servers running all the time for me. It's all based on demand. And another one is like, I just need to write what I need to do just a small function and just get deployed onto your application server. And quickly on to the serverless cloud-related landscape. This is what CNCF right now defines and we have three big players here. You could see OpenBisk, you could see AWS, you could see Azure and then there are a bunch of frameworks like Spring Cloud Functions and AWS has as well as serverless. And then you should keep getting across all these frameworks, platform and other staff and each and every day when you start doing it serverless. And I'm just going to leave that to you. And today we are going to see how we have OpenBisk and how to play with OpenBisk on Kubernetes or OpenChift. So why do we need to do serverless? This is an interesting thing. I just got this data a couple of weeks back saying that why do I need serverless? The serverless gives you automatic scalability cost reduction because I don't have need to be running it every time. And then it gives you a better quicker and easier development because I'm just going to develop only my function, which is my business logic for the entire other thing, which might not be mostly needed by the developers. And then it increases your developer agility. We'll see how quickly we develop functions, how quickly we change. But still it's a measuring technology. So we might have a side effects as of now because still tools are measuring on that side. So it's a pretty bugging, it's getting hard. And then deployment and architectural capability, I think Bird covered a very nice session on how do we complement microservices with serverless in the last fortnight? And then I think this gives you a better picture on saying like whether I need to go with serverless or I need to go with I mean microservices. So it's always complements each other. And there is no vendor locking it's typically with respect to OpenVisk. I'll talk about it in a couple of minutes now. And then it doesn't have any kind of monitoring right now. So right now the big players are Lambda, AWS, Lambda and Azure Functions. And IBM Functions is coming catching up with things. And then we, as part of Red Pack, we're doing the top of Apache OpenVisk and then getting it deployed on I mean, that open chip platform to give you a fully functional function as a service platform. All right. So why do we go OpenVisk? Just to pick into about OpenVisk is still an open source product incubating under Apache. And then it gives you a bunch of functional language that I can write JavaScript, Swift, Java, Python, PHP, Docker and Go. All I need is that I just need to have a platform where I can Docker could be run. And then right now we are going to see how I'm going to deploy that on Kubernetes and OpenShift. And we already have something running on it. I'll show you how it looks when it's actually deployed on OpenShift. And quickly, a very quick intro about some of the theory which we'll come across. I'll be using them and I'm doing my demo. I'll be talking to you about, I'll be saying that I'm deploying an action. So action on nothing but is a core entity of any serverless platform which gives you a stateless code snippet written in any functional language. Just talk about JavaScript, Java or Python, Go or anything you do. And that gets executed. So what is, what's the next one is a package. You can just, it's a kind of logical grouping of functions. And then where we set some parameters, default parameters and make the application functions pick up from the default parameters as well. Okay. Quickly on feeds. This is a very interesting part of any serverless programming language feed. It gives you an interface between event sources and an open disk action which basically like this triggers. For example, I have a message broker putting a message in a queue and then your function is picking up there when executing that. So if we have time and today, like I would love to show you that demo where I have a function over messaging. So it's typically simulating an ESP kind of a scenario for you. And then triggers, triggers are nothing but the action, the signals of external level. Let's say I drop a message, what should not happen or which trigger needs to be triggered, right? So that's what this trigger is all about. And then if you've got rules, I need to have something which ties my trigger to an action, right? Which action needs to be involved with this trigger is called. So that's what rule does basically. And finally, we have activation. Activation is nothing but the records of output response of running action because mostly open disk actions or serverless action are asynchronous. So what I basically need to do is like I need to know what happened to my action. If the action failed, I need to see the structure. This is my action trend. What's the output of my action? So all these things has to be seen later part of time for auditing on any kind of purpose. That's what activation basically do. So we'll see about that as a lesson in the demo. I'll just show you how this do. These are the tools that's right now available for us on the tooling side of OpenWisp. The first one is WSK, which is called as OpenWisp CLI. So this is what we'll be using mostly in today's demo and the rest of the other one. Then you also have a main archetype which is to generate Java actions. So since I'm a Java guy, I'll be showing you most of my actions on Java. So we'll show you how this app tells you to create an actions on thing. And then there are a couple of other things like this deploy, which is again a tool from Apache OpenWisp and there's a serverless framework, which is again a third party framework, not part of Apache umbrella, but you could use that as well to build cross-function which can be deployed across AWS as your OpenWisp and any kind of platform. Quickly, the invocation patterns. I just want to really quickly cover these are three basic invocation patterns for any serverless architecture to be so one is asynchronous just by default. So all functions are asynchronous. We trigger it and then if I get it and it keeps running and we go back and check with using your activation log. And synchronous, I can still make my function work synchronously. So you see one example of web action where I can have an HTTP wallet to invoke the functions. For some time, we might need to use it synchronously. So that's where synchronous function comes into picture. And the third one is getting something similar to your current job so I can have some function executed at this point of the time, at this point of the day kind of stuff. Fantastic. So this is our OpenWisp is architected. The OpenWisp can have an engineering controller. As we see all these components, it's all back and containers which is running inside Kubernetes on any kind of a platform which you have. So engineering is right in the entry point. I'll show you that every call that I make even using the best CLI tool is always going to be just called back to back end. And control as the name states is this the control which controls the impact stuff within the OpenWisp architecture. And then we have CouchDB which is used for persistence. An audit authorization, your parameters, your function details and all those stuff are stored in CouchDB and every time a function is invoked, the data is retrieved from the CouchDB, checks for the authorization details before it actually gets executed. And Kafka. Kafka has basically helped you use to kind of route the messages because at no given point of time the same function cannot be executed in parallel in OpenWisp. That's how OpenWisp is architected. So the Kafka use helps you do the ordering of the messages so that the message flows in a sequence before it's getting executed. And each of these boxes you see down below, these two are the OpenWisp nodes. I mean, where the OpenWisp is deployed. And we always have one invoker. It's a talk of container running. The invoker knows which execution talk of content that he needs to call when this function is executed. So when Kafka pushes a message, the Kafka tells you that, okay, this is a Java function tells the invoker saying that this is a Java function you have to invoke a Java container to execute this particular function there. So that's what is basically done here. All right. So before we're seeing further time, I just want to show you quickly get a feel of how the function works. I'm just going to share my screen for you. And all these things are available as I told you earlier that the little links which I gave you. So all the solutions, all the functions that are code that are going to get executed are all available and get up for you. So you can go and execute it from there. So quickly, let's get quickly here. So I want to also have the console open up. Even before I go there, I just want to show you guys about the place where you can download these to execute this action. This is exactly so far. For example, if you see my screen, this project are opened as OpenShift. So this is a GitHub project from where you can download this project and get it executed to deploy this on your Kubernetes or OpenShift platform. And you can also, this is what I exactly did. So if you see my application console, if you see I have all these are just blowing it up a bit for your convenience. So you'll see all these containers, for example, I showed you about Internet, I showed you about StreamC Controller, which is used to cluster controlling and there's... Yeah, yeah, good. Could you go slow down just a little bit? Just slow down just a little bit. They're moving real fast and I love it, but some people listen a little slower. Okay, hold on. I'm just concerned about the time. Fantastic. So I just slowed down a bit because I just have only demos to run through. So let me quickly get back to the screen where I'm talking about is from where I deployed and installed it. So once you have your mini shift running on your machine, so you can just go down to this particular project here. So project are OpenShift. So you can go to this project, download these links are there already available on the tutorial, as well as on the slide deck, which I'm going to share with you guys. So you can just go there and then all you need to do is execute a simple command just like this. As you see in my screen, just process HTTPS and then you can just go and install OpenVest. The moment it takes a bit of time initially because it has to download a lot of containers before the Sprinter app and then if you see this successful deployment, you will see something like this on your screen, like you should have an alarm provider and then you should have an engine. As we saw in our architecture, we saw one cluster controller and then we have one stateful controller which controls the patroller component you saw, CouchDB for your persistence, you have Invoker and we have Kafka and also we have a Zubkeeper which kind of does few other things internally. So you'll also see a couple of more bomb containers. We call them as pre-bomb containers in serverless terms, which means that these containers are already up and running to quickly execute some actions for you. You will see that these pre-bomb containers come into picture when we write our first function in a couple of seconds from now. What I'm going to do right now is I'm just going to show you my screen. So what's the function I'm going to create right now? It's a pretty simple JavaScript. So I'm just going to say welcome to OpenVest on OpenShift. I'll just say, okay, this one simple function which I'm going to do. It's going to return me a JSON payload the moment I created. So as I told you earlier, so all I have to do is like I'm just going to bring up my other window, so where I want to show you like how the containers come and go down. So I'm just going to do this Vest dash I and then I say action. I told you that action is the current delete. So I'm going to create a function and then say okay I called action name as breeder and then I'll say breeder.js Say the function needs to be created. Oh my gosh, sorry. This is nice. Thanks. So when you guys are going from Kubernetes and disk there's a smaller thing. It just swaps your command. So it just needs to be pretty careful about it. So I just say action create. So there's a command we need to do. I say okay go ahead and create this action. So we'll see this action has been created and then I say okay Vest. I said how do I invoke this action. So this is from the CLI. But technically if you are on a real soulless architecture you are back to services or you're other other applications going to invoke this action but I'm going to invoke this from command line for you. Say I take a breeder a function name action I should call invoke. So next command verb I need to give and then I say breeder dash dash result. I told you that there is two ways. One is to make asynchronous by default. Another one is to do synchronous. I'll show you the first one as synchronous. I just want to get this command right out there on the screen. So if you see this so you'll see this command getting quickly done up and I'll also show you once more that I go to invoke this again without the result which is an asynchronous operation. And you'll see this the pre-won container coming up here executing this and if you want to go and see what's the output I told you that I need to go check the activation log. I just go back to activation and then result and then I say activation ID. So which is we got out of the command and then you say we call this. So this is pretty much what you want to do when you want to write and how quick is update. So I just go back and then say okay I just changed to definition live and then I go back and say create the command again. So then I say I guess this is much better. So I'm just going to say update. So all I do is update the action now and then if you invoke again so you'll see the container coming up again probably three bombs so it's pretty quick to come up and go around activation result. I can also use the L parameter which is the last activation. So I don't have anything right now so I just say activation result and then give you log ID and then you see this command is getting in secret there. So this is the scope so quick to update as you saw is one of the benefits that I can just quickly develop and update all this stuff pretty quickly. So let's quickly go back and then say how do I create. So if you go back to my slide the next one I want to be about is so how to create a Java actions. So so you can just read through the couple of analysis which I did with plain old Java functions and then I also did with with spring cloud functions you can go and refer to the tech there are some pros and cons supported. So I'll skip that for now and then I'm going to quickly jump and show you a couple of more demos where I can go to create some two more Java actions. So the one thing I love about the Java actions with openvisc is that let's quickly go ahead and open this Java class. So I have a Java source here for reference. I'm just going to blow a little bit up so that it's I can just navigate as well as it's clear for you. If you see this class there's no big deal in this class if you it's just a dictation object it needs to have a main method just follow some syntax and then it needs to have a JSON objects as a return and then it should take JSON object because openvisc always takes in JSON and gives back JSON. And then it's it's a same pretty much the same one which we saw a couple of minutes back of with respect to the other functions. The other cool thing about this is that the way you need to test it right. So for example it's so easy to test because it's just a Java class static main class. I don't need to have a real function environment fast environment running for me for me to test this. For example I'm just going to quickly click this route test and you'll see this my my test has failed right now. So I'm sorry I just need to go back and check what's happened here so okay so there's something else so I'll just keep that for now so so what I'm going to quickly do is like I just go back here and then compile this how do I deploy this is to this I can just go to openvisc how do you create this you don't need to worry about as I told you earlier like we have an app type so if you go tomorrow I'm just going to blow up this app type for you which is a command I just had to tell you for you guys so if you see this from line 8 to 50 which I'm seeing right now on my screen so this is a Maven app type which is available it's right now not available in the Maven center we're trying to push it back so you can go to dev tools for example I have this link on the tutorial Apache Incubator GitHub.com so Apache Incubator DevTools yeah this is the place where I need to go Apache Incubator OpenList DevTools and then we have a Java action app type right here so this is something that you can go down download that and just do a Maven clean install to get it installed into your local Maven repo and then the moment you have this then it's easy for you to get started with like how I did here like just use Maven after to generate the moment it generated gives you these two two different classes for you the one class is that it just gives you the class which can which can help you to create the main class and then the other test class which is used to test this thing for you all right so what I'm going to do is like I'm just going to do a clean package just to save time just go and skip tests because we are just running over time I just need to quickly show you how this works I just I'm just giving tests for now and then you see there's this class getting generated and then you have a jar I don't even need to do an install so all I have to go back to do is like I just go copy the command which I have already have created for us so it's pretty much the same command so the only difference between Java action is that I need to have a main class saying that my jar has multiple classes from where we have multiple functions then I can specify which main function has to be involved for this particular class so that's what I'm typically doing here I'm just going to say whisk action create hello whisk action then give the jar name and the class that needs to be involved and that's also you have the class generated and just going back to go and involve this app so what I'm going to do is like whisk-i action invoke and then I call this allow openness function and just going to make it synchronous right so listen I just lot of show you this stuff for you so that you see this now you see this hello openness my container thumbs up and then execute this hello openness for you and then it goes back again so now it's a different container as I saw in the earlier architectures that the previous command being issued in Node.js container so your invoke on those which container has to be invoked and now if you see you have deployed a Java action now the container knows I need to go and call the Java container for this to be executed so you'll be wanting now as your as your Java guys we use rest API we use grpc because of so we'll be quite interested to know how do I deploy a base action so I'm just going to do a web-based action it's pretty much the same stuff but the only thing is that if you see this code again so all it has to do is like you just use your that URL and then you'll see the responses back on your on your console using a curl command for that stuff so so this is again so I'm just going to do main and clean package and for case giftcast and if you see the wallet packages that I'm just going to show you this command if you see this command if you see I just have one extra parameter saying that that be equal to true which makes that this particular command has a URL basically the moment how do I get a URL this is a command to get the URL if you see I'm just going to show you show that for you to see how I can get a URL so you'll see that you got a URL here so I can just go ahead and then call it from the browser as well so I have to say advance proceed I just show you in working from here it might take some time for it to come back for a street song right so the only big advantage is this is I'm just printing out all the parameters that goes in and goes out I just understand up turning it back as part of my payload the good thing about this is that there's no verb definition I can I can use get post whatever you want and then the one which you fix at the last right for example here I'm splitting this json which sets the content type automatically for you so you don't need to set the extra content type for you so that it knows what response has to be written so it goes in and works a respective function inside that I can also pass a parameter for example I won't just go to say name equal to just give my name and then if you see this the name parameter is getting passed as part of your json request as well so you can just grab this parameter using a json object which gets passed into every different function and then I can also pull out this name as well from that as well so if you don't give this and then pass this name you'll be wanting that you see we're doing a pretty much a different stuff for you and I'm just going to take out the json from here okay I just need to copy this again I use it without the name parameter and then I say name equal to something else this is called better that's much better than this function k so that I can award the stuff here so I don't get anything because I literally don't know which content type I have to go so basically you have all these examples again on the on the tutorial you can just go back to your tutorial and then check these actions as well so it tells you to learn much more better than these stuff all right so we've seen web actions we have seen these things we have seen a normal job action and we have seen other stuff so the last last one is the least stuff which I'm going to show you is that I'm going to show you how we can sequence multiple actions together so that's the last part of this particular demonstration which I'm going to have and then I can turn it on to q and a so I have three different functions I'm just going to build a very small function just going to go to the folder which has that so sequence demo and then I have three different I have a sort of splitter and uppercase three different functions so I just I just hit one function inside that and this function is going to do something and pass the output which is going to serve as an input for the next one so uh so I'm just going to first build uh the sort of I guess I just let me go by sequence the command which I have it's easy for me so all I have to do is like first I have to create a package so as I told you earlier this also shows you use your chance to show you that how to create a package I have a great package now what I'm going to do is like I'm just going to go to uh sort of splitter first splitter first splitter does nothing but it just takes a month's effort at strings and split them them and they give you a json array back to you so uh so no big logic there so I'm just going to do same maven clean package for these git tests so um I'm going to go back grab this command up and then show you create this class splitter is done I'm just going back again to uppercase now so let me fire the clean package command first before I go to grab the command first so I'm just going to go back and then say okay so let's create this uppercase right so we are done and then I'm going to create uppercase we are done with uppercase and the last one is shorter so let me go and call the package again so that my jar is ready and then just going to go back and say package all right so we have package now now the last command is that how do I create a sequence so this becomes a little bit interesting here so I just want to show you that um just let me get out of from here and then okay we see my sequence uh of action if you see this so I just have a sequence parameter added to this and then I give a list of actions comma separate list of actions that needs to be part of the sequence so one thing about openness sequence is that this is static order like so the water in which it is given it's it's it's kind of cannot be changed and once the function is involved okay there is something called as conductor which is available in openness I don't have this demo right now with me but that helps you to change your next action which needs to be involved based on some condition in the first action and also you also need to keep in mind that only the first action in the sequence list gets the parameter that you pass and for all of the actions the output of the previous command is going to serve as an input of the the new command so that's what is going to go down and so yeah just come back to the code in the moment and they're going to create the action for you uh I'm just going to let me zoom back in so that it's clear so I just created this action and then I'm going to invoke that as I told you earlier so it's just going to be uh an action like this I'm just going to pass a comma separated string which is a lowercase uh jumble thing like zebra cat and actually so that I can show you how it started and it also open up this console for you so that I can show you how the sequence of actions are invoked for you you see the first splitter comes first and then the uppercase now and then finally we go back and then invoke the sorter and then you get the result back right so you see now that I get the result with antelope catch zebra blah blah blah and all this stuff on these these these actions go back you know in a certain moment of time so the one the good other good thing about this like when you try to invoke these actions in the sequence I mean the victor subscriptions these contents will not go back they'll be pre-warmed state and then they'll start executing which and every stuff to do right so uh let me quickly jump to my slides to show you some interesting others interesting links and other stuff uh the demo training which is something which you have seen right now uh and there are some event event capabilities when go back and check this staff again uh I guess I'm running out of time just have three more minutes so one thing I want to show you about this is the cloud event um so right now the cncf is working towards a specification that can that can have cloud events let's say I want to invoke an action from aws lambda from my serverless provider for in this case Apache open mist so if they are coming up all these uh pass providers cloud providers all these guys are coming together to define a common way by which I can share the metadata between each of these events so that I can write my function to be make it interoperable with other providers you can find more information on cloud events.io so we can just go there and then find find other stuff as well okay uh the last stuff uh which is again uh I have another demo if you go back to my uh the demo repository which I shared with you so it has a demo which shows you an active mq base thing where I can drop a message into active mq and then it's picked up by a trigger and the trigger times up fires up some actions for you and then and the end of the day the action comes back invokes multiple different actions like for example one uh the same splitter sort of use case but it written in different languages like phyton java uh note the mingola and then jf javascript so which shows that there's the the serverless platform is polyglot you don't need to stick to one different language like for all our demos in today's session we saw all the demos on java but you can still work on all the languages then combine them together to make it work for you all right so maybe uh I'll find another time where I can show these these demos again for it's an advanced fast kind of stuff where I can show how the fees and triggers and events work together for you all right um and that's pretty much I have so again these links once again for you uh so you can just go to this bit.ly link the first link is is the tutorial which but all the sources which you just now saw are all available in the bit.ly fast tutorial if it shows you how to install by yourself you think of any shape on your local laptop I start doing stuff by yourself and the second one is again an online platform you can go to loanoutopenship.com slash serverless all the things are installed pre-installed for you all you have to do go start practicing your how to write your function how to write a java function how to create a package and all these stuff just now like how we saw right now and the link on my deck which I right now this this particular deck I skip few slides because it's for you to read a bit later so you can find this deck right down the bit.ly link which is right below there for you so they can pick out the slides and they start slapping that for you okay and that's pretty much it and back to Burr where we can just start taking questions so if that's the case