Jfrog | Jfrog Artifactory | Jfrog Artifactory Tutorial | Artifactory Tutorial | Intellipaat

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hey guys welcome to this session by intellipaat so in this session we're going to comprehensively learn about the j frog artifactory so before moving on to the session please subscribe to our channel so that you don't miss our upcoming videos and also leave a like if you enjoy our content now let's take a quick glance at the agenda so we'll start off by understanding what is an artifact and then we'll understand what exactly is an artifact repository once we establish that we'll start off with what is jfrog artifactory and then look into the use cases of jfrog artifactory once we learn the theoretical concepts we'll move on to the installation of jfrog artifactory and once we completed it we'll do and hands-on using it and that would be the agenda for this particular session without any further delays let's begin with now let's get started what is an artifact and what is an artifact repository the files that contain both the compile code and the resources that are used to compile them are known as artifacts basically whenever a developer writes a source code he gives it to a build tool so that the build tool can compile as source code into binary code this is because whenever developer writes source code he writes it in the language that humans can understand a human language but machines can't understand that language to make it understandable for machines the bill to compiles it so that it's converted into a binary code that is ones and zeros that can be easily understood by machines when these binary codes are taken together with the dependencies and resources that are required to run it and put together into one file or packaged into one file that one file is known as an artifact basically these are readily deployable files like an executable in java an artifact would be a dot jar file or a dot wall file or a dot eer file dot jar files are basic java applications and dot war files are for web applications and dot er files are for enterprise applications that can be contained in egb containers in npm the current artifact file would be a dot tar dot gz file and in dot net the artifact file will be a dll file now let's go ahead and understand what an artifact repository is what is an artifact repository an artifact repository is a repository which can store multiple different versions of artifacts each time the war file or the tar.gz file is created it is stored in a server dedicated for the artifacts now how we normally go ahead with software development is that we write the source code and then we compile it and then the code is tested and then reviewed and then if successful then the code is sent for deployment but with the agile they can use there'll be a lot of different builds being made every day even within a single team and each time we change the code we need to compile the code and then deploy the build in the server but there might be a scenario where the testing team or the qa team will find an error in the code and now there would be a need for a rollback for this rollback to happen we would have to go back to our git or whichever vcs we were using and then remove the first commit and go back to the previous comment because we wouldn't be sure of what kind of error there might be in the latest version so we need to go back to the previous version and deployed that one again instead of doing all that what we could have done is we could have stored our artifacts in a repository and we could have deployed the latest version using that artifact of the latest code and if there was any error we could roll back easily by just going back to the repository and deploying the artifact that was previously used for example here if you see that there's an artifact version one that has been stored inside the artifact repository and then it goes for deployment and then artifact 2 is stored in the artifact repository and then it goes for deployment and same with artifact 3 which also goes for deployment now i suppose there was a need for a rollback because artifact version 3 has some error in it that can't be identified at the moment but the customers still need to use the app the application that is being used so for that purpose what we can do is instead of going back to our source code in our version control system and going back to the previous comment what we can do here is we can go back to the artifact repository and just use version 2 instead of version 3. so we could use artifact version 2 and then go ahead and deploy it it's as easy as that just going to our repository and selecting the previous version so the customer is still satisfied and we can look for errors in our new version three sources versus binaries now let's understand the difference between source codes and binary codes source codes are stored as text whereas binaries are stored as blog files source codes are difficult whereas binaries are not difficult what this means is that we can compare two different source codes as they're stored as text form whereas we cannot compare two binary codes source codes are version by content and binary codes are version by name since we can compare the different source code we can version them based on their content but this is not possible in binaries and therefore binaries are versioned by their name source codes are stored by overwrite but binaries are not stored through override so what this basically means is that in source while using source code when there is a need for an update the current file is updated by replacing the previous file whereas in binary while binary code is being used the current file will never be rewritten all the files are stored together so when there is a need for an update the current binary code will be pulled and the latest one will be pushed now that we have understood what an artifact is what an artifact repository is and the difference between source code and binary code we can finally go ahead and learn what jfrog artifactory actually does and what it is jfrog artifactory is a tool used in devops methodology for multiple purposes one of its main purpose is to store artifacts that have been created in the code pipeline another one of its purposes is to act as a sort of buffer for downloading dependencies for build tools and languages so what basically jfrog does is it acts as a google drive for our artifacts we can store whichever artifact we want in that and then pull whichever way we want now jfrog can be easily integrated in a code pipeline as you can see here what happens is first the version control will give the source code the latest source code to the build tool and the build tool will build it and then produce a resulting artifact which will be then be stored in jfrog artifactory and if deem worthy then jfrog will send it to the deployment this is all done with the help of the continuous integration tool which could be your jenkins teamcity bamboo excel deploy whichever which is software tool you are using for continuous integration now the first thing jfrog helps in is that it helps in storing readily deployable code so basically whichever artifact we create or whichever artifact is the result of the latest source code that has been compiled will be stored in the jfrock artifactory so like how we talked about an artifact repository this is the same function that jfrog artifactory performs the first artifact version will be stored in jfrog which will then send for deployment then the second one will be stored and that will be sent for deployment and the third one will be stored which also would be sent for deployment and suppose there's a need for rollback because there's an error in version three that causes the application to crash then we can pull back version three and then go ahead and deploy our version 2 again it's a simple process of just selecting it so this is one of the first responsibilities of jfrog that is to store all the artifacts which can then go ahead for deployment and the second responsibility of jfrog is to help in downloading and managing dependencies since jfrog will be connected to the build tool what happens is that whenever a build tool requires a dependency based on the source code usually the bill to download the dependencies but in this case jfrog acts as a buffer or a proxy for downloading and managing these dependencies so if a build tool asks for dependency to jfrog jfrog will get the dependency from a remote repository and then we'll store it in a local server which will be then used by the build tool to build the source code so those are the two responsibilities of jfrog first it helps in managing and storing artifacts and the second responsibility is it acts as a buffer for build tools to download and manage dependencies now that we've learned what jfrog artifactory is why should we use jfrog for devops so the first quality that sets jfrog on the stage for using in devops methodology is its high availability system stability and reliability with artifactory high availability the binaries needed are always available on jfrog once they're cased with it and there is a certain assurance for the availability provided by the company but the same can't be said about open source software which doesn't provide the same assurance so what basically high availability means is that whenever we are storing our artifact inside jfrog we have a certain assurance by the company that has created jfrog artifactory that is jfrog that our artifacts will be available all the time and since we would be paying them if you're using the pro feature or the pro version of jfrog then they absolutely have to give you the guarantee that all the artifacts that you need at the moment will be available through the deposit but the same can't be said with open case repositories which do the same thing because you can't ask them for an assurance for whether you will be able to pull the artifacts that you're stored in using their software at any time of point because their website may crash or their servers may crash and you will not be able to pull it and and you can't even blame them for this because you're using their software for free but since you're paying for the application that is jfrog artifactory you can have an assurance that is provided by the company that your artifacts will be available at all times and if they aren't then you can hold them responsible then the next quality is managing binaries across different environments as the number of projects in a company grow it becomes harder and harder to maintain the number of binaries each of them use to avoid chaos jfrog manages environments and the binaries which means is that if you have different teams working using different environments and storing different artifacts there's a probability that there might be some chaos involved that you might mix up some artifacts here and there but jfrog assures that this will not happen it has the ability to store different artifacts for different projects for different teams in different places so that such a thing does not happen the next quality is security access control and traceability since jfrog works on caching assets important to the company that is the source code of the software it keeps the system secure and keep track and keeps track of metadata like which person logged in at which time and what kind of changes or activity did they perform since a company's source goal is this asset it's his most important thing it's important to keep it safe and jfrog helps in keeping your source code secure it keeps track of metadata like which person logged in and which time and what kind of activities and changes did they perform having such kind of metadata in storage means that if there is any sort of conflict in future then the party responsible for the conflict can be found out using this feature another quality is full support for docker jfrog provides support for storing and distributing docker images through its repository which is simple enough in the terms that it means that you can easily store your images in for docker inside and then you can distribute it using jfrog so basically it has a seamless integration for docker another quality is quickly replicating remote reports in local area jfrog is very efficient in replicating and storing remote repositories in short amount of time using check based storage system if you are so if one of the tools in your code pipeline wanted a remote repository for functioning then can easily ask jfrog for it and jfrog can easily replicate that repository and store it in a local server for further or future use it has support for chef jfrog has comprehensive support for chef this allows for creation of targeted configuration scripts that make sure only permitted dependencies are used for particular projects or environments since j frog has a lot of support for a chef it means that it would be easy to make targeted configuration scripts to make sure that only permitted dependencies are used for a particular project or an environment that is use cases or jfrog artifactory so there are many use cases and let's see what are they first it's binary repository manager as you have seen it manages our binaries or artifacts it's a place where you can store all your artifacts so other than managing our binaries it can also store all the artifacts it's a proxy for remote repository which means is that it acts as a proxy for getting those remote repositories if a tool inside a code pipeline wanted to use a repository that is not inside the intranet of the company or of the team then jfrog can act as a proxy and get the remote repository for the tool dependency manager working again which means is that your dependency manager whichever one you're using will work against it when you download a dependency and we'll ask gfrock for the files and when it does so jfrog will get those files from internet it's a place where we can store all our docker images so that anyone who's working with within the code pipeline can easily pull those docker images without actually having to go outside artifactory integration which basically means is that it has support for integration with multiple devops tools if you wanted to use some devops tools that are not standard it also supports the integration with them it provides a faster release and business continuity which means that you can install jfrog in multiple servers it can be scalable it has disaster recovery options and replication options which are only available in the enterprise version not in the open source version since this is the feature that will be provided by the company orchestration tools it provides support for different orchestration tools like docker kubernetes and helm that can be easily integrated with jfrog and it is storage ready which means that it has the ability to store data in multiple areas like s3 object storage which is a typical web service that lets you store and retrieve data in an object store via an api reachable over https the service offers unlimited storage space and stores your data in a highly available and durable way okay guys the quick info if you're looking for an end-to-end training in devops intellipaat provides that and you can check those details in the description box below now let's continue this session now that we've understood what an artifact is an artifact repository using that knowledge to understand what jfrog artifactory is and why do we need it in devops and learning some of its use cases we can go ahead and install our jfrog artifactory so let's look at some of the prerequisites of it so before installing jfrog we will need to have open jdk in our instance and have at least 2gb of ram which means we will have to use the marketplace centerverse let's go ahead and create our centos so we will go to our aws console click on launch instance and go to our aws marketplace type centers and then click on the first one that you get center seven continue we will need to use tt.micro since it has the required amount of memory that we need that is at least four let's review and launch it but before that let's add a inbound rule for all tcp anywhere review and launch use an existing key pair click on i acknowledge and launch the instance your instance will be running now view instance name it appropriately we will name this j from rd factory okay now we'll wait for it to get initialized so we can copy our ip address and launch it using our putty tool paste the ip address here let's make it a little more visually appealing so you guys can see it properly 180 seconds between authorization and so we'll go ahead and put our key in browse round key okay open it click on yes log in and send to us okay clear the screen and let's make it full screen our first prerequisite was open jdk so let's install open jdk that's sudo sue so we don't have to keep tapping sudo here and the command for installing open jdk is yum install java 1.8.0 open jdk dev yes please yes okay our java is installed and we have an instance with space of at least 4 gb ram okay now let's go ahead and install jfrog now we can go with two ways with this we can directly install the dart or gz file or we can use docker to install it docker to pull the image and then launch it as a container so for that first we'll need to install docker inside our centers instance so for that the commands are sudo yum install yum utilis device mapper persistent data and lvm2 these are the packets that we'll need for docker and press enter this will install the packages that we need for docker okay now that we've installed the packages we can go ahead and set up a stable repository for docker so let's copy this command this is the command we'll need and come over here to instance paste the command and press enter it says that the repo has been saved okay let's clear the screen and go ahead and install docker this is the command for installing docker in centos 7. go ahead paste it you have installed docker c docker c client yes please this will install docker for us in our instance clear screen now now that we've installed docker let's go ahead and start it system ctl start docker this is the command to start docker okay let's make sure it's started system ctl status docker this should check the status of docker as we can see docker is active so let's go ahead and clear the screen and now the docker is active let's go and get the link for let's go and get the command for pulling jfrog from the website so go ahead to the browser type jfrog open source this will take us to their open source website where we can so we'll download on artifactory and artifactory oss is the artifactory open source software and you'll have the option to pull the latest artifactory docker image so if you click on it if you copy the command and paste it to your clipboard so you can come back here and paste that command so the command will be docker pull docker dot banner bin tray dot io jfrog artifactory oss and press this enter this will start pulling the latest image for jfrag artifactory oss and store it inside your instance now you're using docker to pull an image and launch jfrog artifactory because it's much easier to do so rather than directly downloading it and installing it in your instance okay now let's use the command docker images to check if the image has been downloaded yes it's been downloaded okay now that we've downloaded our docker and downloaded the image for jfrog let's see what the next command is the next command is to start jfrog artifactory get the name of the image pull and run it as docker container so we'll be running a docker container on the port 8081 know the name docker images okay so docker run minus id minus t minus p port number 8081 8081 name artifactory and then the name of the image and paste this name and then press enter now this has launched the container that has artifactory npv the screen docker ps to see which our containers are running and we can see that our container is running at the port 8081 tcp all right to access this we'll need to head to the browser and open another tab copy the ip address paste it go to 8081 press enter and this will start your jfrog artifactory and with this we have completed the installation of jfrog now that we have installed jfrog we can go ahead and practice now let's see what are the steps we'll be taking during our practice session so the first step is running jfrog artifactory and setting up the admin that we've already done and the second is using git to get the sample code and this is the sample code we'll be using to see how versioning works in jfrog and the third step is to install maven to compile and package the sample code and the fourth step is to connect maven to jfrog and fifth is check how versioning works in jfrog now let's go ahead and set up the admin go here come over here and we'll enter the password and username the username is admin and the default password is password now this is a generic one we can go ahead and create a proper user later but this is just for practice okay now that we are inside jfrog we can see that this is the dashboard and before the dashboard is a pop-up telling us welcome to jfrog artifactory click on next it asks her to configure a proxy server but we do not need a configure proxy server right now as we're just practicing but when do we need to configure a proxy server we will need to do so in case we don't have access to internet from the current server or system that we're using suppose you're working inside a company and the only access you have is to internet on your particular system or server so that time you can always configure a proxy so that you can access internet through the proxy instead of directly accessing it but let's go ahead and click on skip and then we'll ask you to create repositories so the repository will be creating today is the maven repository because maven is the build tool that is used to build java based applications so click on maven and press create so it has created five directories libs snapshot local there's release local j center lib snapshot and live release so the libs release local will store the wall file the snapshot will store the snapshots of the versions and the libs released will store the dependencies you can go ahead and click on finish and then will show us the dashboard of j frog artifactory now before we move on to our next steps let's familiarize ourselves with jfrog a little bit so if you come up over here and tell you welcome admin or welcome username if you click on it it will show you a quick setup and show you local repository if you want to create a new local repository you can create it from here or you can go ahead and create a remote repository using whichever package you want and you can do a virtual repository distribution repository you can go ahead and do administrative tasks like add a user in which you can add a user or you can add a group or you can add permissions to particular groups or users now these are the administrative tools and this is for setting up repositories for storing artifacts now if you want to see administration tools in more advanced situations or more advanced tools you can go ahead and click over here this will show you many more things to configure generally configure proxies mail ssh server security services import and export and log analytics system log system info maintenance and etc and if you come back to our home this will just be our homepage show basic things like quick search and the features of jfrog and etc and show you the last deployed builds most downloaded artifacts and etc now you can click over here and i'll show you artifact repository browser where it will show us all the directories that we have created for our maven or if you want to search for an artifact in particular you can come over here and click on this you can search the artifact based on the criteria and filter by artifact so now that we've familiarized with ourselves with artifactory we can go ahead and complete the next steps that is to use git to get the sample code install maven connect me into jfrog and check how versioning works so let's go to our instance okay and let's go ahead and install get in this yum install and get and let us also install dublicate we'll be using that to get maven okay now we've installed git and delegate now let us get our sample code so for that we'll need to get the repository url for that we'll need to go over here you'll need this link github.com gk devops and pet cleaning this is where our sample code is located in github we'll go to our web browser paste the link on the navigation press enter and this is our sample code with the palm.xml file we can click on clone and download copy the url for the repository come back to our instance type in the commands get clone this will clone in the pet clinic repository and paste the url for it and click enter okay now that we have cloned the sample project let's go ahead and install maven also clear the screen go back to our browser type apache maven go to the maven website click on download and come down and get the latest version and copy the link address of the gz file this is the one we'll be using copy the link address come back to your instance use the double get command and paste the link and press enter this would have downloaded your tar file for your apache email let's go on target so dar zxf apache now that we have untarded we can go inside apache maven inside bin and see if it's working or not so for that command is maven version this will say which version it's using so let's see if maven is installed properly or not and this will show us maven apache maven 3.6.2 great now we have a maven install and we can use maven to compile and package our sample project but before that we will go ahead and make sure that maven is available to all of the os so for that we'll be using the command export and we're using the environment variable path and setting it so that all of the os dollar sign will be able to use maven not just from this position so the command will be export path equals dollar sign path colon slash opt apache movement wherever you may want to store and then pin and press enter we'll come out of the apache maven folder and now we will see if maven is compiling our project or not type me even compile and as you can see it's downloading the repositories from central server but this is without the help of jfrog artifactory let's just quit we just wanted to see if it's compiling it or not we don't actually need to compile so we clear the screen and now we need to connect our maven with our jfrog artifactory for that let's head to the browser and when you come to the browser make sure you're in the dashboard and in the dashboard go ahead and click on live snapshot local and after you click on that click on maven generator links but before you click on even generate settings you need to enter your password this is how it will be for you and enter the password you use to enter jfrog okay after you've entered the credentials go ahead and click on generate mu in settings and set up and leave the default configurations b and come down and click on generate settings and this is the xml file that will create for you now this is the file we will need to connect our maven to jfrog so let's go ahead and copy that or instead of doing that we can go ahead and download the snippet and check it out in the folder open it up with notepad and just ctrl a ctrl copy now we have the settings we can come back to our instance so the place where we need to enter these details is inside the root folder and now that we've had let's open let's see which all folders are inside we'll do ls minus a because this will show all the folder even the hidden folder and the folder we need to go inside is dot m2 which is a hidden folder so now we see that dot m2 inside root folder will go inside it so cd dot m2 now we're inside dot m2 folder now we will open the file settings.xml okay since it's a new file we'll go ahead and paste whatever content we copied from here okay as you can see we've pasted the content and what this basically means is that maven will be asking jfrog for the dependencies anytime it wants any dependencies so anytime a dependency needs to be downloaded it will be done through jfrog and this will also connect maven with jfrog so the only updates we need to make over here are under username and password just enter the username and password that you use to get inside that is admin and password now that center maven compile and now that we've made the settings we can go ahead and try maven compile again and if we try and even compile this time we can see that it is getting the dependency using jfrog we'll wait for it to get compiled then i'll show it to you guys as you can see it's using artifactory it's not using maven as uh for getting the dependencies it's using artifactory to get the dependencies so now that we have connected maven with our artifactory this will happen every time that maven builds a project every time even builds a project it will ask those dependencies that it scan from the palm.xml file to the jfrog artifactory and jfrog artifactory will go and get those dependencies and download them into the local server so that maven can use those repositories to build the file as you can see now that our maven has been compiled maven has compiled our project and we can go forward and set up the distribution system now to set up the distribution system we go back to our browser and come to our jfrog dashboard now click click on libs snapshot local again and we'll come down and we'll copy this part of the code it will be used to deploy the war file or the jar file whichever artifact you have created onto the jfrog artifactory so let's come back to our instance let's clear the screen and we need to paste this code inside our palm.xml file come down okay we need to paste this code after the dependencies are over so we need to keep going down a lot down okay so as you can see this is the closing tag for the dependencies we have to paste it after this tag and now we will type the command maven deploy this will upload the packaged file onto jfrog press enter and now that our build is successful to see whether the file was uploaded or not we'll head over to the go to jfrog click on the artifactory browser home artifactory repository browser and in that under libs snapshot local if you click on it you can see the artifact count if it shows you can see how now there is 4mb of 40mb in artifact count now if you click on libsnapshot if you open it you can see that there is a folder created there that is all spring framework samples spring pet clinic and if you will open for 4.2.5 snapshot you can see that we have our executable over here that is the war file so with this we know that jfrog can store artifacts that are connected with maven and that have been deployed using maven or any other build tool we just use maven in our case if you see jsenter jsenter is where all the third third-party dependencies will be stored as you can see this is where all the third-party dependencies are stored now now that we've seen that jfrog can store artifact let's see how the versioning works in jfrog so let's come back to our instance clear the screen to simulate a change in the code what we'll do is we'll go inside our palm.xml file and we will go and change the version we will change the version from 4.2.5 to 4.2.6 and we will go ahead and write and save it and we'll type ambient deploy again press enter and we can see that maven is compiling the project again running the test cases compiling all the resources and all the binary code into one wall file and then uploading it to the jfrog but the only difference here being that we've changed the version from 4.2.5 to 4.2.6 and that change should reflect on our jfrog in the browser okay let's go and check it in our browser now click on lib snapshot again open it and open the arc file and now you can see that there's a 4.2.6 snapshot so we have simulated a change and now we can see that it stores the artifacts for different versions this is for 4.2.6 low file and this is for 4.2.5 now suppose we if we had an error in this application and we couldn't figure it out or if we wanted to do a rollback we can just easily come over here and use this file as easy as that no need to go back and change the comments and everything so we've seen how jfrog works in combination with maven building a java file and uploading the artifact but jfrog can work with a lot of other build tools also if you come in if you come and see here you keep on going to the side you can see that it works with nuget or npm or php composer or bower and etc so basically what we learned today in the video was that jfrog is an artifact repository that it manages all the artifacts that have been uploaded to it and it can have an easy rollback and the second thing that jfrog does is it manages and downloads dependencies for your build tool so guys that's it for today okay guys the quick info if you're looking for an end-to-end training in devops intellipaat provides that and you can check those details in the description box below okay guys that's it for this session i hope you understood and also it was helpful and informative if you have any queries leave a comment down below and we'll love to help you out thank you
Info
Channel: Intellipaat
Views: 12,832
Rating: 4.9354839 out of 5
Keywords: Jfrog, Jfrog Artifactory, Jfrog Artifactory Tutorial, Artifactory Tutorial, Universal Artifact Repository, Securely Managing Docker Images, Continuous Integration, Continuous Delivery, CI/CD Pipeline, Image Scanning, Devops, Install Jfrog artifactory, jfrog platform, jfrog xray, how to install artifactory, jfrog xray installation, how to setup artifactory, artifactory setup, jfrog enterprise, Devops tutorial, Devops training, devops course, devops tools, intellipaat
Id: a1B1jXXVzPQ
Channel Id: undefined
Length: 36min 59sec (2219 seconds)
Published: Wed Apr 14 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.