 Hello in the last two videos you have seen how we can take an existing Docker image and Deploy into OpenShift. We looked at an example of an application where You took a MySQL database Docker image and deployed it into OpenShift and then we took a PHP application which was also built as a Docker image and then deployed into OpenShift, right? Now in this video what we'll be seeing What we call S2I process which is S2I stands for source to image conversion And this is a process where OpenShift will take your application source code and Build a Docker image for it. It you'll see how simple it is to do so. I'm going to do this using a web console So let me log on to the web console first. This is an OpenShift beta 4 installation I'm logging on to the web console Now let me first create a project. A project is a placeholder that it's it's kind of a namespace which includes all the The application that you want that you want to run So I'm going to create a project Now that the project is created you can see that the project is empty. That is nothing inside it So now let's Add our first component to it just like before we are going to create a MySQL database in this project and this time instead of Doing it in the vein which we did before where we were pulling an existing Docker image by using a command line by deploying an By deploying a part that runs MySQL Database this time what we are going to do is create it from what we call a template A template It describes a set of resources that are intended to be used together So when we are trying to quickly spin up a new application It's it's easier to use templates. So I'm going to select the MySQL template from here We are this template provides some parameters that you can pass So I'm going to edit these parameters I am going to give a password for my MySQL database a database name Let's call it sample and a user name I'll just call it here You can also set up some labels and I'm going to add some labels here. I Will say the name of this component is a database So Add the labels and then I'll say create now this this will be created as part of the my php application project So what it will do is it will spin up a MySQL database that runs as part of this project So as you can see on the console, it's actually spinning up a new MySQL database spin up a pod that runs a MySQL database and it frontends that part with a service a database service and this database service is routing traffic on This IP address and on port 54 34 by default MySQL uses 3 3 0 6 and the part 54 34 is forwarding from 3 3 0 6 so as you can see the database is now running and It is frontended by this service now Let's explore this web console a little bit if you click on this browse button You'll see different kinds of things that you can look at Let's look at what pods are running. It's running a database part with this name database one XNS 8x I can also view this from my Command line if I say OSC get parts like before it will show all the parts that are running So the same database part is running here. You could also see the service and The IP address of the service here and the ports Exposed by the service now I'm going to get inside this part and add some data to this database like before this time I'm going to use OSC exec command This will allow me to enter inside the part I'll supply the pod ID and I want to enter the bash bomb so now from my local machine I am entering inside the part and I have the bash prompt displayed here now Let's access the my sequel database to the IP address of the service the port number exposed by the services 5 4 3 4 Now I'm locked to the my sequel database If I say show databases here It should show The sample database that we wanted it to create and then I'll use the sample database Let's add a table and insert some data Exit this part. This is just to show you an example of how you can enter Into a part and from your desktop now that we added the database It will now add a front end to a front end application to access this database I have my source code in a git repository As you can see the source code is in the form of a PHP file. I have a simple PHP. This is the same as what we have used in the previous example it will connect to the database and It will display the list of users from the users table as simple as that. So what we are going to do is Supply the source code to open shift and let it Build the image from this source code That's the reason why it's called source to image conversion select the github's URL and I'll go back to console and This time I'll create by using this GitHub URL. I am selecting a builder image and since this is a PHP application I'm going to select the PHP builder image. I have to name this application I'm I'm good with dv test as the name and There are a few other parameters that you can set and this this is still evolving As of now you can create a route for this application, but you you can't edit it from the console yet So we are going to add that route manually outside You can provide some deployment configurations We are saying that it's it's going to auto deploy when the new image is available the build information It has configured that the source code is the github repository URL that we provided and it'll automatically build a new image when the code changes its CS and It's going to automatically build a new image when the builder image changes as well So whether the source code changes or the PHP itself changes It will trigger a new build and Let's all let's add a label here We'll call it PHP front-end And then I'm going to Say create Now what this does is it will spin up this DB test now if you look at the Builds here you have a new build called DB test creator and It is pointing to the source source repository, which is on github and I can start a new build now This process has started a new build with the name DB test one and the build is running here From the command line if I say OSC get builds, I should see the same build again here And if I want to see what is going on I can say where see build logs to look at the build logs it has actually pulled the source code it has converted the The source code and took the builder image and it Built an image for for my application now. It is trying to push this darker image for this application into a Local registry that is running in my open-shift environment. This is the local Docker registry that's in my environment. This is taking going to take a minute. You can see this is this has successfully pushed the image and Once this image has been pushed the application image has been deployed into a pod with this ID that you're seeing here and This application is now running in a pod on node 2 right now So this is the process of source to image where you give a source code and that source code has been converted into a Docker image it has been registered inside the Docker registry that is running on my open-shift environment and It has automatically taken that image and deployed it into a separate part Now this part should now talk to the database part But before we check that we'll have to add a route to this application. Let's look at the services here You can see that the database service from before is still there and there is a service for the data DB test, which is the Frontend that we created but It by default it adds a route here, but this is not this is not useful at this point So what we'll do is add an additional route for this application that is externally accessible I'm going to add this route manually for now and this application will be accessible using this URL by issuing this command I have Created a route for this application now now You can see that the route is now added now. Let's access this application using this route and Here are the two records from the database What this means is the front end code that we just added the DB test dot PHP is connecting to the database And it has accessed the two records that we added before so to summarize what we have learned in this video today we have created a project on using open shifts web console and We have added a database in that project by using templates then we have Created an application front end that talks to this database by using the source code and we Open shift by using the source to image conversion process Open shift has converted that source code into a Docker image It pushed it into a Docker registry running on open shift and then it deployed that Docker image as an application on running as a single part in OpenShift Thanks for watching