Use Terraform to Easily Manage Your Artifactory Infrastructure

Artifactory deployed in Terraform

Cloud-based solutions offer an abundance of opportunity to deliver potential game-changing possibilities for businesses. Your business can now deliver software at greater speed, and at a reduced cost.

Cloud Deployment Challenges

The Cloud is the way to go, but a cloud solution can be challenging when considering the various options available to you such as, which cloud hosting solution to select, how should it be configured and deployed, while maintaining the infrastructure. To add the complexity, setting up your initial applications and website on the cloud platform and discovering how the different parts fit together can be very cumbersome, tedious, and time-consuming. 

Building your infrastructure becomes much easier and manageable with tools like Terraform, Infrastructure As Code (IAC), which works with multiple cloud providers including AWS, GCP, and Azure. This blog post describes the benefits of using Terraform and how to easily deploy, manage, and scale an Artifactory Enterprise cluster in the cloud using our customized Terraform template.

Why Deploy Artifactory Using Terraform?

Terraform IAC, allows developers to write and execute code to define, deploy, and update their infrastructure easily. It provides cost reduction in both financial cost and resource reduction, speed through faster execution, and reduced risk by removing manual configuration and decreasing downtime while increasing reliability.

The benefits of using Terraform to manage your JFrog Artifactory infrastructure are:

Reduced Time

Setting up your infrastructure in the cloud is always time-consuming and error-prone with a steep learning curve if you are starting from scratch. It requires knowledge of cloud provider as well as networking and security configuration. Terraform helps to reduced time spent on infrastructure creation.

Cloud Agnostic

Switching providers is no longer a headache anymore as Terraform supports multiple cloud providers.

Easy to Maintain

The Terraform template is in human-readable code. It becomes easy to maintain by modularizing your resources.

Scaling/Upgrades

Terraform templates can be reused to deploy multiple clusters and it can also manage scaling and upgrading of your infrastructure.

Deploying an Artifactory Enterprise High Availability Cluster

Let’s see how easy it is to deploy, manage and scale an Artifactory Enterprise cluster in the cloud using Terraform. Artifactory HA architecture presents a Load Balancer connected to a cluster of two or more Artifactory servers that share a common database where all the Artifactory configuration files are maintained.  Binaries may be stored on a Network File System, or using a zoned sharded binary provider as described in Configuring Sharding for High Availability. One of the Artifactory cluster nodes is set as the “Primary” node that will execute cluster-wide tasks such as cleaning up unreferenced binaries.

Binaries may be stored on a Network File System, or using a zoned sharded binary provider as described in Configuring Sharding for High Availability. One of the Artifactory cluster nodes is set as the “Primary” node that will execute cluster-wide tasks such as cleaning up unreferenced binaries.

JFrog Artifactory High Availability

The following diagram displays the resources created by Terraform to deploy Artifactory Enterprise stack.the resources created by Terraform to deploy Artifactory Enterprise stackPrior to deploying your Artifactory Enterprise stack in Terraform, prepare these components as displayed in the diagram:

  • A VPC
  • A single private subnet and two public subnets
  • An RDS (for example: MySQL)
  • An IAM User
  • S3 Bucket
  • Security Groups
  • Create two Auto Scaling groups for the primary and secondary
  • ELB

The following step-by-step workflow demonstrates how to deploy the Artifactory Enterprise stack using our customized Terraform template:

  1. Run the terraform init command.
  2. Change the value of variables in the variables.tf file.
  3. terraform plan.
  4. terraform apply.

It takes 20-30 minutes to deploy the stack. Once the stack is ready, you will get an Artifactory ELB URL:

Outputs:
address = artifactory-elb-265664219.us-west-2.elb.amazonaws.com

 

To learn more, see Artifactory Terraform template.