Wednesday, November 20, 2013

Importing a bootcamp partition into VMWare Fusion when it has Hyper-V enabled.

This is quick note on importing a Windows 8 or Server 2012 BootCamp partition that had Hyper-V hypervisor enabled.

By default, you cannot have Hyper-V booted inside of Fusion because of hardware vitualization conflicts.  You know you have this problem if you see the following messages in the guest machine's window in VMWare Fusion.
Your PC ran into a problem and needs to restart.  We're just collecting some error info, and then you can restart. (100% complete)
If you'd like to know more, you can search online later for this error:  SYSTEM_THREAD_EXCEPTION_NOT_HANDLED (winhv.sys)

Edit the Fusion VMX configuration file directly.

You can fix this by editing the vmx file directly.


  1. Shutdown Fusion
  2. Find your Virtual Machine definition. Navigate to /users/<username>/Library/Application Support/VMWare Fusion/VirtualMachines/Boot Camp.
  3. Right Click on the Boot Camp package and select Show Package Contents
  4. Edit the file that ends in .vmx using TextEdit or your default file editor
  5. Add a line at the end containing
    hypervisor.cpuid.v0 = "FALSE"
  6. Save the file.
  7. Launch Fusion 
  8. Run the imported BootCamp virtual machine


Using the GUI

You're supposed to be able to do this via the Fusion 6 GUI but that did not work for me. This section is here to provide breadcrumbs for future searchers with this problem.

  1. Bring down the crashed imported Boot Camp virtual machine
  2. Edit the Virtual machine settings via the menu Virtual Machine Settings --> Processors & Memory --> Advanced
  3. Check "Enable hypervisor applications in this virtual machine"
  4. Close the settings
  5. Restart the virtual machine






Monday, November 18, 2013

Micro Clound Foundry V2 - PaaS with Stackato - Languages and Applications

A previous blog article described how to set up a developer micro PaaS using the Cloud Foundry based Stackato from ActiveState.  This article will describe some of the languages available in this environment.

Application Languages

Cloud Foundry and the Application Stackato clusters support the following languages "out of the box". You can use any of these languages in the Micro CloudFoundry instance we just configured
  1. Java, using the Tomcat server
  2. Node.js
  3. Perl
  4. PHP
  5. Python
  6. Ruby
.Net languages are supported through either the Mono runtime or integrated .Net support provided by Iron Foundry. Active State has several wiki/blog pages on this.

Other languages, including Clojure, can be added by importing Heroku BuildPacks.

Demo Apps

Stackato demo programs http://community.activestate.com/stackato/demos  Some are also available through the app store in the browser based command console.

Hopefully I'll put together another blog article with some demo deployments







Micro Clound Foundry V2 - PaaS on a stick the easy way with Stackato

Cloud Foundry Open Source Platform as a Service (PaaS). It was initially driven by VMWare and later given to Pivotal when it was spun off from VMWare and EMC. The original version of Cloud Foundry was available as a hosted service and in a Micro developer version that ran on a single VM that could be hosted on a developer workstation.  A community grew around this and there are now multiple versions of Cloud Foundry available.



Cloud Foundry supports a Multi-tenant architecture where a cloud can support multiple organizations each of which can have multiple spaces to partition their work.  This architecture is available across all CF PaaS installations.


Cloud Foundry updated to a new V2 architecture and implementation in June of 2013.  The CF "on a stick" micro version was abandon at that time. The Micro-CF codebase was apparently a separate code base from the main line.  The CF developers do build and test on local (to their machine) virtual machines that run miniature versions of CF.  Documentation on running locally is available on the Cloud Foundry docs site using either Vagrant or Nise-Bosh. I found this really complicated for someone who wants to write apps.

Developer CF the Simpler Way with ActiveState Stackato

ActiveState implements a PaaS based on CloudFoundry that can be hosted by them, deployed in VMWare, hosted in Amazon EC2, hosted onsite or other custom configurations.  Their 3.x, currently 3.0.0 beta, is based on the new CloudFoundry V2 code base.  They provide a really nice pre-built virtual machines for developers that you can download from their website.  ActiveState provides great 3.0 release notes that can give you a feel for how the Micro version is configured and what the differences are between Micro and Enterprise

ActiveState provides developer images in 4 different formats, VirtualBox, VMWare (Workstation/Fusion/Player), VMWare VSphere and KVM.  The virtual machine is a 1.2GB download that uses 5.6GB when unpacked.  The VM grow-on-demand virtual disk can expand to 58GB as you use it.  Plan accordingly.

Setup

You should know the following before installation

Documentation Highlights

  • Stackato has nice documentation on their web site
  • The downloaded Micro PaaS VM uses bridged networking making it visible to all machines on your network. NAT is recommended if you want the VM to be visible only from the machine it is installed on.
  • The VMs network configuration uses Zero-Configuration networking with the Avahai stack. Machines using zero-configuration network are registered in the .local domain. Browsers can browse to .local machines and the ping command can "ping" them.
    • Zero-configuration networking is known as Bonjour Services on Apple machines.  It and mDNS works "right out of the box" on OS/X. 
    • Microsoft does not support this out of the box. A quick test shows that Apple's Bonjour services for windows is not enough to get the VM to work right on a Windows machine. Help can "sort of" be found in the ActiveSite docs
      • The <machine>.local name is picked and can be found by the ping command. 
      • The api.<machine>.local name is not picked up and cannot be found by the ping command.  You may have to edit  c:\windows\System32\Drivers\etc\hosts to add api.<machine>.local.  
      • You will also have to add an entry for each deployed application.  
  • The VM comes with a default user: stackato with password: stackato.  This is used until you set up your own account during the setup process
  • The password for the stackato user will be changed to match the password of the user id you create as part of the setup process.
  • The Micro CF instance is configured for bridged networking by default.  You can use NAT if you wish to hide the VM from machines on your network. 
    • VMNet8 is the NAT network in a VMWare system.

Installation Process

We can now walk through creating a CF Micro VM on our developer workstation based on the Stackato VM. This setup is based on the Stackato documents provided by ActiveState.

  1. Download the VM for your Hypervisor from the ActiveState web site.
  2. Unzip the file.
  3. Move the VM to some directory, probably the default place for virtual machines for your Virtualization software.
  4. Double click on vm.  It can take a while to set up. You should see something like this
  5. You should see a VM console start screen with the machine's .local machine name. Notice the local address that is the admin console address.
  6. Point a browser to https hostname.local you see in the console. In my case it is https://api.stackato-aw7c.local/console/
  7. Create your first user / tenant and log in. 
  8. You should see some help links and be able to browse around to see how your micro-cloud is configured

The Active State Stakato (CF Micro) instance comes with some services pre-enabled but without any service instances created.  You can see all of the components in a given node through the Cluster Nodes admin screen.  This screen shows the internal components and the PaaS services
You can also see just the PaaS services on the Services screen.  These represent services that can be instantiated to support your applications.



Stackato CLI Installation and Configuration

ActiveState provides their own command line program (CLI) that takes the place of the CloudFoundry vmc Ruby command line.  Note: CloudFoundry is also replacing vmc with a new Go based command shell.
  1. Download the client (CLI) from the link on the quick start page. It looks like the latest client is still 2.0.2 even though we're running the V3 3.0.0 beta virtual machine
  2. Unzip the client.
  3. Put the executable somewhere on your $PATH (or %PATH%). I copied it to /usr/local/bin on my Mac and linux machine. 
  4. Make sure the program has the executable flag set on a linux machine.  chmod +x /usr/local/bin/stackato
  5. Launch a terminal window.
  6. Run the client, stackato.
  7. You have to target your CF (Stackato) virtual machine and login from the command line. The Quick Start guide describes this.
    1. Run stackato target
    2. Run stackato login
  8. Notice "Error: No spaces available to chose" in the previous image.  That's because I hadn't created a space for my organization "FreemanSoft Inc".  You can create a space on the organization web screen using a web browser or via the stackato create-space <name> command in the command line client.  Your userid will automatically be bound to the space when you create it.
    • Example: I ran this command:
      stackato create-space dev
      to create a "dev" space in my organization.

Services, Service-Plans, Provisioned Services and Service Instances

Cloud Foundry applications are made up of the application executables plus some set of PaaS services.  Those services can be caching, database, messaging or other 3rd party programs.  Cloud Foundry uses the following terms.

  • Services: The service types that are available in a Cloud Foundry cluster.  Standard types include memcached, Mongodb, RabbitMQ, Redis, etc. A service definition includes charging algorithms and default configuration for instantiated services. 
  • Service-Plans: ActiveState's name for Services. You will see this name in the CLI response
  • Service Instance: A deployed service that can be bound to by an application. There can be multiple instances of a service in a Cloud Foundry cluster.  Each instance has a unique name that is used as part of the binding process.
  • Provisioned Services: Another name for a Service Instance.


Stackato comes with support for several open source packages.  Each service has a default configuration that is applied to any created instance.  You can reach the settings via the web interface.  The following menu shows all the features available "out of the box" in a ActiveState Stackato Micro instance.

The Micro edition comes with three default  service-plans (roles) enabled:  file system, MySql, Postgres.  You can find these in the web console 



or the command line with the stackato services command:
This matches with the 3.0 release notes which mention:
  • [97164] Micro cloud starts with Memcached, Redis, PostrgreSQL, RabbitMQ, and MongoDB roles disabled by default (enable via Managment Console).

Enabling Additional Roles / Services

You can enable additional roles ("service-plans") via the Admin->Cluster admin screen which





Click on the configuration icon on the panel and the role admin floating pane will come up showing the default/current list of services
















Select any of the services you'd like to add.  Here we enable MongoDB, Rabbit MQ 3.x and Redis.















You can also see the newly enabled services with the stackato services command in the Service Plans  section




Service (Plan) / Role Notes

  1. Harbor http://www.activestate.com/blog/2013/04/java-debugging-stackato-harbor and load-balancer can be used to provide external access to components inside the cloud. This is useful when opening up non-http ports for debuggers and other non-web monitors.  Normally you only open http/https and run everything else interal to the micro "data center"
  2. RabbitMQ is rabbit 2.x (2.8.7 as of 11/2013)
  3. RabbitMQ3 is rabbit 3.x (3.1.3 as of 11/2013)
  4. You can add new services to a Cloud Foundry Cluster.  See this web page for details

PaaS Service Instance Creation

You create services instances that can be used by applications. The applications bind to services by name using custom Cloud Foundry configuration.  This decouples the application from the location of the PaaS service.  You can have multiple services of the same service type with different names.  Different Cluster deployed applications can use the different instances or they can share.

Example MongoDB Instance Creation

Here we create two MongoBb services, mongodb1 and mongodb2 using the Command Line Interface (CLI).  
  1. stackato create-service mongodb mongodb1
  2. stackato create-service mongodb mongodb2

We then list the services plans and instances from the command line:
  1. stackato services









Cloud services are not visible from outside the cluster. They are private to the cluster applications.  Cloud Foundry does provide tunneling capability that can make services visible for debugging, data loading or other needs.

You can get a feel for the internal deployment model of cloud foundry by using the Virtual Machine console.  Here we see the two instances of MongoDB deployed above.



Cloud Foundry Command Line Tools

Cloud Foundry's command line tools can also be used with Stackato in the same way they can be used with any true Cloud Foundry based PaaS. Cloud Foundry V2 (June 2013) replaces the Cloud Foundry V1 vmc ruby modules with new Ruby cf modules.  The latest version at the time of this article is cf-V5.  The Cloud Foundry team has already proposed replacing cf-V5 with cf V6 written in Golang, the Go programming language.  In the mean time this section describes how to connect to a CF instance and do basic operations with the Ruby based cf-v5. 
  1. Install Ruby on your machine.
  2. Add "cf" ruby gems with gem install cf
  3. Connect to the Cloud Foundry Instance with cf connect <hostname>.local
  4. Log into the Cloud Foundry Instance with cf login <username>
  5. Get a list of all the configured service instances using the cf services command.
  6. I couldn't find a simple way of seeing all the available services, service-plans.  You can cheat and find a list of services by running cf create-service with no service type .  It will list all the available service types.  Press control-c to end the command.

Writing and Deploying Applications to Micro CF

Future blog articles will describe the languages available in Cloud Foundry in general and the ActiveState PaaS in particular.  Click to read a description of the languages available in this micro cloud.