Vagrant Up – Cloudify Your Desktop

 

Vagrant Up | Open Source | Vagrant Cloud | VirtualBox Tutorial | Vagrant Tutorial

While existing resources can be consulted to created a single node Cloudify 3.1 installation, a single purpose walkthrough of the process can simplify the process and save time.  The purpose of this post is to describe how to install the Cloudify 3.1 CLI, bootstrap the simple manager, and a install a sample blueprint on a laptop (or desktop).  Note that if you want to skip the gory details of preparing an environment from scratch, please refer to the excellent walkthrough in the docs, which is also based on Vagrant, but which has everything preconfigured.   The advantage of spelling out the details here is to empower you to test any build of Cloudify at will, and tailor the configuration to your needs.



Cloudify – try it quickly and easily on your desktop. Just vagrant up .  Go


System Preparation

An Ubuntu Linux system version 12.04  is needed to host Cloudify as described here.   Other versions are supported via Docker.  For the purposes of this walkthrough, and especially its goal of being platform independent, Oracle VirtualBox and Vagrant are the tools of choice for creating the proper Ubuntu environment.  You should have at least 2GB of RAM to spare to run the manager and the blueprint, and preferable more.   Install VirtualBox, then once its is installed, install Vagrant as described here.

Create a directory (say cfy), and cd into it.

Start Ubuntu

From the empty “cfy” directory run vagrant init hashicorp/precise64 (assuming you’re running a 64-bit OS.  Otherwise use hashicorp/precise32“.  This will create a Vagrantfile in your directory.  Edit the Vagrantfile, and uncomment the line:

config.vm.network "private_network", ip: "192.168.33.10 

This will give you an IP you can later use to access the box from host OS.

Also uncomment the line:

config.vm.provider "virtualbox" do |vb|

and the line

vb.customize ["modifyvm", :id, "--memory", "1024"]

and the “end” line.

Now change the 1024 in the vb.customize line to however much memory you can spare, 2048 for example.

Prior to starting the instance, copy the file ~/.vagrant.d/insecure_private_key to your current directory (where the Vagrantfile is).  We’ll need it later.  Then type vagrant up .  This will take awhile, as the box has to be downloaded the first time.  When it’s done, type vagrant ssh to enter the new Ubuntu instance.

Start The Manager

Once you have the above prerequisites installed, you are ready to install the Cloudify CLI, and then the manager.  First the CLI:

  1. sudo apt-get update
  2. sudo apt-get -y install python-virtualenv
  3. virtualenv cfy
  4. cd cfy
  5. source bin/activate
  6. sudo apt-get -y install python-dev
  7. wget https://bootstrap.pypa.io/get-pip.py
  8. python get-pip.py
  9. pip install -U setuptools
  10. pip install cloudify==3.1

Next bring up the manager locally:

  1. sudo apt-get install -y git
  2. git clone -b 3.1-build https://github.com/cloudify-cosmo/cloudify-manager-blueprints.git
  3. cfy init
  4. cfy local install-plugins -p cloudify-manager-blueprints/simple/simple.yaml
  5. cp  cloudify-manager-blueprints/simple/inputs.json.template inputs.json
  6. edit inputs.json so it looks like this (with your particulars filled in):

    The public and private IPs should be the same if you followed the instructions exactly, otherwise you can get them from ip a.  The public IP is the one that was uncommented in the Vagrantfile.

  7. cfy bootstrap -p cloudify-manager-blueprints/simple/simple.yaml  -i inputs.json

After awhile (depending on your network), you can verify that the manager is running by pointing a browser at the public ip (e.g.http://192.168.33.10).  You should see the manager UI.

Install and Start a Blueprint from the CLI

From this point forward you can experiment with installing/uninstalling and blueprints.  The nodecellar blueprint is the canonical example.

  1. git clone -b 3.1-build https://github.com/cloudify-cosmo/cloudify-nodecellar-example.git
  2. cp cloudify-nodecellar-example/inputs/singlehost.json.template ncinputs.json
  3. edit “ncinputs.json” so it looks like this:

    As before, change IPs as needed if you diverged from the steps above.

  4. cfy blueprints upload -b nc -p cloudify-nodecellar-example/singlehost-blueprint.yaml
  5. cfy deployments create -b nc -d ncd -i ncinputs.json
  6. cfy executions start -w install -d ncd

Install and Start a Blueprint from the UI

To install and start the blueprint from the UI, perform steps 1-3 above, and then:

  1. Copy the blueprint directory in your VM to the /vagrant directory (cp ~/cp -r cloudify-nodecellar-example/ /vagran”)
  2. In the /vagrant/cloudify-nodecellar-example directory, rename singlehost-blueprint.yaml to blueprint.yaml.
  3. In the /vagrant directory, run COPYFILE_DISABLE=true tar czf nc.tar.gz cloudify-nodecellar-example/
  4. From the Blueprints tab on the UI, select Upload Blueprint and select the nc.tar.gz file in the directory where you started the Vagrant box.
  5. Set the blueprint name to nc.
  6. Select save on the dialog.
  7. The blueprint is now uploaded.  Press the Create Deployment button.
  8. Name the deployment ncd, and fill in the parameter values like so:
    • agent_private_key_path: /vagrant/insecure_private_key
    • agent_user: vagrant
    • host_ip: 192.168.33.10
  9. The deployment will be created and you will be placed in the deployments view/tab.  Expect a small delay as the manager side services are spun up for the deployment.
  10. On the select workflow option box, select Install and press the arrow to the right.  The install will begin.  It will complete in about 5 minutes, depending on your hardware.

For a detailed exploration of the Nodecellar blueprint, please refer to the guide.

Conclusion

This concludes the walk through.  We’ve created a handy environment for exploring and even writing your own blueprints.  When you’re not in need of the platform you can pause it with the vagrant halt command; to completely destroy the environment, use vagrant destroy;.  If you are exploring the possibilities of writing your own blueprints, do yourself a favor and explore the cfy local command; highly recommended.

 



Leave a Reply