Over a million developers have joined DZone.

Automated, Self-Service Provisioning of VMs Using HyperForm (Part 2)

Now that you've got your VMs, put them to use. See how to provision your clusters so you can get the most out of them.

· Cloud Zone

Download the Essential Cloud Buyer’s Guide to learn important factors to consider before selecting a provider as well as buying criteria to help you make the best decision for your infrastructure needs, brought to you in partnership with Internap.

Welcome back to learning how to create an automated, self-service provisioning system for your VMs. In part one, we learned how to set up and register your virtual machines on Hyper-V using HyperForm. Now, we delve into provisioning. Without further delay...

Provisioning Virtual Machines on Hyper-V

A user can provision Hyper-V virtual machines on the newly created cluster either through a UI-based workflow or by defining a simple YAML-based Machine Compose template that can be requested from the Self-Service Library. The recommended approach is the Machine Compose template as it provides more security and standardization.

UI-based Workflow: A user can request a Hyper-V virtual machine by navigating to Machines and then clicking on the +New button to select Hyper-V. Once the Cloud Provider is selected, a user can select the following options:

  • Node: The Hyper-V Node on which the new VM's will be provisioned.
  • Instance Type  Pre-defined templates are available that specify the CPU, Memory, Disk and Generation for the VM (e.g. cpu=1,memory=2GB,disk=100GB,generation=1). A user can customize these value to his/her needs.
  • Image: This is the .VHDX template that will be used for provisioning.
  • Network: This is the virtual network that will be used for the new VM.
  • Skip Agent Install: This option can be selected if the VM template has the HyperForm agent already pre-installed.
  • Username: This is the username needed to log into the VM.
  • Password: This is the password needed to log into the VM.
  • Cluster: This is the HyperForm cluster that is created by the user.
  • VM Count: This is the number of VM's that can be provisioned simultaneously.
Picture
Picture


A user can then click on the Machine Compose button to generate a YAML-based Machine Compose template. This can be used to create your own standard Machine Compose template that can be shared with other users with granular access controls.

Picture


A user can create a Machine Compose template for Hyper-V by navigating to Blueprints > App/Machine and then clicking on the +New button to select Machine Blueprint.

Here’s an example template for requesting a 4GB virtual machine on Hyper-V.

The supported parameters for the Machine Compose template are summarized below:

  • description: Description of the blueprint/template.
  • instanceType: Mandatory: Cloud provider specific value (e.g. cpu=1,memory=4GB,disk=100GB,generation=1).
  • region: Mandatory: The name of the Hyper-V Node.
  • image: Mandatory: Fully qualified path of the .VHDX template (e.g. \\VFCN10-AD\HyperForm\Template\HyperForm_Ubuntu-14.04_64_10.0.254.100.vhdx).
  • username: This the username used to connect to the VM.
  • password: This can reference a private key stored in the Credentials store. The ID of the credential item stored in the Cloud Providers > Credentials page will be needed. Here's the acceptable format: "{{credentials | 2c91802a520736224015209a6393098322}}".
  • network: Cloud provider specific value (e.g. Virtual Switch1).
  • count: Total no of VM's, defaults to 1.

In addition to these supported parameters, you will also notice that this template is referencing a "plugin". A plugin can be invoked as follows:

plugins:
- !plugin
id:  


The plug-in can be created by Navigating to  Blueprints >  Plugins and then clicking on the  button. A plug-in is a simple script that can run on either the server being provisioned or on the Docker container. The server plugins can be used for any number of configuration requirements:
  • Installing Puppet Modules, Chef Recipes, Ansible Playbook, etc.
  • Retrieving the CA certificate needed for the private Docker registry from a secure S3 bucket and then saving it in the right directory (e.g. /etc/docker/certs.d/<domain-name>:5000/ca.crt).

The Machine Compose template has additional advanced options.
  • Cost Profiles: These are the cost profiles that you can create under Policies > Cost Profiles. You can define cost per resource on an hourly/weekly/monthly basis. You can attach multiple cost profiles to a single template — e.g. different cost profiles for the instance type, EBS storage used, etc.
  • Entitled Users: These are the users who are allowed to use this template to provision AWS instances. The entitled users do not have permission to manage or delete this template and will only be able to consume it.


Picture


Once the Machine Blueprint is saved, a user can request this machine from the Self-Service Library. A user can click Customize and then select the Cloud Provider and Cluster to use for provisioning the Hyper-V Virtual Machines.

Picture


Once the Hyper-V VM is provisioned, a user can monitor key statistics like CPU, Memory, Disk Utilization and Containers Running. This can be done by navigating to Machines and then selecting Monitoring or Stats from the Manage drop-down menu.

Picture
Picture


An in-browser terminal to the provisioned machine is also accessible. This can be accessed by navigating to Machines and then selecting Terminal from the Manage drop-down menu.

Picture


A list of the deployed applications on a virtual machine is also accessible. This can be accessed by navigating to Machines and then selecting Apps from the Manage drop-down menu.

Picture


Now that your cluster is set up, you can now run any Docker application on the newly created server(s). This can be done by navigating to the Library and then clicking on Customize on any of the published application templates. You can then select a Cluster and click Run.

Picture


Check out our published Docker application templates -- including multi-tier .NET, ASP.NET, Java stacks, LAMP, LAOP & LAPP stacks, Mongo Replica Set, Couchbase Cluster, MEAN.JS, Wordpress, Drupal, and many others.

The Cloud Zone is brought to you in partnership with Internap. Read Bare-Metal Cloud 101 to learn about bare-metal cloud and how it has emerged as a way to complement virtualized services.

Topics:
modeling ,docker ,production ,docker compose ,virtual machine

Published at DZone with permission of Amjad Afanah, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}