0% found this document useful (0 votes)
158 views7 pages

Jfrog Notes

Uploaded by

akhil reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
158 views7 pages

Jfrog Notes

Uploaded by

akhil reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

Jfrog overview

Types of repositories
Installation of Jfrog artifactory
Manual Deployment of Artifacts via GUI
Maven Integration with jfrog artifactory
Artifact upload download:
* How to upload the artifacts to snapshot repository?
* How to upload the artifacts to release repository?
* How to download the artifacts from jfrog repositories?
Troubleshooting steps for Jfrog artifactory
Directory structure of Jfrog artifactory
Jfrog Administration
===================================================================================
========================================
Jfrog artifactory is an repository management tool or universal management tool
used for storing the artifacts.
Jfrog artifactory is a repository manager that supports all available software
package types like jar, war, ear, rar, bar etc
Jfrog is a repository Management tool or universal artifactory management tool.
Jfrog Artifactory is a repository manager that supports all available software
package types.
Jfrog Artifactory is a tool used in devops methodology to store artifacts.
Jfrog provides proper tracking of the artifacts version like who
uploaded/deleted/downloaded and at what time and date.
Jfrog provides an mechanism like git version control system called SHA(secure
hashing alogrithm ) which provides commit_id for storing the artifacts without
backup's bec with commit_id we can record the changes of every new uploads.
Jfrog also provides proper user management with access restricts for tracking and
securing the artifacts so that we can easily share artifacts to other securely.
Jfrog also allows us to store the artifact in proper format of Maven.
===================================================================================
================================
Why Jfrog ?
===================================================================================
================================
Developer -> develops/writes the code -> push the code to github
Devops -> Maven build -> compile, test, packages
-> Generate artifacts(.jar/.war)
-> Sonarqube -> Code scanning and code inspection for checking
vulnerabilities and bugs, duplication of code etc
-> Tomcat -> Launching the application for deploying the artifacts.
-> Storage for Artifacta(JAR/WAR)?

Artifact: Artifact is final product/software/website of the code which is ready to


deploy and which contains functionality of product/software/website.

Ecommerce website:
* login feature
* logout feature
* payment feature
* Acknowledgment feature
* Product catalog feature

1. login feature: Branch(login-feature): login.java


login-security.java
login-password.java
* mvn clean install -> generate artifacts -> login-20240301074032.jar
login-20240302074032.jar ->
untill the completion of feature.

2. logout feature: Branch(logout-feature): logout.java


logout-security.java
logout-password.java

* mvn clean install -> generate artifacts -> logout-20240301074032.jar


logout-20240302074032.jar ->
untill the completion of feature.

.
.
.
.
.
.

Finally you build the final artifacts for ecommerce website.

===================================================================================
==
Challenges:
===================================================================================
==
1. Storage space is required for storing artifacts which again incurs storage cost,
we need mechanism to reduce cost.
2. Proper version control system for tracking the Artifacts - who/when/what-
uploaded and deleted.
3. Proper downlaod and uplaod speed to deploy the artifact.
4. Storing the artifact should be in proper format bec artifacts is built in maven
format.
===================================================================================
=======================================
Types of repositories:
===================================================================================
========================================
1. Local : Local repositories are physical , locally managed respositories into
which we can deploy or store the artifacts.
Artifacts deployed in local repositories can be snapshot, release, common
artifacts, plugins etc.

2. Remote: A remote repository serves as a caching proxy for a repository managed


at remote URL which may itself be another artifactory remote repository.
We cannot deploy an artifacts into remote repository as it central public
connected repository.

3. Virtual: A virtual repository(repository group) aggregates several repositories


with the same package type under a common url. In virtual repository, we can
resolve or retrieve artifacts but we cannot deploy artifacts.
Mostly in virutal repositories licence artifacts are kept.

===================================================================================
=======================================
Installation of Jfrog artifactory:
===================================================================================
=======================================
Minimum requirement of Server :
OS image: Redhat
Instance type: t2.medium - 2 core CPU, 4 GB RAM (OR) t2.large - 4 core cpu & 8
GB
Harddisk : 10 GB
Security groups:
8081 -> custom TCP -> anywhere 0.0.0.0/0 // Default port for Jfrog CLI
8082 -> custom TCP -> anywhere 0.0.0.0/0 // Default port for Jfrog GUI
80 -> HTTP -> anywhere 0.0.0.0/0 // hit url http://public-ip:8081
22 -> SSH -> anywhere 0.0.0.0/0 //login into machine
Custom ICMP IPV4 -> anywhere 0.0.0.0/0 // if any blocking port are there,
it will unblock us!!

1. Pre-requiste Install java and wget:


default login with ec2-user
sudo su - root
yum install java-11* -y ( project - java and JVM (process id - nexus -> process id
is shared with kernel -> memory is assigned to Jfrog by kernel)
yum install wget -y

2. Create a directory named app and cd into the directory.


mkdir /app && cd /app

3. Download and Extract:


wget https://releases.jfrog.io/artifactory/bintray-artifactory/org/artifactory/
oss/jfrog-artifactory-oss/[RELEASE]/jfrog-artifactory-oss-[RELEASE]-linux.tar.gz
tar -xvf jfrog-artifactory-oss-[RELEASE]-linux.tar.gz
mv artifactory-oss-7.77.6 jfrog
rm jfrog-artifactory-oss-[RELEASE]-linux.tar.gz

(OR)
https://releases.jfrog.io/artifactory/bintray-artifactory/org/artifactory/oss/
jfrog-artifactory-oss/?
_gl=1*btirnf*_ga*MTUwNTc2MzQzNi4xNjk3NTYxOTk4*_ga_SQ1NR9VTFJ*MTcwMTIxODgyNS42LjEuMT
cwMTIxOTUxOC4wLjAuMA..*_fplc*RE51TTkwQlMwdTlMWXZqWkk3MzdQS3U2TUJEVEV0OHpjejJCYXFJWV
g5b0QzWiUyQjRoM29jQk5SemludVBNWVEzQXN2OUkxOTBHbDNsbSUyQlRlUFg4Nm1PU1hRdXJweHVUdnpWb
HMxNlIlMkI0WSUyQnVSWHkxUnpWRlRRQjJ0dUQ3NXclM0QlM0Q.

4. Start Jfrog service.


cd /app/jfrog/app/bin
./artifactoryctl start
./artifactoryctl status

5. Hit the URL in Browser.


http://Public-IP:8082

6. Default login credentials: (admin/password)

username: admin
password : Admin@123
===================================================================================
=========================================
Manual Deployment of Artifacts via GUI:
===================================================================================
==========================================
Download in machine : wget
https://github.com/AKSarav/SampleWebApp/raw/master/dist/SampleWebApp.war
General tab -> Artifactory -> Artifacts -> select repository -> Deploy\

===================================================================================
==========================================
Maven integration with Jfrog:
===================================================================================
========================================
1. Add Credentials of Jfrog in settings.xml

/root/.m2/settings.xml - User level


or
/opt/maven/conf/settings.xml - Global level

======================================
xml - extended markup language
xml ns - xml namespce
=========================================================================
vi ~/.m2/settings.xml

<?xml version="1.0" encoding="UTF-8"?>


<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0
http://maven.apache.org/xsd/settings-1.1.0.xsd">

<servers>
<server>
<id>jfrog-snapshots</id>
<username>admin</username>
<password>Admin@123</password>
</server>
<server>
<id>jfrog-releases</id>
<username>admin</username>
<password>Admin@123</password>
</server>
</servers>
</settings>

2. pom.xml :-

vi /opt/Hello-World-Code/webapp/pom.xml

<distributionManagement>
<snapshotRepository>
<id>jfrog-snapshots</id>
<url>http://3.141.6.31:8082/artifactory/local-snasphot-repo/</url>
</snapshotRepository>
<repository>
<id>jfrog-releases</id>
<url>http://3.141.6.31:8082/artifactory/local-release-repo/</url>
</repository>
</distributionManagement>

3. Upload to Jfrog:
How to upload artifact to maven snapshots repos via command line ?
a. Snapshot version upload to Jfrog.
if pom.xml -> <version>1.0-SNAPSHOT</version> then go to <snapshotRepository>
block and execute in pom.xml
cd /opt/Hello-World-Code/webapp
mvn clean deploy

How to upload artifact to maven release repos via command line ?


b. Release version upload to Jfrog.
if pom.xml -> <version>1.0</version> then go to <repository> block and execute
in pom.xml
cd /opt/Hello-World-Code/webapp
mvn clean deploy

===================================================================================
=========================================
How to download artifacts from Jfrog artifactory virtual repository to local
repository?
===================================================================================
=======================================
1. Create repo : maven-licence-repo ==> repository type maven2(hosted)

2. Upload any jar file from internet -> wget


https://github.com/AKSarav/SampleWebApp/raw/master/dist/SampleWebApp.war

3. search in maven-licence-repo -> General -> Dependency Declaration -> maven


Add the dependeny under <dependencies> tag in pom.xml

<dependency>
<groupId>webapp.app</groupId>
<artifactId>SampleWebApp</artifactId>
<version>5.0</version>
<type>war</type>
</dependency>

4. Also add below code in pom.xml .


Note : remove or comment <distributionManagement> block

<repositories>
<repository>
<id>jfrog-virtual</id>
<url>http://18.118.46.20:8082/artifactory/maven-licence-repo/</url>
</repository>
</repositories>

5. Add in settings.xml

vi ~/.m2/settings.xml or /opt/maven/conf/settings.xml

<?xml version="1.0" encoding="UTF-8"?>


<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0
http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>jfrog-virtual</id>
<username>admin</username>
<password>Admin@123</password>
</server>
</servers>
</settings>

5. Run mvn clean install, if verify if downloaded jar in cd ~/.m2/repository/


mvn clean install

===================================================================================
===========================
Troubleshooting steps for Jfrog artifactory:
===================================================================================
===========================
1. Hit the URL: http://Public:8082

2. How to check the process/service of artifactory?

ps -ef | grep -i jfrog

(OR)
cd /app/jfrog/app/bin
./artifactoryctl status

3. How to check logs in jfrog artifactory?


cd /app/jfrog/var/log
tail -1000f console.log
tail -1000f artifactory-service.log
tail -1000f artifactory-request.log

4. How to restart jfrog artifactory?


cd /app/jfrog/app/bin
./artifactoryctl stop
./artifactoryctl start

(OR)
cd /app/jfrog/app/bin
./artifactoryctl restart

5. How to check disk free space ?


df -h
[root@ip-172-31-31-72 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 1.8G 0 1.8G 0% /dev/shm
tmpfs 729M 17M 713M 3% /run
/dev/xvda4 9.2G 5.7G 3.6G 62% /
/dev/xvda3 536M 161M 376M 31% /boot
/dev/xvda2 200M 7.0M 193M 4% /boot/efi
tmpfs 365M 4.0K 365M 1% /run/user/1000
[root@ip-172-31-31-72 ~]#

6. How to check disk usage on files and directories?


du -sh *
du -sh file_name/dir_name

7. Cpu and ram usage:


lscpu
free -g
top
===================================================================================
=================================
Directory structure of Jfrog artifactory:
===================================================================================
==================================
1. /app/jfrog/app: bin
artifactory

2. /app/jfrog/var: log
data

===================================================================================
====================================
Jfrog Administration:
===================================================================================
======================================

You might also like