Using the Mesosphere Technology Stack in Skytap Cloud
Skytap recently announced the availability of the Mesosphere Technology Stack template in the Skytap Public Template Library.
The Mesosphere Technology Stack is a framework for developers and system admins to build out self-healing, fault-tolerant and scalable solutions on top of Apache Mesos. You can find out more about Mesosphere at http://mesosphere.io. This template allows you to easily experiment with the Mesosphere Technology Stack within Skytap.
To illustrate this, we’ll do the following:
- Create a new Skytap environment that is based on this Mesosphere Technology Stack template.
- Make the Mesosphere environment running in Skytap visible to interfaces external to Skytap
- From a site external to Skytap use the Marathon API and web interfaces to deploy, scale and destroy a Docker container in the Marathon Technology Stack environment running in Skytap.
Create a Skytap Environment Based on the Mesosphere Technology Stack Template
Once you log into your Skytap Cloud account, navigate to the Template’s tab and search for “Mesosphere” within the “Skytap” templates.
Next, select the drop-down menu associated with the template and choose “Deploy as New Configuration”:
Once the Mesosphere Technology Stack environment is deployed we will use the Skytap Published Service feature to expose the Marathon port, 8080, on our Mesosphere Technology Stack environment to external sites. To do this, click on the gear icon on the VM in the Configuration Details page:
Now click on “Add Published Service”
Specify port 8080 and click the “Add Published Service” button:
This action maps port 8080 in our Mesosphere Technology Stack VM to a unique port within Skytap. To see this port mapping, click “Show Published Services”:
In the following screenshot we can see that port 8080 in our Mesosphere Technology Stack VM has been mapped to “services-uswest.skytap.com:26413”.
To verify that all is well, we can now connect to the Marathon process in our Marathon Technology Stack VM from sites external to Skytap. In the following screenshot, I am accessing Marathon from my desktop development computer – note the URL in the browser address bar:
Now that we have verified our connectivity to our Skytap Mesosphere Technology Stack environment, we can use the Marathon API to create a task that launches a Docker container. First we need to create a configuration file for the Docker container creation task. The contents of the configuration file, which I have saved to my desktop as “Docker.json” are as follows:
This configuration file configures a Marathon task to launch a Docker Ubuntu container and run a simple shell script in that container. Note that it allocates a fractional CPU as well as 512 Mb of memory to the Ubuntu container.
Using a terminal window, I can use the following: “curl” command to interact with the Marathon API through the Published Service on my Skytap Mesosphere Technology Stack environment:
This command uses the Marathon API to instruct Marathon to launch our specified Docker task. We can confirm the proper operation of this action by using the Marathon web interface:
In the above image we can see that our Ubuntu container has been created. We can click on the line that describes the task to see more details on the task as well as interact with it:
If we click on the “Scale” button, we can create additional instances of the task. For purposes of this exercise, I will scale this task to a total of 3 instances:
Refreshing the browser shows the result of this operation:
We can see that two additional instance of the task have been created and one has already started while the third has been staged and will start soon.
We can also interact with Marathon to destroy or suspend tasks. In the screen below, I have selected all three of the running tasks and will click the “Destroy” button to terminate them:
A review of the Marathon web interface confirms that the tasks have been terminated:
We’ve created a Mesosphere Technology Stack environment in Skytap from the Mesosphere Technology Stack template in the Skytap Public Template Library and then exposed the Marathon port on a VM in that environment to allow access by external interfaces. Then, from an external computer, we used the Marathon web interface and the API to create a simple Docker application. We then scaled that task to 2 additional instances and finally terminated those running tasks.
You can easily use Skytap and the Mesosphere Technology Stack template to expand these exercises into more complex or interesting scenarios based on your requirements. You can find out more about Mesosphere at http://mesosphere.io.
Please contact Skytap 1-888-759-8278 or http://www.skytap.com for more information about Skytap Cloud.