 Hey everybody, this is Grant your friendly OpenShift team member now today I just wanted to make a quick video to show you some of the new stuff We've been working on in our upstream project OpenShift origin, which is also called OpenShift 3 If you're not familiar with OpenShift and what we've been doing we've been spending a lot of time Working on both Docker and Kubernetes and making it accessible to the developer Now the little video I'm going to create today. I don't have anything scripted I'm just going to kind of walk you through getting it up and running on your local box now on the box. I'm using today It's actually Mac OS X L Capitan I believe is what it's called and I'm going to be using the all-in-one image that you can download On the internet and I'll show you where to get that you just go to OpenShift org slash VM And you can download this vagrant virtual machine that uses Virtual box and there's instructions on here. And so I've already down downloaded that and Since I already have it downloaded the only thing I need to do to get OpenShift running on my local box Is type in vagrant up and this will spin it up now The prerequisites for this is to have both vagrant and virtual box installed on your system If you go out to blog.openshift.com and search for Grant Shipley Which is my name you'll be able to see some detailed instructions on how to get this working on The Macintosh Windows machines as well as Linux machines now once I issued the vagrant up command here It's gonna head and start up this virtual machine that has OpenShift already running for me And a few things to note here is that the IP address that we use by default is 10.2.2.2 If that doesn't work for your particular network configuration You can just look at this vagrant file and change the IP address on this line To use whatever you would like to use for your local environment another thing to note is The amount of memory allocated to the virtual machine by default I believe it's two or four gigs, but my machine that I'm running on actually has 32 gigs So I'm gonna end bumped it up to Just under eight gigs of memory allocated to OpenShift and you can see this is the origin machine So now that we have this up and running. Let's go ahead and start taking a look at the console Okay, so to get to the console All you need to do is go to 10.2.2.2 Colon 8443 is the port and let's log in with the username of OpenShift and the password of OpenShift You can use any username and password you want for the virtual machine. It doesn't matter It will allow any type of authentication just for demo purposes And once I get to the console the first thing I see is that I need to create a project So let me show you how this works I'm gonna go ahead and click on create project and I am going to name this project demo PHP and we're gonna have the display name is PHP application and Just a short description is my demo PHP application now when I'm typing on my keyboard I am doing this in real time seeing actually hear me typing. I apologize I'm using a mechanical keyboard and those can be kind of noisy But if you don't have one I suggest getting one they're great Although take note that if you get on a lot of conference calls your multi-tasking ability goes to zero because people will complain That you're typing. All right, so let's create this project so now I have a project created and By default it's gonna drop me into this menu to create an Application right based off an image or template and since I wanted to create a PHP application I'm gonna scroll down and I'm gonna select PHP you can also You know filter by keywords here you can type in PHP Maybe you're a Java head and you just want to look at the Java stuff Maybe you're a hipster and just want to bang out some Node.js. Let's filter that in but let's go ahead and do PHP let's do PHP 5.6 and You'll notice on this screen There's this little tag here called builder now That's where the true magic of open source comes in and an open shift Ladies and gentlemen is that we have this other project inside of open shift called source to image And we have these builder images that you can select. Let me show you how that works real quick It's it's pretty phenomenal. So I'm gonna select PHP. It's gonna ask me for a name of my application Now remember we put in a name before but that was for the project so you can think of a project as a grouping of Different assets for your application So you may have a web front-end the database whatever the case may be and then you also name each individual Component and that's what I'm naming now is my PHP web front-end. So I can just call this front-end and It's gonna ask me for the get repository URL now this can be from any get repository including private repositories So what I'm gonna do just hop over to my github account real quick And I am just gonna click on my repositories. I'm gonna find a small PHP one here Here's a simple PHP that we can use So let's clone or copy this repo URL paste that in and Click on create And so now what's actually happening is open shift is automatically cloning that source code repository It's using a base docker image with PHP in it that is a source to an image enabled Image and so it's gonna clone that repository Build the source code if it needs to in PHP. It's an interpreted language So it's not gonna build anything but it is gonna resolve any dependencies and then layer The source code on top of the base docker image and create a new docker container based on those two inputs as the output And so the beauty of that is the developer you get to take full advantage of docker and orchestration with Kubernetes Without having to learn all the internals of either of those technologies, right? And so it really frees you up as a developer just to focus on your code And you still get to be able to take advantage of all the cool things With running your application code inside of containers Now I did this in real time so you can see that it was pretty quick to deploy this Application out based on docker and kubernetes and I have one pod running now pod if you're not familiar with kubernetes You can think of a pod as being the Encapsulation of a docker container so you think of a pod as a container And inside of this pod is actually that new docker container We just built and under the covers it also created a route for me so I can access this application immediately So I'm going to go ahead and click on this Route that was created and we can see that the application This is just says this is the best php web app in the universe. Let me make that a little bigger I'm we need a basket all the glory of this wonderful php application that I created see that's awesome, right? So let's go ahead and close that and one of the great things about OpenShift is the ability to quickly scale this up So let's say I wanted to actually scale this up to you know Three or four different containers all serving the front end and click this button is gonna scale up to two click it again It's gonna scale it up to three up to four and then let's go to five just for fun here So that's how quickly I was able to scale this php application up to five Containers docker containers all load balanced inside of OpenShift pretty phenomenal stuff I didn't have to actually do anything, right? And so now if I hit this web application, it's actually gonna be load balance across those five pods. That's crazy cool, right? So I'm taking advantage docker Kubernetes getting this web-scaled business going and I don't know anything about how to set up HAProxy load balancers and how to you know wrap traffic with session affinity and all that other cool stuff that we leave to our operations team But I was still able to take advantage of this as a developer So let's take a look at some of the key concepts that you're gonna want to know in order to start developing with this OpenShift business that we're talking about here So if I click on browse I can look at my builds my deployments my events my image streams pods routes services storage That's a lot of stuff, right? Hmm, so let's just start at the beginning. Let's let's go to builds here Now I had a build running that took 52 seconds and I created it four minutes ago So 52 seconds as a PHP developer. You're probably going okay guy That's that's a little long, but you have to understand what we are actually doing under the covers here We took your source code as is from a git repository and we baked it and built a docker container and image on the fly So you can deploy this container out It's pretty amazing stuff and and then once we did this initial build You saw that we were able to scale up very quickly because we just had to replicate the copy of that docker image that we created on the fly Okay, so that's builds in a nutshell. I can actually click on this build if I want to get some more detailed information here And I can view the log of the build pretty cool stuff, right? It's just a php app So there wasn't really any a build, but I can open the full view of the build I can look at the environment here And then I can go back to details and what's interesting is if I wanted to Also start a new build all I have to do is click this rebuild button I can edit the build description if you want to go way into the depths of open shift and how Build strategies work and how to kick off new builds It's you can see that it pulled my information from github Here's the docker image that used that uses a sentis sentos And so you can go in and actually modify this stuff if you want to do some advanced use cases with it So let me go back to browse and go to deployments Now on deployments, I have one deployment, but I have five replicas That's when we scaled up to five pods and it's going to trigger on an image change And so what that means that is if anytime I change my Base image it's going to automatically redeploy that out to the cluster that I'm using So that's pretty cool, right? Because if the base image that I'm using that php image gets a security update or whatever the case may be By default it's going to automatically change that image and then do a rolling deployment across my My cluster now you can obviously modify that to suit your needs if you don't want that to happen There's all kinds of different build strategies that you can implement in open shift But let's drill down into my deployment here And so here I can look at the detail details of this deployment I can also look at the number of replicas right now. We have five current five desired I can change that right here. Let's just go up to 10 Pow bobs your uncle. Let's go to 10 And so we just scaled up to 10 just by adding a different thing if we go back to the overview page Sure enough, we're up to 10 pods. That's crazy stuff, man. I love it All right, let's go back to browse and deployments and poke around just a little bit more here We can see some details about the container the image how I could manually Deploy this from the command line if I wanted to What template we use number replicas again the pod template we can attach persistent storage if we want right here Now that's pretty pretty cool stuff because Everyone who uses docker container knows that they're ephemeral in nature If you store things on the file system inside the container once that container Restarts or something happens. It's going to be lost. And so in open shift We actually provide the concept of mounting persistent storage inside of your pods or your containers So your data will live on All right, let's click on environment here I don't have any specific environment variable set for this little small application But if you did have environment variables, they would show up on this page We can also redeploy from right here. We can edit the Deployment yaml just like we did with the build strategy here If you want to get into some advanced use cases, let's go back to browse click on events And this is where we'll see All of the events with this little scenario that we just did You know creating scaling pushing building all all that cool stuff. We can dig into that a little bit So let's go to image streams and this is showing the docker image that we're actually using and where it was pulled from This is using the internal docker registry that we ship with open shift And you can see, you know, if you wanted to pull this image out or do something with this particular image This is where it's come from. We call this image front end, which is what we named the application Now if we go into pods, this is where it kind of gets a little bit cool We can see all of these pods we running That we have now keep in mind a pod you can think of it just as a docker container So we had this build pod that we kicked off to actually run that build to create that docker image We created it nine minutes ago and this one has finished. So there's no containers running right now But if we look at one of the application pods Click on that we can do some cool stuff here We can look at the environment again. We don't have any environment Variable set we can look at the metrics Which is pretty cool. So we have this built-in metrics dashboard here They'll show you how much memory this php application is actually consuming. It's actually consuming 51 megabytes of ram so not much and and little to no cpu not even enough to register We can also look at the logs on this particular pod We can see the get request that we did And it'll show up here You can follow the logs or tell them however you want to look at that or think of that You can also view them in a full screen mode here And once this log gets down below this page There's a little button that pops up here that says follow which will allow you to basically tell the log Another thing you can do which is really cool Is just click on this terminal right here and we basically open up a shell inside of the remote docker container So you can do ls, you know, you know who am I and they'll tell you that you're the user default You can look at your index dot php file And say this is the best php web app in the universe. We'll exit out of that You can look at log files in here. Whatever you want to do, right? So we're probably an HTTP Let's just tell all of those. I guess there's no files in there or I don't have permission But you can look at log files inside the terminal do do You know normal terminal stuff that you'd want to do on a container If you wanted to All right, so let's go back to browse and go to routes Routes for my application front end is how this is exposed to the outside world Internally my pod or my container is listening on port 8080, but we're going to expose that via this um hostname And so if I click on this We can see that it routes to the service front end now service is something we haven't talked about yet But a service is basically the entry point into your application So if I looked at this service front end We can see that the service port 8080 and target port 8080 We can create additional routes the ip address We can show the annotations We can create another route if we wanted to create another external entry Into this service Okay, let's go over to storage now. This is going to be empty. But again, this is another place that you can Mount persistent volumes into your application that's been provided for you on the platform So you do have to set up those persistent volumes as an administrator before you can mount them as a developer But once they're there you can mount them into your pods and containers and they'll live with the life of the application All right, lastly, let's take a look at the settings tab here We can just see, you know the name of the project any quotas that you have Since this is just a local Virtual machine that I'm running as a developer. We don't actually have any quotas. Okay So let's go back to the main project screen. Here we go our php Application now I want to show you the real power of this Source to image and building these Docker containers on the fly. I want to go into my builds So I'm gonna click on this build here Or sorry, let me browse into the builds Let me click on the build front end here I'm gonna click on configuration And then over here we have some webhooks Now this is really cool stuff. So what I'm going to do is I'm just going to copy the url for this github webhook Okay, so I'll put that into my clipboard. Here's the full url. I'm going to go over to my github project And I'm logged in here. So what I'm going to do is go to settings and webhooks and services Let me delete this webhook And then May log in here And then I can add this webhook in So let me paste that in I'm going to disable ssl since I'm using a self-signed cert And then I'm going to add that webhook now any time that my application code changes It's going to trigger a build inside of open shift now That's not actually going to work for my environment because why I am on a private ip address So it's not actually going to be accessible from the outside network But if it was and I made that change it would automatically update this Build with some new stuff. Okay So that's basically the open shift web console in a nutshell All right, we have this great awesome PHP application here That we deployed now I do want to switch over and show you the command line just real quick Let me clear their screen here And the command line tool that we ship with open shift 3 is called oc So I can do oc log in and say dash dash server equals 10.2.2 colon 8443. Let's do https on the front of that And hit enter there and we used uh, what do we use open shift? and open shift And so now it's going to say that i'm using a new project called demo php Okay, so that's pretty cool So I can do oc get pods in a list all of those pods now Let's say I want to scale down on the command line Now it's not as intuitive as the web browser or the web console But I will show you how to do that the way we scale is through the deployment config So I can do oc get deployment config And it's going to say that I have a deployment config called front end So what I can do is say oc scale dc Which is the deployment config give the deployment config a name and just say replicas equals two And that's going to scale us down to two And so if we go over our web console, we can see sure enough that we scaled down to two So let's do something. Let's go up to 20 And then I'll switch over to the web console real quick so you can see it actually Scaling up here So you can see that uh, you know it talked via the rest api out to my server And it's going to scale this up to 20 pods And it's starting to go we're probably at 5 10 15 BAM all the way up to 20 So pretty cool stuff. You can also actually scale down To zero believe it or not and that just leaves your application There, but it's not actually running right and so if you just wanted to You know have it sitting out there. Maybe you're doing some maintenance on it or whatever the case may be You can just have it sitting there. So let's scale this back to one So our application is up and running again. So let's do one other thing Let's show you how to use application templates now. I have an application template in a OpenShift 3 mlb parks project, which is a geospatial based application And so what we want to do is show you how to use a command line To create a java based application. So I'm going to say oc new project mlb parks Oh that project already exists unless I've created as a Another user someone call it open shift mlb parks So now we're using this open shift mlb parks project If I come back to the OpenShift console we can see that we have an open shift project here But we don't have anything in our project So what we support with open shift is the ability to have application templates and this is powerful for development teams Because once you have your application up and running inside of the environment Like you want, maybe it's a complex application with some front ends and back ends and microservices And you have it running you can just create an application template And then anyone who joins your team Or wants to work on your source code can just basically recreate that entire project based off of an application template And so i'm going to show you how to do that And so I have my application template here And so what i'm going to do is just create this application template How much can copy and paste the instructions here paste this in i'm going to say oc create dash f Which means from a file, but it also takes a url and here's my jason file that describes my application So i'm going to create that so now I have a template called mlb parks And so if you go back to the web console if you click on add to project And you search here or just it's actually the third one down here You can see that this was actually created Inside of the web console as well So as a user of this project I can create this and it's going to create a eap application with mongo db Um, I can also create it on the command line just by typing oc new app mlb parks And that is going off cloning that git repository Setting up mongo db doing everything it needs to deploy this java ee application out So we have mongo db already running and now it's going to pull down and build That java source code and so let's take a look at this logs and I'll show you what I was talking about with follow I clicked the little follow button up there and we can see that maven is doing its build of this java application And so while that's going let's create another project and we're just going to call this guest book And now i'm using this guest book application I want to show you how easy it is to use Containers or images that are not actually In open ship so I can do oc new app kubernetes slash guest book This is the famous kubernetes guest book application and it's going to go out to Docker hub and pull this down and run it for us Okay, and so you can do this with any image on docker hub And so let's go back to our projects here. Let's go to guest book And we can see that we have this guest book application running, but we don't have a route for it yet So let's create a route Let's go to services here. I've never actually created a route inside of the web ui always use command line But it looks like we can click on create route here And we're just going to click create see what happens All right, so it was smart enough to figure out how to create a route for us that's uh addressable And so now if I click on that bam I have this kubernetes guest book application running that we pulled down straight from docker hub So the the world is now open to you in running these docker containers locally on your machine Even if they're not sourced image enabled right so you just go out to docker hub find something and spin it up Let's go back to our projects here. Take a look at our open shift demo b parks application Check on it. It is a Pretty hefty java based application. So it takes a while to build the build just finished. So now it's creating that uh Docker image on the fly that we were talking about earlier And it's pushing that docker image up to the open shift registry And then once that image has been pushed to the registry you can see it happening down here on the very bottom line That image is going to then be available for deployment. And so this can take a few minutes for it to actually Complete pushing this large java image out to the registry the first time So the while that's going I do want to just show you a few things On the command line here as well So I can say oc get pods on this kubernetes guest book application And we see that I have one pod running now If you remember I showed you how to scale this earlier in the video on the command line The flow is the same for every application. So i'm just going to walk through that again. Say oc get dc Which is deployment config you can also type it out here if you want And this name is called guest book. So we can say oc scale deployment config guest book Set our rep because up to 10 And we'll scale guest book up to 10 now if I do oc get pods There we go. Now remember I showed you These are currently scaling so they're in a pending stage if we do it again Maybe they'll be running some of them are running if you remember on the web console I showed you how to open up a shell inside of the browser So i'm going to show you how to do that on the command line. Let me do oc get pods They're all running now. Let's say I want a shell into this pod. Check this out. I can type in oc Rsh notice I have tab completion pretty fancy stuff Guest book and then to give it a pod name. Maybe I want to go into the d7 one And I had tab completion there courtesy of Z shell and oh my zsh And if you're interested in getting that set up just go to blogs.openshift.com Search for grant shipply. Again, you'll see a blog post I wrote about how to set this up So I'm just going to rsh into that Oh, it looks like uh the kubernetes guest book application actually doesn't have bash in it So that is good to know right so you'll run into that at some point some of these uh Docker containers that you have don't actually allow you to execute a remote shell So let's get our projects and let's switch over to the php one because we know that that one allows you to uh Execute a shell session. So let's say oc project demo php I'll do oc get pods Now let's do oc rsh front end wx And we can see that because this container actually has the bash shell installed on it. I'm able to rsh into That container and I can you know look at my files do whatever I'm going to do here So let's do oc get pods again Um, and let's do oc get projects and switch over to our open shift mlb parts projects I can do oc project Open shift mlb parks And I want to do oc build logs Let's see oc get pods. I can do oc log And then pass in my build pod And paste pass in dash f to follow And this is how you can look at your log files on the command line just like we did in the browser So it looks like uh that it successfully pushed that image I'm looking at the last line here. So let's go back to our project here And uh take a look At the application here we go. We have one jboss eap server running with a java ee application Backed with a mongo database exposed via url. Let's see if jboss has actually came up yet Sure enough it has and here's the application. It's a geospatial based application Um that you can look at all the baseball stadiums. So let's see how fast we can scale up the old jboss system here and java is Pretty renowned for being slow. Let's see if that's true. Let's scale it up to two here It's thinking about it Come on java you can do it Starting jboss up I guess So let's see How long it actually takes Should be done. There we go. We're now up to two uh jboss eap servers all load balance. Let's let's uh Let's really get some heat going here. Let's do oc uh get pods for project of my m And we know how to do this. We want to scale this up. So we're going to say oc get dc And now we could scale up mongo dber mlb parks the job application Let's say oc scale dc mlb parks We're going to set our replicas to let's scale up to 10 Jboss servers now keeping my arm running all this on eight gigs of ram. So yeah So now we can come back here and it's going to scale this up. Look it's getting there Okay, so all of the containers have been created. It's being replicated now. We're just waiting on The containers to become active And uh traditionally that'll mean you know waiting on jboss to to come up and for the application Um to start so this should be done just any second now And so a few is coming online. So I'll move a little bit there Maybe I should have scaled the other one down To make up uh free up some memory So actually let's go while this is finishing scaling up. Let's go and rouse our pods here And now we can see that they're all running Um, so it just took a a second there. Um, so let's go into our pods And what we can do is take a look at this first one that's been running for eight minutes We can actually look at our Metrics here remember that php application was using 52 megs of ram Initially this java one started with 473 Announced down to about 248 Um, and here's the cpu that's usually this must have been when it was deploying the application And loading things in and then we can look at the CPU here. It's using three millicores All right, so I've taken up enough of your time again this was totally just an unscripted little demo that I wanted to Let you guys see kind of the stuff we've been working on in open shift And uh, hopefully pick your interest into downloading The all-in-one image and start playing around with it and using it for development I'll create another video and perhaps a blog post later this week to show you how to set up Hooks inside of your ide for like php development. So when you click on save a file It'll automatically instantly be updated in your container for rapid application development So anyway, thanks for watching check out the all-in-one image. See you later