 Hello everybody, this is Grant your friendly OpenShift team member in today's video I'm gonna show you how to use github webhooks Even if you're using the great all-in-one virtual machine or the red hat CDK All right So if you don't have a local OpenShift environment running on your machine now's the time to get it up and running ladies and gentlemen So head on over to open shift org slash VM or go red hat calm and download the CDK All right, so I'm gonna be using the all-in-one today, and so I'm gonna switch over to my terminal and Just before you start wondering wait a second Grant's using Windows. I normally see him using either Linux or OS X Yep, that's right. I am using Windows 10 today Just to show everyone that the user experience is the same Regardless of the operating system that you choose to use for your development environments. Okay, so I already have the Vagrant file up and running so to stand up my own OpenShift instance all I would have to do is run a vagrant up command And this is going to spin up the OpenShift all-in-one virtual machine and configure it for me I have allocated 16 gigs of RAM to my all-in-one image just because the machine I'm working on today has 32 so why not? I am gonna do this in real time. So no parlor tricks today So one thing to note is on my Vagrant machine here We'll probably see an error message when it gets all done just because of a SSH problem that I have going on right now But at the end of this I will have a OpenShift instance spun up locally Okay, so now now we should be good to start using it So let me pop over to my browser here, and I'm gonna go to HTTPS 10.2.2 8443 And I'm gonna log in here is UltraHook and use UltraHook as the password you can use anything you want I'm gonna create a new project, and I'm gonna call this UltraHook PHP and we'll just call this UltraHook PHP and I'm gonna click on create and then I'm gonna select use PHP 5.6 But anything will work if you want to use wildfire for Java EE based stuff So I'm gonna select PHP and then I'm gonna call this my UltraHook and then I'm going to get a get repository URL This is just a simple PHP app So I'm gonna copy that over paste this in and pow Bob's your uncle I now I'm using the source to image flow to clone that get repository and it's going to Create a Docker image on the fly and then deploy it as a running container inside of a pod using Kubernetes Alright, so while that's going let's pop over to UltraHook and let me explain what this is UltraHook is a free service you can sign up and create a namespace and get an API key and then it'll allow you to set up a proxy basically To accept external requests and then proxy that to an internal endpoint and because the OpenShift CDK Runs on 10.1.2.2 and the OpenShift all-in-one Runs on the 10.2.2.2 private network addresses That's not obviously accessible from the outside internet So we need to use a tool something like UltraHook in order to proxy those requests Now I already have an UltraHook account and an API key again. It's very easy to sign up Just just do so Okay, so here's the source code that we're going to be working with today github.com Gshibley simple PHP and let's go back over and check on our build here We now have this application running and here's the addressable URL again This is only available on my local network So if I click that we can see that this says this is the best PHP web app in the universe on OpenShift 3 on YouTube well that doesn't make much sense right so what we want to do is change the source code So I'm going to go back to my github account here, and I'm going to copy that repo URL and I am going to clone this repo So let me just paste that in clone it here CD simple PHP and I'm going to VI this index PHP file and I'm going to just remove this last bit here and We're going to save that now what we need to do is set up our UltraHook so I switched over to a new terminal here and I'm going to say UltraHook and Then I'm going to just call this GrantHook and then I need to paste in the internal URL that I want a proxy to So what I'm going to do is go back to my OpenShift web console And I'm going to go to browse and builds and we can see I have one build running here I'm going to click on configuration and over here is the github web URL And as you can see it's on the 10.2.2.2, which is private. So I'm just going to copy that And I'm going to go back to my command line and I'm going to paste that in so that's going to create a web hook from GrantHook over to this URL and Then I'm going to go on over to github click on settings on my project click on web hooks and I'm going to delete this web hook And I'm going to click on to add a new one. I got to get the URL So let me go back over here and I called it GrantHook so I can just say HTTP GrantHook OpenShift UltraHook.com and all that's explained when you sign up for the UltraHook service And now anytime I do a push it's going to create a build for me automatically in OpenShift So let's go ahead and try that out. I'm going to commit my change here Changed index and then I'm going to push that Let me authenticate to github type the wrong password in there Okay, so now that's going to be pushed up to github and the new build is going to be created inside of OpenShift And now let me go back to the main project page And we can say sure enough that we have a new build my UltraHook2 is running Bam look at that Bob's your uncle and it's already called the new repo It's just pushing the image out So let's go back to the overview page and we're going to see this little deployment number change from one to two And so we'll give this just about 20 or 30 seconds for it to actually complete Okay, it looks like the build is finished here and So now we you saw that nice rolling the deployment there it created a second one switched over the route And so now we have our new Application up and running build automatically using a githook even on my local machine So let's check it out sure enough We can see that we no longer have the YouTube here and let's just scale There's bad boy up to five just for fun. All right, that's it guys. Hope you enjoyed the video. Thanks. Bye