Usually the code on a project is stored in some repository, like github, but usually a lot of stuff is not stored in the github for a project.
For example, in order to create your project you need to have a compiler, libraries, modules, tools, etc.
Most of them are usually available on the net but ... but there are some limits.
What happens if you want to build your project in the future ?
How can you be sure to be able to find what "now" is easily available ?
And also for a security standpoint, is always a good thing to be able to have a specific version of a library or tool for a project.
To solve this and many other issues, programs like Artifactory do exists, allowing to create a place where to store any kind of program/library/etc. and retrieve them when needed ... in order words "artifacts".
Then you can set up a project downloading all the necessary artifacts from your archive, from an OS to a library, utility, tool, etc. from your artifact archive or, Artifactory.
Artifactory can also be programmed to keep updated some artifacts automatically from different sources, keeping available different versions.
For Linux systems is also possible to link the system repository (apt-get for Debian based, yum for Cent-OS based, etc.) to artifactory.
This is extremely useful to be able to control what packages are allowed in a network where there are different systems.
The automatic update of a linux box can be redirected in the end to Artifactory.
My use
In my case I wanted a place where store everything I need in order to build a project.For example NiRis, has a bunch of tools and libraries that usually are downloaded from different sites, like Adafruit for example.
But I wanted a more reliable way to obtain what I need.
I wanted to be able to reproduce a project in the future, without worrying if a package is not anymore available.
So basically having the packages stored in my server gives me these advantages :
- capability to reproduce a project in the future
- a local space where to have everything I need for a project
- be able to reproduce a project even being offline
- capability to backup my artifacts on Drobo
Installing it
Is possible to install an open source version of Artifactory on a server.
In my case my server already has a bunch of websites so I decided to approach the installation in another way.
I installed Docker on the server.
I leave a detailed explanation about Docker for another article, but in easy terms, is a way to have available some kind of virtual server (called container) where to run stuff.
Is a nice way to have different containers running specific applications, in this case Artifactory.
Very easy for example to run a website without worrying about other website running.
So after installing Docker I found a ready to use image for it and downloaded on my server as well and then started.
In few minutes I ended up having a nice Artifactory server running on the server.
Here some steps to do so, of course it is assumed to have installed docker on your server.
- Be sure to have docker running (sudo service docker start)
- Copy on the server the docker image for Artifactory :
docker pull docker.bintray.io/jfrog/artifactory-oss:latest - Run the image. The command will run the Artifactory in the image making it accessible at the port 8081 on the host :
docker run --name artifactory -d -p 8081:8081 docker.bintray.io/jfrog/artifactory-oss:latest Note ! There are two images to be used. One is called artifactory-pro and the other artifactory-oss.
The first is the commercial version of Artifactory, the second one the open source one. The second one has some limits but can be used free. The first one is quite expensive :) - To stop the Artifactory :
docker stop artifactory
docker rm artifactory
Adding a permanent volume
In order to keep the artifacts stored permanently is necessary to have a volume associated to Artifactory.
I choose to have the volume embedded in the docker image.
I choose to have the volume embedded in the docker image.
To do so :
- Stop the current Artifactory docker
docker stop artifactory
docker rm artifactory - Create the volume in docker :
docker volume create --name artifactory_data
The volume is called artifactory_data - Launch docker Artifactory associating the volume created :
docker run --name artifactory -d -v artifactory_data:/var/opt/jfrog/artifactory -p 8081:8081 docker.bintray.io/jfrog/artifactory-oss:latest - Once started the container, better to clean up the docker area with :
docker system prune -a
Use Artifactory
To use artifactory simply open a browser on the server address on the port 8081.
In my case I didn't open the port for outside, so the Artifactory is reachable only on my network ... of course using VPN is possible to work also remotely.
Stay tuned for more articles on what to do with Artifactory.
No comments:
Post a Comment