Skip to main content
Version: Deploy 24.1

Deploy provisioning example

This topic provides a step-by-step example that will help you get started with Deploy provisioning in cloud-based environments.

To follow this example, you need:

  • An Amazon Web Services EC2 Machine Image (AMI) on which Puppet is installed.
  • A Puppet manifest that will install Apache Tomcat in /opt/apache-tomcat.
  • The sample PetClinic-war application provided with Deploy. This is optional.

Before you begin

To understand important concepts related to Deploy provisioning, see provisioning through Deploy.

To complete this tutorial, this scenario assumes:

  • You have an installed instance of Deploy and are using a Unix-based operating system
  • You are running Java 8 JDK
  • You are running Puppet plugin version 6.0.0 or higher

Step 1 - Create an application

Deploy uses the same model for deployment packages and provisioning packages. Your first step is to create an application that will serve as a logical grouping of provisioning packages.

A provisioning package describes the:

  • infrastructure items that should be created.
  • environment to which infrastructure items will be associated.

From the Deploy GUI, create a new application:

  1. In the left pane, hover over Applications, click Explorer action menu, and select New > Application.
  2. In the Name field, type PetClinicEnv.
  3. Click Save.

Step 2 - Create a provisioning package

  1. Expand Applications.
  2. Hover over PetClinicEnv, click Explorer action menu, and select New > Provisioning Package.
  3. In the Name field, type 1.0.0.
  4. Click Save.

Step 3 - Create provisionables and templates

A provisioning package consists of provisionables, which are virtual machine specifications, and templates for configuration items (CIs).

In this step you will create the following provisionables:

  • an instance specification
  • an SSH host template
  • a Tomcat server template
  • a Tomcat virtual host template

Create an instance specification

  1. Hover over the 1.0.0 package, click Explorer action menu, and select New > aws > ec2 > InstanceSpec.

  2. Enter the following properties:

    PropertyValueDescription
    Nametomcat-instance-specThe name of the CI.
    AWS AMIYour AWS AMI ID. For example, ami-d91be1ae.The ID of an AMI where Puppet is installed.
    RegionThe EC2 region of the AMI. For example, eu-west-1.The EC2 region, which must be valid for the AMI that you selected.
    AWS Security GroupdefaultThe security group of the AMI.
    Instance Typem1.smallThe size of the instance.
    AWS key pair nameYour AWS key nameName of your EC2 SSH key pair. If you do not have an AWS key name, log in to the Amazon EC2 console, create a new key, and download it to your local machine.
  3. Click Save.

    Sample aws.ec2.InstanceSpec CI

Create an SSH host template

  1. Hover over the 1.0.0 package, click Explorer action menu, and select New > template > Overthere > SsHost.

  2. Enter the following properties:

    PropertyValueDescription
    Nametomcat-hostThe name of the CI.
    Operating SystemUNIXOperating system of the virtual machine.
    Connection TypeSUDOPuppet requires a SUDO connection.
    Address{{%publicHostname%}}This is a placeholder that will be resolved from the provisioned.
    UsernameubuntuUser name for the EC2 machine.
    Private Key FileSSH_DIRECTORY/{{%keyName%}}.pemThe location of the SSH key on your local machine to use when connecting to the EC2 instance. SSH_DIRECTORY is the directory where you store your SSH keys. for example, Users/yourusername/.ssh.
    SUDO usernamerootThe user name to use for SUDO operations. This property is located on the Advanced section.
  3. Click Save.

    Create an SshHost host template

Create a Tomcat server template

  1. Hover over the tomcat-host CI, click Explorer action menu, and select New > Template > Tomcat > Server.

  2. Enter the following properties:

    PropertyValueDescription
    Nametomcat-serverThe name of the CI
    Home/opt/apache-tomcatPuppet will install Tomcat in this directory
    Start Commandsh bin/startup.shThe command that will start Tomcat
    Stop Commandsh bin/shutdown.shThe command that will stop Tomcat
  3. Click Save.

    Create a tomcat server template.png

Create a Tomcat virtual host template

  1. Hover over the tomcat-server CI, click Explorer action menu, and select New > template > tomcat > VirtualHost.
  2. In the Name field, enter tomcat-vh.
  3. Click Save.

Create a directory to store generated CIs

  1. Hover over Infrastructure, click Explorer action menu, and select New > Directory.
  2. In the Name field, enter Tomcat.
  3. Click Save.

Step 4 - Bind the SSH host template to the instance spec

To bind the tomcat-host template to the tomcat-instance-spec provisionable:

  1. Double-click tomcat-instance-spec to open it.

  2. Go to the Common section.

  3. Under Bound Templates, select Applications/PetClinicEnv/1.0.0/tomcat-host from the drop down list.

  4. Click Save.

    Bind the SSH host template to the instance spec

Step 5 - Add a Puppet provisioner

  1. Hover over tomcat-instance-spec, click Explorer action menu, and select New > Puppet > provisioner > Manifest.
  2. In the Name field, enter install-tomcat.
  3. In the Host Template field, select tomcat-host.
  4. In the Choose file field, click Browse and upload a Puppet manifest file that will install Tomcat.
note

You can also specify the Artifact location in File Uri field.

  1. Click Save.

    Adding modules to the provisioner

Add modules to the provisioner

  1. Hover over the tomcat-instance-spec CI, click Explorer action menu, and select New > puppet > provisioner > Module.

  2. In the Name field, enter puppetlabs-tomcat.

  3. In the Host Template field, select tomcat-host.

  4. In the Module Name field, enter puppetlabs-tomcat.

  5. Click Save.

  6. Repeat steps 1 to 5 and enter puppetlabs-java for the Name and Module Name fields.

note

If you open tomcat-instance-spec CI, you will see the modules.

Sample puppet.provisioner.Manifest CI with module specs

Step 6 Create the AWS provider

Create a new provider for Amazon Web Services (AWS):

  1. Hover over Infrastructure, click Explorer action menu, and select New > aws > Cloud.
  2. In the Name field, enter AWS-EC2.
  3. In the Access Key ID field, enter your AWS ID.
  4. In the and Secret Access Key field, enter AWS access key.
  5. Click Save.

Sample aws.ec2.Cloud CI

Step 7 Create an environment

Create an environment where the package will be provisioned:

  1. Hover over Environments, click Explorer action menu, and select New > Environment.
  2. In the Name box, enter Cloud.
  3. In the Containers section, select Infrastructure/AWS-EC2 from the drop down list.
  4. In the Provisioning section, Directory Path field, enter Tomcat.
  5. Click Save.

Environment with aws.ec2.Cloud added

Step 8 Provision the environment

  1. Hover over 1.0.0, click Explorer action menu, and click Deploy.
  2. On the Environments page, select Cloud.
  3. Click Continue.
  4. Click Preview to view the deployment plan.
  5. Click Save.
  6. Click Deploy.

Provisioning plan preview

Results

You can see the generated CIs in the Repository:

Infrastructure CIs generated from bound templates

In this case, the unique provisioning ID was 695hnTMa.

You can also see that the CIs were added to the Cloud environment.

You can now import the sample package PetClinic-war/1.0 from the Deploy server and deploy it to the Cloud environment. When deployment is completed you will see the application running at http://<instance public IP address>:8080/petclinic. You can find the public IP address and other properties in the instance CI under the provider. For more information, see import a package and deploy an application