 A když Žáško ceknout, se poštíte mňa, si jen dělá. No, tak jste na tím. Vás se stavíš? Té na tím. A jsem dál ještě tady meni o to, že jste na mňa, že nebo máš pravout. Voděte. Je to tě, co stá tady? A co je tě? No, to je, to je. Mám to, tě, tě, že bude, pro co leží, jaká koliké hodiny, kterého, a když se chcela, možná, že to, můžete, můžete, a když jen dělá, tak se můžete, tak jen, můžete, a můžete, můžete, můžete, můžete, a můžete, můžete, můžete, a můžete, můžete, můžete, a můžete, můžete, můžete, a můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, můžete, HI, so welcome to getting started with OpenShift. I am Grant jifley. I work on the OpenShift team. I mainly manage the developer OpenShift comments community. V общině je zběžené software engineer. Je to slovenský software engineer než být před 10 lat. Máme týme jiné případé kvůl bec. Moji dnes taková dnes zběžené trzy před... Moje dnes dnes zběžené docer. Máme to. Jak si o roketi zběžené? No, no, Rocket. Docker's dead. Rocket's the new hot man. Like Space X, so which one? Rocket is CoroS is... CoroS got angry with Docker just like everyone else in the world. And so they created their own container system called RocketRKT that actually aligns more with what Red Hat's trying to do. And so they released version 1.0 a couple days ago. So it's just a competing container format. It probably won't ever take off, but it's kind of cool if you like playing around with stuff. So I'm just going to give a few slides at the beginning. And then most of this morning is actually going to be hands-on stuff. I have a lab that will work through. If you have your own laptop, it's good to run through it. I created user accounts for everyone on an OpenShift 3 instance. If I talk too fast, let me know. But give you some background on what we're trying to do with OpenShift 3. You guys have probably all seen this, but the world has been changing, especially in the last 15 years. We've gone through one of the most disruptive times in the human race, believe it or not. More technology is changing everything about our lives. More so than any other thing in the past, except maybe fire and perhaps the will. Anything else you guys can think of that has changed population so much? All right, so just to illustrate this, this is a picture from 2005. It's a group of people. And you can see this is ten years ago, just over ten years ago. What's interesting about this picture is this guy down here has a flip phone. You guys remember these? I don't know what we did on flip phones. I guess we called people. Imagine that, talking to people on the phone. I used to, when I had a flip phone, somebody would text me. You know, you'd have to hit the two button three times to get to see or whatever. You guys remember this, right? And someone would text me and I'd be like, what the fuck are you doing? Don't text me. Just call me if you want to talk to me. And now, if someone calls me, I reject the call and say, why don't you just text me? I don't want to talk to you. And so things are changing. Right here's another one. I have no idea what they're doing on these things because it looks like they're taking a picture maybe. I don't know. She's got her hand on the middle. And I don't know. So let's fast forward eight years to 2013. This is what the scene looks like. So everyone is using these connected devices now and living their life through their screen. My kids play soccer. And they're on teams with soccer. And I go and I watch their soccer games on the sidelines. And I just turn around and I look at all the parents. And they're watching the game through their fucking phone. And it drives me crazy, right? Just put your phone down and watch the game. But that's kind of the world we live in now. This guy, look at this guy. He's even got a tablet out. He's pretty cool, right? And so things are changing. We're going through a digital disruption in the entire world now. And today you guys have probably seen this, but maybe not so much in check. I don't know if you guys have this or not, but the world's largest taxi provider doesn't actually own any taxis. Who's that? Uber. Uber, that's right. The world's largest media company today doesn't actually create or own content. What does that mean? Facebook. That's exactly right. But I have prizes. Mom and I have given out prizes. I should give some prizes. These things are pretty cool. I said I don't know what they are. They're little, so they've got to be cool. What is it? Jewelty? It's a USB drive. Is it not going to explode? It's probably got... Are you running Windows? It's loaded with viruses for you. There you go. Thank you very much. All right, so it is Facebook. Yeah. Doesn't know that. I don't think you are supposed to use or flash this because they are for the workshop. They contain the images, but you have scars there to... Is that what it is? Get me that flash drive back. Did we have anything on the images? I'll give you something. Scarf is on the window. Ah, you get a scarf. There we go. Cheers. Well, thank you. I probably would have screwed up someone's workshop later today. The world's most valuable retailer doesn't actually own the products they sell. Who's that? Amazon. Who? Amazon actually owns and have warehouses of all of their stuff. eBay. Nope. Alibaba from China. Is it bigger than eBay? It is bigger than eBay and Amazon. Really? Yep. The world's largest accommodation provider doesn't actually own any real estate. Anyone know this one? Airbnb. That's right. Was that you, Linchen? Yay. Yep, Airbnb. And so we are going through this digital disruption to where all of these traditional industries are getting disrupted by software companies. Are you guys familiar with what a taxi medallion is? To drive a taxi in, say, New York City, you have to buy this medallion that hangs from your mirror that lets you know you're a certified taxi driver. And the price of those since Uber has came on the scene has been reduced. I think they used to be a million dollars just to drive a taxi, right? Really? And then you pay it off over time. So you don't have to pay the money up front. But those have reduced in price dramatically. So software companies are able to compete in any industry just with a few guys who have this great idea and can develop software faster than traditional enterprises. How many people work at Red Hat? Do you feel like sometimes it takes us forever to get something out to production after it's coded? We struggle with this as well. When I used to manage IT at Red Hat, if we wanted to update the website, it would literally take us from code finished about two and a half to three months to actually get it out live. Just because of all the process and all the stuff that large companies do. And so a lot of large companies are being disrupted because they can't compete with the speed at which smaller companies can release things to production. And so what these large companies are saying now or believing, which is not true, is that containers are going to solve all of their problems. All we have to do is start using docker containers and everything is magically going to be better. Well, it's not, right? Docker and containers are just a tool. And they will help you deploy software faster, but the problem comes in with the orchestration of these containers, right? And so what we see and what I see a lot is a group of developers learn docker and they understand the power of it, but then they start to realize they need to actually deploy these containers into production. They begin to develop their own container orchestration system. The result of that is their container does get deployed out to production, right? But their data center end up kind of looking like this. They have containers thrown around everywhere. They're hard to manage. They don't have visibility into them. They don't know how long the container's been running or what it's used for. Where is that picture from? This one? No, no, this one. I have no idea. I stole it from the Internet. This picture is from the Internet. And so eventually, if you're developing your own orchestration system, there's a lot of really smart engineers out there who can do this inside their company and get their containers deployed correctly, but it's not their core competency, right? There's no need for us as an industry Když se to závoní, co máme, můžeme si vlastně všechno dnes díky, když někde budou vešer cezvání. Můžeme byt když vyskávat pojď, které je nekontyfie, které jsou všechno dělávali sávodní chvády, kdež se než všechno dělávali sávodní chvády, které se počítení, které se dělávali sávodní chvády, které se když všechno dělávali antlám, které se když všechno dělávali sávodní chvády, a to je partner with Google on the Kubernetes project, which is their orchestration project that they created. On OpenShift, we actually contribute heavily to the Kubernetes project, because our goal is to deliver your containers in the same manner to your data center, so that it ends up looking like this instead. You have visibility into where your containers are, what they're actually running, so you can manage them, get some statistics on them. And that's, you know, two pieces of the puzzle, right? When you think about development workflows in the container world, you have the actual container system itself, which in our case is Docker, then you have the orchestration engine, which is Kubernetes, but that's only two pieces of the puzzle. What we actually wanted to do was create a new platform that adds on top of those to make Docker and Kubernetes easy to use from a developer's perspective. And so when we started doing this, we had to change our development model. We've actually been working on OpenShift 3 for about really two years, a year and a half, two years, but most of that time has been spent working on the Docker upstream project, the Kubernetes upstream project. And so we did actually change our development model to work all in the upstream projects, which is why it's taken us quite a while to get the first version out, because we don't want developers to be using containers and deploy things out there, but then just leaving them laying around and not actually using them on a daily basis, because that's of no benefit. What we actually want developers to do is to be able to create great things with containers. And this is my favorite one, because it's a bar made out of a container. So that's what we're going to learn today is the platform we've created. It is all open source. It's called OpenShift Origin. And the real goal, honestly, is kind of summed up with this picture. All right, everyone familiar with these two guys? This represents development and operations. Who's who? That's a very good question. What do you guys think? Who's Darth Vader? Development? Development, you're wrong. No, you're wrong. The operations. No, operations is absolutely Darth Vader. Development is Luke Skywalker, because we're the nice guys. I'm just kidding, obviously, but it is this tool that will allow these two groups to get along better, meaning that operations maintains the platform. They have full control over it. They get to decide your quotas, what languages you can use. But then after they set these rules in place, developers are free to self-service within those rules. So if they want to spin up ten containers all running Node.js, they can do so without having to call the operations team. Because what I realized when I managed the operations team in IT at Red Hat is that just admins have more important things to worry about than spinning up development environments. And that's why it always takes them so long to do it is because they're actually working on real things. And so development environments kind of get pushed down their priority list. And so with a project like OpenShift, they're able to set it up initially and then let the developers do it themselves without having to call us in the middle of the night. So that's enough of me talking. So now what we're going to do is start the workshop. And so everyone does need to be on Wi-Fi for this. And I want everyone to go to... Let's let me open a console in here. Wrong screen. Go to this URL. And I'll pull it back up in just a second. I screwed up my Zoom level here. There we go. And it should look like this. RunCloud Run. RunCloudRun.com Training.RunCloudRun.com Slash Devtop. Yeah, because in the console that's just RunCloud. Hmm. Sorry. RunCloudRun.com Thank you, sir. It is also 3.19 am for me. So you got to cut me some slack right now. OK, so a little bit about this environment is... Let me switch here. Maybe my internet done. This is running OpenShift 3.1.1.1.1.1.1.1 or whatever the latest version is. We installed this cluster a couple of days ago. It is running in Amazon EC2 Ireland, I believe, was the closest one. It has one master, which is the Kubernetes master. One, what we call infrastructure node, that contains things like the Docker registry, any other packages that we need to install. And then we have five OpenShift nodes, which you can also think of as Kubernetes minions. OK, and don't worry if you don't understand what these terms are, we're going to get into it a little bit. So, has everyone been able to get to the site? OK, so the first thing we want to do is install the OC client tool. This is Lab 1, you can read through it. And so the way I like to normally do things is just have you guys work through it and then when you have questions, just yell at me. But I'll walk through each lab and then give everyone five or ten minutes to do it. OK, so you're actually learning how to do things. The OC command line tool, I linked out to GitHub so you can get the latest version here. The only requirement for the OC tool set is a 64-bit operating system. If you're running a 32-bit operating system, let me know, are you? The Linux package is missing. The Linux package is missing. Oh, let me know, sis, too. That's because we changed our repo servers. So let me get the new... I'm ready to get this card. Let me get the new... If you go to blog.openshift.com, the first post you see, I wrote whatever yesterday or the day before two days ago, click on that link and I linked to the GitHub version down here in the middle, right here, the same link will go to GitHub, OK? And so this... You can download the latest version here. Does that make sense? Blog.openshift.com So go here, click on the first link using OpenShift 3 on your local environment. Scroll down till you see the Microsoft Windows, Linux and OS X and download the correct one. OK, so this binary is written in the Go programming language. The previous version of OpenShift, everything was written in Ruby, which we called OpenShift 2. We basically threw all of that code away and rewrote it entirely in Go. So we didn't save a single line of code, actually. One of the benefits of that is that to install the client tools on the previous version of OpenShift, it required like Ruby and all these other dependencies. So we got rid of that by using Go. So now it requires Go and all other dependencies? It doesn't require anything. It's a self-contained binary for your operating system. So there's actually nothing to install. In this lab we're just going to download that binary and add it to your path, OK? For Linux and OS X, it's very easy. You just change the path. If I go back here to the Rocha document. You just add it to your path. On Windows, changing your path is considered an advanced topic, OK, according to Microsoft. Well, of course it is. And so I gave instructions on how to do it for Windows 10, but for other versions of Windows, it's different. So I just link out to blog post on how to do that. OK, so to verify that you have this lab completed, what you can do is come to your command line and type oc-version. And if you get this, it doesn't have to be the same versions. Yours will be slightly newer than mine. You know that you have the oc tools ready to go. OK, so I'm going to give everyone five minutes to do this when you have problems. Just raise your hand and me or Graham or Jorge will come around and help you, OK? Is anyone else having problems downloading it? It doesn't matter. Oh, because it says ocv111. Yeah, that's the latest. I'm using an older version. That's 3.1, that's obviously an older one. Yeah, I'm using 3.1. Je to skala, že je prostě tak mon, mon, mon, mon, mon, mon, je ten nejlepší. Už předtím, když to věděl. A to go je komplevaný nezvy. A vlastě kompleváste 4 chodí, že taky, který už máš nejdepratovaný. Je to super. Je to to nejná čísto, pro kdo je to přijde. Jsme ti nic nejde. Musím pojď. Ne, no tak to není takoko ka soustějení. Ale si ti být kde jsem to pokladávalo to si velkou. A to sdráku to hóch 같아서. Je to sáhalo. Já mám vz'emlíci těžké klienttice. Já si tam zvíď, že mám vz'emlost svolíček. To je třeba. Máte to. To je to, co můžete vidět? Dysklamer. Někdy jsem testovat tohle největné vývětní vývětní. To jsou vývětní vývětní vývětní vývětní vývětní vývětní vývětní vývětní vývětní vývětní. A to bude možno vždyť, že to tělo, protože to je skvělá cíle. Někdy jsou vývětní vývětní vývětní origináři a největné vývětní sebsy. Někdy jsou vývětní sebsy. Přesně jen jak se to vyštěl? Děkáte, se můžu dělat. Děkáte, se se svojící. Děkáte, se se svojící. Smokedesting the environment. Ok, this is where we're actually going to log in to OpenShift for the first time. Ok, this is the URL. Is there a whiteboard in here? There is. Is there whiteboard markers? No. Pretty short URL, right? Sorry, I didn't make it. Ok, so in this lab we're actually going to log in for the first time. But in order to do that, you're going to need usernames and passwords. Ok. I created one for everybody and this is going to take us five minutes to get through. So what I'm going to do is just point and tell you your username, ok? I tried to print some stuff up but it didn't work, ok? So is anyone not going to be doing the labs? Ok, so if you're not doing them when I get to you, just tell me and I'll skip past you, ok? So you, user, all lowercase and then a number. So you will be user 01. Ok. User 02. User 03. User 04. User05. User06. User07. User08. User09. User10. User11. User12. User13. User14. User15. User16. User17. User18. User19. User20. User21. User21. User22. User23. User24. User25. User26. Jo, tam by třeba napset hodnout do bus, so. User27. User28. User29. User30. User31. User31. User31. User31. User31. User31. User31. User31. User31. User31. User31. User31. User31. User31. User31. User31. Co se cítíte? Čo je to, co se vypěhám o složství? OCLogin-server Equals HTTPS OpenShift-master.devcom OpenShift3RoadShow.com Už se s námi z?] Už se s nám leader každou, co už se zavodu dneří. A to můžeš mít na měho pasvory a jsem si říká, že je devcom. A můžete se vzítiť jedný projekt, úžasný, a to je úžasný náš náš smok. To je závodný smok test, to je to, co máme. Jsme 10 min, závodný, nezávodný, nezávodný, ale můžete se vzítiť jedný náš smok. Vzítíte jen důležit. Jsme jen závodný, 1-0-0-0-0-6-0-0-0-0-0-0. A to je to, co máme vzítiť vzítiť, že můžete se vzítiť, že jen náš smok, a závodný heating is třeba se tam právodný, abychom nás nesilakvá, který říká, Když jsem vždyčil na uvězčí, to se zvukává několik zvukování. První je zvukování na zvukování. Vzluškaní zvukování na zvukování na měj kod. Takže, když jsem vzlušal na zvukování na internet, se zvukování na zvukování na měj pod. Co je pod? Máme dvě závodky. A pod je závodek kubernities. To vždyč jen návodský kontainer. Závodský kontainer odměrí závodský kontainer a vám vám závodský kontainer. A závodský kontainer je závodský, jaká závodské kontainer je závodský. Představící se, že máte než jedný docker kontainer v tom hodinu, takže když jsi chtěl, když jsi chtěl, když jsi chtěl, když jsi chtěl, když jsi chtěl, když jsi chtěl, když jsi chtěl, když jsi chtěl, když jsi chtěl. The reason we say that's bad practice is because one of the benefits of running a container platform like OpenShift is the ability to scale pieces independently. And you scale based on the pod level. So if I had my web server and my database in the same pod and I only wanted to scale my web server, I would have to scale them both. Does that make sense? So if you separate your database into a pod and your web server in a pod, you can scale independently, maybe you have heavy computations in the database, and you want to scale that up and have more replicas, then you can do it that way. This route, this entry point into the load balancer gets created for you by OpenShift when you create something, we'll get into that. Let's see. It uses this Docker image, user zero zero smoke. So we'll get into this as well. Every time you create something in OpenShift, we build Docker images on the fly for you and push them to the registry. These are just standard Docker images. We have builds and the ports, OK? So that's all I'm going to talk about right now. We're going to get into all of this stuff in more detail in just a few minutes. So we'll give everybody another five minutes here. Is anyone having problems logging in? I know, it sucks. There's nothing I can do. I have a hard line, you can come up and use the hard line. Yeah, come on up. Yeah, just plug into this one. It sucks. I'm actually using my phone. I gave up on the conference Wi-Fi. Isn't cloud awesome? It's all dependent on the network connection. I love it. Especially on a trade. I will say this though. Even though using stuff like this, you are dependent on the internet and sucks, I kicked off a build of a Java EE application the other night. As soon as the build started, I just shut my screen, because I didn't need to watch it. So that's pretty cool. Here's the chair. Now that you're on the hard line, you have to set up a Wi-Fi connection for everyone based off of your laptop. So the applications? No, you didn't finish up what you were using. What was I saying? About starting the build of Java EE. No, so I started the build, and then I just shut my laptop, which just connected the internet, and my build was still going, because it didn't have to be connected while it was happening. OK, does anyone need more time on this? OK. Oh, this is going to be... I have to go like this. OK, so let's go to the next lab here. All right, so the next lab is deploying your first Docker image. OK? How many people have never deployed a Docker container before? In this lab you will be Red Hat, Certified, Docker, Deployment, Engineer, Cloud Specialist, level 7. OK? And I can print it. Level 7, and I'll print you up a certificate. Do you want to do the password? Did you really set up a... Yeah, it's a hotspot. Oh, he did really set up a hotspot, so you can connect to his if you want. Does anyone want to see something? I'm just sorry. The university really asked us not to do this so please don't... I really don't just apply for the certificates. OK. Moving on. We haven't heard that. You might have doubted. Do you... This guy, I can't give away USB sticks. We can't set up hotspots. What? OK, turn it off. OK, so in this lab, one of the cool things about OpenShift is you can deploy any Docker container or Docker image. If you're not familiar with this thing called Docker Hub, it's basically kind of like GitHub but for Docker images. So anything you would want in the world is probably already being created out there. And so we do support the ability to run images straight from Docker Hub with some restrictions. OK? So the environment that I created, I set a setting that does not allow Docker containers to be run from external repositories if they run as the root user. OK? So unfortunately, that's quite a few Docker images today run as privileged users. If you do want to allow that, you just turn it off. There's just a little setting. The reason we don't allow it by default is because a study was done by a company research that found that just over 40% of the official Docker images so official meaning MongoDB from MongoDB the company itself, or Fedora from Red Hat over 40% of the official images had known security vulnerabilities in them and they run as the root user. So we just decided by default not to allow that and then to let the users decide whether they want to allow that or not. So that being said, we are going to run a Docker container straight from Docker Hub down here towards the bottom and we're going to deploy the famous Kubernetes guestbook application. So we're going to say OC new-project, remember to use your username here call it guestbook and then all we're going to do is deploy the new app Kubernetes guestbook and what this is going to do is it specifies the namespace you can think of that we're going to pull this Docker image from and the name of the Docker image. Kubernetes is the Docker Hub user ID of the Kubernetes project and so we're going to know that we don't have this image in our registry so we're going to go out to the public Docker Hub registry, look for this user and at the once you get this RAM I believe I have this Docker image cached so we're not going to actually hit the public internet to pull this down otherwise it'd be too slow you can see that down towards the bottom let's see what I'm doing here that we're going to have this guestbook application running, okay however it's not going to be accessible yet because we're not going to create a default route it's going to be running but it's not going to be accessible on the public internet until the next lab so I'll give everyone 5 minutes to do this lab and I'll try to do it here as well so I'm going to say OC new project I'm user 00 and I'm going to say guestbook so now I have this user 00 which I should be using now I can just say OC new app pass in kubernetes-guestbook this is going to pull that image down and run it okay so now I have this thing running OC status and I have a deployment running if I go to the web console here and go into my guestbook project I can see that I have a deployment I guess it's also possible to make it using the web console it is it is you just go to add the project put that button actually in this version that I have deployed you cannot deploy a docker image from dockerhub on the web console in this version you can in the most recent one does anyone need more time on this one it's fairly quick okay let's move on so now we have this guestbook application running but we see right here that there's no public URL it just lists the service and so what we need to do is expose this service as a route so to do that what you can do on the command line is do oc get services or sbc for short and this will list all the services you can think of a service as the load balancer it's the entry point to your application and we want to expose this as a route so to do that all you have to do is this is the name of the service as expose this service so you say oc expose service or you can use sbc for short and say guestbook and this will create a route for us and if I go back to the web console you'll see that it automatically updates with a publicly accessible url so if I click that we can see the guestbook application now it's not going to actually work right now because the guestbook application uses a redis database which we don't have yet so I'll let everyone get that working just to make sure that you're finished with this lab you should see this page in the browser I know it's a beginner question but you already mentioned openshift origin which is the source code for the openshift platform and the openshift enterprise I mean like is there any the openshift enterprise is it just the cloud so the questions already deployed to what's the difference between openshift origin and enterprise and maybe are there any other openshifts so there's three actually three versions of openshift there's openshift origin which is the upstream openshift project and openshift enterprise those two are exactly the same except for this this says openshift enterprise and the open source version says openshift origin other than that they are exactly the same the only difference is openshift enterprise when you purchase it comes with support but I still have to download it and I'll have to deploy to amazon or my local computer you still have to run it yourself we also have what's called online now that makes sense if you go to openshift.com this is openshift online this is where we provide the hardware as well this is version 2 right now still version 2 version 2 we have openshift online if you're not familiar with it the reason it's still version 2 is we have what's our latest number 2 million applications running on it 1.8 to 2 million applications running on it we process over a billion requests per day just to the public red hat cloud through openshift and to migrate all of those users over it's it's not an easy task so what we are going to do is just stand up a separate environment called openshift online 3 and we're going to what can I say about this it's going to be coming very soon in a developer preview but we're not going to self migrate people over we're going to let them do it on their own time and then we'll eventually turn off the current openshift online in like a year or two from now once everyone is migrated but it still will be free to use when we push it out there and then openshift dedicated is if you're a company that doesn't want to run your own hardware red hats sysadman manages your openshift environment for you so there's actually four different but it's all the same code except openshift online will not have an authentication mechanism it will require developers authenticate with github or twitter this recent news that you will somehow work with google on their cloud platform how's that going to work out so the question was we just had an announcement with google that we're partnering to run openshift on google computer engine their gce cloud so that'll mean that openshift online the version 3 will be running on google's cloud and not amazon's today it's on amazon and then if you want to use openshift dedicated you'll have your choice of aws google compute engine or microsoft Azure will run in all three of those and currently does that mean that if i use the openshift online the free version you're actually paying for me the amazon so if i use the free version of openshift online which anyone can use you get up to three gears or gig and a half of memory do we actually have to pay amazon for that yes we do plus about seven dollars a month per user thank you very much man yes you can pay me afterwards i'll get reimbursed so a lot of people ask why we do it because we have a million 1.8 it probably is 2 million now applications running out there why do we do it there's a lot of money for us i know we're not one of the top amazon e-c2 users netflix probably kills us on that but it's a significant amount of money that red hat just pays for free hosting for people i think we do it because it encourages developers to work on open source software and be able to publish their stuff quickly in reality though a lot of it's bitcoin mining and stuff like that that people install on it that we have to turn off but what we really hope is that developers will start to use it and then want to use it inside of their company as well i have 57 software updates that i need to do so let's move on so we have this route now the next thing we're going to talk about is scaling and you can scale in one of two ways i show in the lab manual how to do it via the console and i am going oh and i also shared how to do it in the web UI very easy to scale up in OpenShift to my guestbook application and let's scale it up to 4 and we'll see here in a second that it's starting to scale and now we have four containers running all load balanced so pretty quick to scale these things up my only ask is that because this is a shared environment don't scale up to like 200 or anything because it will bring the environment to a crawl because there's only five servers but play around with it scale it up, scale it down i believe in the workshop i provided a command to randomly kill maybe i didn't i have a shell script that randomly kills like two or three pods and you can see them come back so here just delete one manually and you'll watch it comes back instantaneous because under the covers we use etcd have you heard of etcd? etcd is a key value database key value store and so we keep the state of what the number of pods should be in etcd and then each we check and if it's ever out of sync or out of true it's not true anymore we immediately fix it it takes about a second to realize that something bad has happened and to recover from it so play around with that delete a few pods, watch them pop back up can you say it louder? what's it all about? oh it's whatever you mean for the placement? it's not random it's the default kubernetes scheduler if it automatically goes if you scale up to two containers it automatically first goes to a different physical host and it does that and then it does a least used algorithm as well even if the next host even if the next place is another physical machine if the current host is less utilized it puts it there but it's a default kubernetes scheduler I've got an error saying that deployment config guestbook can be updated the object has been modified to be used it seems like that is anyone using user 1? what? yeah that's the one because someone I just hit the button and someone scaled it up automatically to 4 thanks for playing you can use user 0,0 for user 50 works now mine just too maybe I'm using are you using user 0,0? no that can happen sometimes to depress it really quickly oh is that what it is? so it's halfway through oh I see okay what grammar saying makes sense if I do this it's going to 6 but then I do this and sometimes the state is changing does that make sense? it's like a race condition I did the button only once but okay that's why you should always use the command line oh can you? so I always get asked can you scale down to 0 you can, absolutely you can scale it to 0 so now I have 0 pods right so I'm going to give everyone just a couple more minutes to play around with this to kill some pods and then we're going to move on to the next question about scaling in origin with the latest merge we incorporated the first code that will allow you to auto scale so right now it's manual scaling you have to click the button or you have to use the command line so we do have the first auto scaling stuff in the open source repo now that will automatically scale on is it CPU utilization okay CPU utilization so you can set some rules and if your pod is using too much CPU it will actually scale out and start sharing it that way now the goal for that is to have it be a pluggable scaling architecture to where you can write your own scaling algorithm based on HTTP requests or disk.io or whatever the case may be so it will automatically scale up and down who in here loves Java alright so we are going to be using Java for this next part but you don't actually have to touch the code okay alright so what I've done is I have created a geospatial application for mapping coordinates on a map and I'm going to show you the application that we're going to be building so let me go to my web console and let me go back to my projects and go to MLB parks this is a Java EE application and a MongoDB database MongoDB supports 2D spatial queries box queries via JSON so that's why we're using that so if I click on this application all it is is a map of the world and it defaults to the United States because what this application does is maps all of the baseball major league baseball stadiums in the United States okay this is a very pluggable application you can put in any coordinates you want map soccer stadiums or whatever the case maybe or train stops or whatever okay when I zoom in or out it makes a rest call based on the longitude and latitude from the bounds of the browser so it takes the coordinates from here here, here and here and does a geospatial query based on those coordinates to find what's within it and so you can zoom down all the way it's just like google maps except open source okay so this uses a tool called open street map which is a map of the world that you can use it also this web UI is leaflet leaflet js and then the back end is all written in java so if I scroll all the way down to Seattle we can should eventually see the baseball stadium here there it is it's called safeco field if you look on the little pin it will tell you the team name their payroll and what leak they're in so every time I do this it's making a rest call that we're going to be creating I should have centered it on Bernou let's go over here we've got loads of baseball stadiums here there's nothing over here is this it? am I in the right state? where's Bernou? move to the right here we go down down a bit too much oh there's Bernou here's Bernou we're somewhere here so you can do it all over the world so you can use this code to map whatever you want so this is what we're going to be building let's go back to the lab the first thing we're going to use what's called source to image so source to image is another open source project that we created on the OpenShift team because we feel that developers like to write code is this a fair assumption? and they don't like to do docker builds all day long and so what we created was a source to image project that will take a get repository or source code and a image name maybe like Jboss or Rails or Sinatra or Node.js or some language in runtime we then take the source code provided which is a get URL a base image we build the source code build a new docker image on the fly that has your source code in it and push that image to the registry so developers can actually create and deploy docker images or anything about it and that's what we're going to use in this lab is the source to image stuff we're going to be using the Jboss EAP64 or something base image and then layering on top of our source code it's going to run a maven build which is the Java build system it's going to take the artifact of that and inject it into the new container or new image and then we're going to run a container based off of that image when I'm developing when I'm changing the code I have to rebuild everything what language do you use? JavaScript for interpreted languages like PHP Node.js we actually have an R-Sync tool built into the platform so I like to develop in PHP and so what I do inside of my IDE is when I click the save button in my editor I have it run OCRC and that syncs my changed files over and so it's instantaneous for Java that's not the case because in order to do something like that with a compiled language like Java you're typically wanting to use something like Jrebel so you'd have to use something like that if you're not using that you will indeed have to run a new build every time and can you use Jrebel with OpenShift? as long as there's a Docker container that they support, yes we allow you to run any Docker container ok, so oh, there's one thing before we get on this lab because we are getting into these types of questions like what do you do when you go home today? so if you still want to mess around with this go to openshift.org slash vm so Jorge in the back of the room has created this all in one virtual machine that runs on Windows, Linux, Mac that has the latest and greatest open source code that is completely open you know how I said there was some security restrictions around running this route that's disabled by default in this so you can run any Docker container on it on your local machine just with vagrant with one command so that's when you would want to try out like the this is how I actually develop locally now, I just use this all in one image and use it as my development time so how often is that box we update it with every release yeah, with every release and so if you want more detailed instructions on how to do that you remember that first blog post that we went to? that's what this blog post details so you can actually run this thing and so you'd want to come here and use that so I can just download that image and put it into the virtual box yes, yeah up and running it provides open chip and the rail based images actually I believe but I still need to provide some other host for all no, the way the host works is we use this technology not technology, this service called ZIP xip.io and so if we're in the console here, you can see I have a public URL we create one of those using xip.io so you don't have to mess with your host file or anything and you'll be able to access your applications it'll be available to any computer on your subnet I believe, is it subnet or entire network entire network but it won't be available to users outside of your network so let's actually get to building this application we are going to use the source to image here's the repo I want everyone to use and in this lab you have a decision to make I would prefer that you fork this repo the reason I want you to fork it and use your version of it is because in a later lab one of the great things about source to image is once you commit a change to your repo OpenShift automatically can kick off a build and know that something has changed and automatically rebuild it if you want to see that functionality fork the repo and use your own version because I'm not going to accept 50 pull requests to see this today and then you can change your repo and see an automated build get kicked off so fork the repo and provide that as the let me go back here let me show you one thing here and I know people are going to do this but when you create your app where is it make sure to use your repo and not mine and also make sure that you replace this your user with your actual github user ID if you fork it this is not your OpenShift user ID and it's not your user it's your actual github.com user ID or you can just use mine if you don't want to fork the repo does that make sense? Is everyone familiar with github? I normally teach this to corporate developers who work at a bank 9-5 and don't understand github so hopefully you guys do but if you don't let me know is it all the working with gitlab? oh yeah it works with any git repository it can be a private, it can be gitlab, bitbucket, whatever and if you don't one of the undocumented features of OpenShift, if you just have code locally, you can actually do oc this is pretty cool and let's say I was working on PHP that can pass until the dot and it will take whatever source code to my current directory and use that does it support secure shell authentication already? well, not secure shell what we have is this oc rsh which does a remote shell but it's basically the same as meant for the git checkout oh yeah, of course what's your logged in? yes just click that button and now it's this and so this is your repo very good yes i have a very basic question so where does OpenShift deploy the application? so the question is where is this stuff actually getting deployed what does the hardware look like for this today, this workshop the hardware is 5 EC2 nodes that have 8 gig of memory and 4 CPUs and so we support up to 40 pods per host so you're getting one of those hosts and your pods are getting spread across so look at OpenShift do you use any hardware you want? oh yeah, you can run OpenShift in a virtual machine OpenShift actually also runs as a docker container so if you have boot to docker and you want to run OpenShift you can just do OpenShift, is that the docker thing? and then you can run it inside of a docker container so this guy up here is already done because he's on the hard internet ok, so the one thing with this lab if you're not familiar with Java why do people hate Java so much? i absolutely have no idea because it takes forever to do builds ok, so this build is actually going to take about 5 minutes because i'm using the Maven system and it basically downloads the entire internet as a dependency because i have all of these dependencies that depend on other things and so it does take a while to build so you can look at the logs in two ways i don't believe i show the logs in this lab from the console but i really like the new logs in the console once you get it deployed you can click on your pod here and you can click on logs and this will open up the log and you can follow it so you can just click on follow and it's basically doing a tail on the logs in the console i prefer that way so it's up to you and you'll know the build is finished when it says pushing to registry i thought it would be faster and before tomorrow i would be i mean i would share it if the place is the same how does this end there what time is the the server how long did it last oh let me check 12 minutes 12 minutes that's it this is a 10 minute break ok, i'll wrap up in 10 minutes sorry we're just getting to the fun stuff yes so the goal of this lab for this workshop is to put you guys through a bunch of pain right here and then to have everyone hate me at the end because we can basically do all of these in one command and i'll show you that in just a few minutes ok so we can just finish off the lab so that we can see it these labs will be up and running you can work on them all weekend i mean like can you finish it off before our in front of us so we can see what's actually the goal of it ok, so i'll just walk through this real quick what we're doing right now is we're deploying the java application but it doesn't actually have a database yet so in the next lab we're creating a Mongo database Docker container and the most important thing to get out of this lab is that for authentication when you're using Docker containers it uses environment variables by default that's kind of the standard with Docker containers and so when you create an application we have this thing called a deployment config the deployment config is the truth of your application and when you build up and down in the web browser what it's actually doing is modifying this deployment config all of your running pods has to match this deployment config and so once we create the database i just set some environment variables on the deployment config and that ensures that every pod i spin up after that has those environment variables in it so if i scale up to 5 EAP servers each instance of that has these environment variables to make that database connection does that make sense so we link them together here we then look at the actual deployment config and this is what the environment variables look like nothing special and then i say OpenShift Magic here and that's because once we change this deployment config OpenShift realizes your current running pod that we're building right now no longer matches this deployment config but it doesn't have those environment variables in it so what it does is it kills that and spins up a new one that's correct and then your application suddenly starts working and it loads the data in and all this stuff and it's really cool how it works but it is a pain to get all set up and i link into the source code that shows you how that works i show you how you can SS or not SSH but get a shell on your container and then run the Mongo binary client tool and lastly once you have this application all up and running which looks like this as a developer you've now done the effort to get your project running but you want your teammate to be able to work on the same project with you but you don't want him to go through all this pain that you're a team of like five developers and you all work on two or three projects and you hire a new developer normally it takes that new developer a couple of days, sometimes a week to get their environment set up and so what we provide is this thing called a template that you can create based off of the application once you have it running and so this template is really the real power of OpenShift and so instead of creating all of this Java EE servers cloning forking the repositories what we can actually do is create a new project and I'll show you this go to my terminal here I can say OC new project user 00 template and I can paste this command in which is OC create project from a file and a file can also be a URL and I'm passing in this JSON file that is a template that defines my application it's going to say here's the get repo that has the source code it needs MongoDB randomized the username and passwords and then modify the deployment config so it injects this password into every new pod and I'm going to hit enter here and now I have this template created ok so if I go back to the web console if I go to my project overview I'll see this template project if I click on add to project we see that my MLB parks app shows up in this list and it just got reordered so where did it go you might see it here I saw it when I first loaded it here it is I just searched for it so it actually adds it in the web a UI as well and so then it can be used but only in my namespace there's this concept in namespaces the global namespace for everyone is called OpenShift and so if you really wanted this to be available to anyone on the platform you would have to add it OpenShift namespace by passing in dash in for namespace and say OpenShift this is going to give me an error because I don't have permission to do that I'm just a developer I can't add things globally to the system so you need to get your sys admin to add this globally but because it's available to me in my project to create all of this over the next couple of labs I can just say OC New App MLB Parks and it searches and sees that there's a template that I've loaded into the system and it's going to create all of this stuff and then in a couple of minutes my entire project will be created and you can see that it randomize the passwords and all that stuff and so that's really how we envision teams using this if someone putting forth the effort to build out the project from source code then create in a template that others can use so we're going to end there and I'll be here all day for questions and then I think the next lab is Graham Graham is on my team he is also the author of ModWizgy the python server and he's going to be talking about the python development in OpenShift which python is not really good ModWizgy he also calls it MaltWizgy so there you go alright thanks for coming everybody I appreciate your freedom oh so you're out oh it's kind of cool what? it's like 900 people already have this thing yeah so there is some kind of follow-up on this workshop follow-up with content development this is just the one so so oh yeah we're building all day except the next the rest of the guys are going to be building on top of this stuff so so so so so so so so I had a great time so oh do you know Armin? yeah so so so he's already telling the owner a mělo jen dnit... No, no, no, no, no, no. A, jo, chvěl jsem si dnes... No, no, jo, jsem ty můj káben. Ah, chcete, že jsem jen dnes? No, no, no. A kdo? A kdo? Mám, to byla velmi velmi velmi velmi velmi velmi. Ale vám všichni všichni. A kdo? Tak, všichni všichni všichni, Bylo to výstřední. Výstřední online máme, že jste výstřední, ale jsme vždyžíte výstřední. Výstřední je výstřední, který má měl výstřední server. Já byl výstřední, že jsem měl výstřední, nebo výstřední. Ale to je výstředné, že mám výstřední, které se výstřední. Já bychom na to dát ve měr díl. Věstřední měl výstřední. Let třetí. Věstřední výstřední. Zvízol, že na to tam mám. Teď prostě se měl hlouký výstřední. ... Jem výstřední. Už se početnit. Máte to začnout. Já nevím. Já nevím. Já mám můj personal nejlepštým, když můžete připravit. Já mám můj starový, když můžete připravit. Máte to začnout. Máte to začnout. Máte usb, ale můžete říct, že máme nějaké zvuky, když mám nějaké zvuky, když můžete připravit. Vysvupact sneho former a hに celuimu jsou na další hra voila a nevτέle ruled, bylU疾í. Ev van se ne, už jtom nebo ekstremolivou. Je tam když můžete připravit. My vyrodaped. Přijbyc zatitl pod celý jebi s raclou s Burg Wonderful. Znam se na přidě depressingí. Jeho je nejlepší, že si jste u zvědětou u prvního coboje a máte se výstřit a půjď se nejlepší nejlepší. Ale než se nejlepší, že jste si nejlepší, že jsme vlastně se dělali, že máte tomu informací a potom se vytvořil a dáme velice, když vysvědět, když bych jste bohával. Když se to vyvědět? Já bychom se dělal. Já myslím, že se to všechno, když nejlepší. Bychom se potřeba? Mám v tomto ráděně, v tomto ráděně byl vlastný s deského výděnce. O, tak, máme nějaké. Takže, když je to, když se měli někdy přijet, nás kterého nám povedou, když jste v předném sdězením výděnce, kde máte vytvořit nájebět, když měli si na sned, když ty jsi měli. Mám teda vytvořit někdy, když nám je nejlepší výděnce, takže máme vytvořit někdy pověděnce, ale můžete tak vždyť až kastit to dál vláček, které je město věděl, až se jim vzlávíš, když ti to chtěl. A když si všichni vůstří, když se jim vyští, když se jim vzlávíš, když si jim vzlávíš... Byli to všichni jichni vzlávíš, když jsou všechny ráda a můžete se týstře? Tak, tak. Až se jim vzlávíš, když jsou všechny ráda a můžete se vzlávíš? Já si viděte, že to... Máme všechno, že vlastném věděte, že se to nezapravilo.