{"id":831,"date":"2018-12-06T16:21:55","date_gmt":"2018-12-06T16:21:55","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw93\/?p=831"},"modified":"2018-12-06T23:45:53","modified_gmt":"2018-12-06T23:45:53","slug":"setting-up-a-docker-registry-with-jfrog-artifactory-and-rancher","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw93\/index.php\/2018\/12\/06\/setting-up-a-docker-registry-with-jfrog-artifactory-and-rancher\/","title":{"rendered":"Setting Up a Docker Registry with JFrog Artifactory and Rancher"},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/cdn.rancher.com\/wp-content\/uploads\/2017\/07\/26104718\/Artifactory-Logo.png\" alt=\"\" \/>For any team using<br \/>\ncontainers \u2013 whether in development, test, or production \u2013 an<br \/>\nenterprise-grade registry is a non-negotiable requirement. <a href=\"https:\/\/www.jfrog.com\/artifactory\/\">JFrog<br \/>\nArtifactory<\/a> is much beloved by Java<br \/>\ndevelopers, and it\u2019s easy to use as a Docker registry as well. To make<br \/>\nit even easier, we\u2019ve put together a short walkthrough to setting things<br \/>\nup Artifactory in Rancher.<\/p>\n<h3>Before you start<\/h3>\n<p>For this article, we\u2019ve assumed that you already have a Rancher<br \/>\ninstallation up and running (if not, check out our <a href=\"http:\/\/rancher.com\/docs\/rancher\/v1.6\/en\/quick-start-guide\/\">Quick Start<br \/>\nguide<\/a>), and<br \/>\nwill be working with either Artifactory Pro or Artifactory Enterprise.<br \/>\nChoosing the right version of Artifactory depends on your development<br \/>\nneeds. If your main development needs include building with Maven<br \/>\npackage types, then Artifactory open source may be suitable. However,<br \/>\nif you build using Docker, Chef Cookbooks, NuGet, PyPI, RubyGems, and<br \/>\nother package formats then you\u2019ll want to consider Artifactory Pro.<br \/>\nMoreover, if you have a globally distributed development team with HA<br \/>\nand DR needs, you\u2019ll want to consider Artifactory Enterprise. JFrog<br \/>\nprovides a detailed<br \/>\n<a href=\"https:\/\/www.jfrog.com\/confluence\/display\/RTF\/Artifactory+Comparison+Matrix\">matrix<\/a><br \/>\nwith the differences between the versions of Artifactory. There\u2019s<br \/>\nseveral values you\u2019ll need to select in order to set Artifactory up as<br \/>\na Docker registry, such as a public name, or public port. In this<br \/>\narticle, we refer to them as variables; just substitute the values you<br \/>\nchoose in for the variables throughout this post. To deploy Artifactory,<br \/>\nyou\u2019ll first need to create (or already) have a wildcard imported into<br \/>\nRancher for \u201c*.$public_name\u201d. You\u2019ll also need to create DNS entries<br \/>\nto the IP address for artifactory-lb, the load balancer for the<br \/>\nArtifactory high availability architecture. Artifactory will be reached<br \/>\nvia $publish_schema:\/\/$public_name:$public_port, while the Docker<br \/>\nregistry will be reachable at<br \/>\n$publish_schema:\/\/$docker_repo_name.$public_name:$public_port<br \/>\n<img decoding=\"async\" src=\"http:\/\/cdn.rancher.com\/wp-content\/uploads\/2017\/07\/26101946\/Rancher-Add-Certificate-1024x671.png\" alt=\"\" \/><\/p>\n<h3>Installing Artifactory<\/h3>\n<p>While you can choose to install Artifactory on your own with the<br \/>\n<a href=\"https:\/\/www.jfrog.com\/confluence\/display\/RTF\/Installing+Artifactory\">documented<br \/>\ninstructions<\/a>,<br \/>\nyou also have the option of using Rancher catalog. The Rancher community<br \/>\nhas recently contributed a template for Artifactory, which deploys the<br \/>\npackage, the Artifactory server, its reverse proxy, and a Rancher load<br \/>\nbalancher.<\/p>\n<p>**A note on reverse proxies: **to use Artifactory as a Docker registry,<br \/>\na reverse proxy is required. This reverse proxy is automatically<br \/>\nconfigured using the Rancher catalog item. However, if you need to apply<br \/>\na custom nginx configuration, you can do so by upgrading the<br \/>\nartifactory-rp container in Rancher.<\/p>\n<p>Note that installing Artifactory is a separate task from setting up<br \/>\nArtifactory to serve as a Docker registry, and from connecting that<br \/>\nDocker registry to Rancher (we\u2019ll cover how to do these things as<br \/>\nwell). To launch the Artifactory template, navigate to the community<br \/>\ncatalog in Rancher. Choose \u201cPro\u201d as the Artifactory version to launch,<br \/>\nand set parameters for schema, name, and port:<br \/>\n<img decoding=\"async\" src=\"http:\/\/cdn.rancher.com\/wp-content\/uploads\/2017\/07\/26104029\/Template-parameters-1024x690.png\" alt=\"\" \/><\/p>\n<p>Once the package is deployed, the service is accessible through<br \/>\n[$publish_schema:\/\/$publish_name:$publish_port]<\/p>\n<h3>Configure Artifactory<\/h3>\n<p>At this point, we\u2019ll need to do a bit more configuration with<br \/>\nArtifactory to complete the setup. Access the Artifactory server using<br \/>\nthe path above. The next step will be to configure the reverse proxy and<br \/>\nto enable Docker image registry integration. To configure the reverse<br \/>\nproxy, set the following parameters:<\/p>\n<ul>\n<li>Internal hostname: artifactory<\/li>\n<li>Internal port: 8081<\/li>\n<li>Internal context: artifactory<\/li>\n<li>Public server name: $public_name<\/li>\n<li>Public context path: [leave blank]<\/li>\n<li>http port: $public_port<\/li>\n<li>Docker reverse proxy settings: Sub Domain<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"http:\/\/cdn.rancher.com\/wp-content\/uploads\/2017\/07\/26104134\/Artifactory-Setup-1024x686.png\" alt=\"\" \/> Next, create a<br \/>\nlocal Docker repository. Make sure to select Docker as the package type:<br \/>\n<img decoding=\"async\" src=\"http:\/\/cdn.rancher.com\/wp-content\/uploads\/2017\/07\/26104226\/Docker-repo-select-1024x555.png\" alt=\"\" \/> Verify that the<br \/>\nregistry name is correct; it should be formatted as<br \/>\n$docker_rep_name.$public_name<br \/>\n<img decoding=\"async\" src=\"http:\/\/cdn.rancher.com\/wp-content\/uploads\/2017\/07\/26104256\/Local-repository-1024x685.png\" alt=\"\" \/> Test that the<br \/>\nregistry is working by logging into it:<\/p>\n<p># docker login $publish_schema:\/\/$docker_repo_name.$public_name<\/p>\n<h3>Add Artifactory into Rancher<\/h3>\n<p>Now that Artifactory is all set up, it\u2019s time to add the registry to<br \/>\nRancher itself, so any application built and managed in Rancher can pull<br \/>\nimages from it. On the top navigation bar, visit Infrastructure, then<br \/>\nselect Registries from the drop down menu. On the resulting screen,<br \/>\nchoose \u201cAdd Registry\u201d, then select the \u201cCustom\u201d option. All you\u2019ll need<br \/>\nto do is enter the address for your Artifactory Docker registry, along<br \/>\nwith the relevant credentials:<br \/>\n<img decoding=\"async\" src=\"http:\/\/cdn.rancher.com\/wp-content\/uploads\/2017\/07\/26104616\/Custom-Registry-1024x688.png\" alt=\"\" \/> Once it\u2019s been<br \/>\nadded, you should see it show up your list of recognized registries<br \/>\n(which shows up after visiting Infrastructure -&gt; Registries on the top<br \/>\nnavigation bar). With that, you should be all set to use Artifactory as<br \/>\na Docker registry within Rancher! <em>Raul is a DevOps Lead at Rancher<br \/>\nLabs.<\/em><\/p>\n<p><a href=\"https:\/\/rancher.com\/setting-docker-registry-jfrog-artifactory-rancher\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For any team using containers \u2013 whether in development, test, or production \u2013 an enterprise-grade registry is a non-negotiable requirement. JFrog Artifactory is much beloved by Java developers, and it\u2019s easy to use as a Docker registry as well. To make it even easier, we\u2019ve put together a short walkthrough to setting things up Artifactory &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw93\/index.php\/2018\/12\/06\/setting-up-a-docker-registry-with-jfrog-artifactory-and-rancher\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Setting Up a Docker Registry with JFrog Artifactory and Rancher&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-831","post","type-post","status-publish","format-standard","hentry","category-kubernetes"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/831","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/comments?post=831"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/831\/revisions"}],"predecessor-version":[{"id":872,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/831\/revisions\/872"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/media?parent=831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/categories?post=831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/tags?post=831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}