Posts

Deploy The Tornado Chat Demo On The Stackato PaaS Sandbox

stackato logo

ActiveState have recently released their Stackato PaaS (Platform-as-a-Service) which is based on VMware’s open-source PaaS, Cloud Foundry, and offers an enterprise PaaS solution that will run on any public cloud, private cloud, laptop or desktop.

In this blog post I’ll go through an example, in repeatable steps, of how to get up and running with the Tornado chat demo on ActiveState’s public sandbox for Stackato.

Tornado is an event-driven application framework written in Python. It is used by Quora, Summify, Facebook, Friendfeed and my own Cooq.com. Stackato supports a multitude of languages and frameworks, so Tornado could be swapped out with one of the many other demos available, which include PHP, Perl, Ruby, Node.js, Java or Clojure. Although the JVM languages (Java and Clojure) are currently not supported due to their heavy resource requirements. This demo application also uses MongoDB as its backend datastore.

Get An ActiveState Account

Sign up for an ActiveState account

You get the usual verification email to confirm your email address.

Install The Stackato Client

The server software and various virtual machines, which contain the pre-installed server software, is available for download, we do not need them, since here we are using the ActiveState’s sandbox for all our server requirements.

Download Stackato Client (v0.18 at time of writing this).

unzip stackato-0.3.13.0.18-macosx10.5-i386-x86_64.zip
chmod +x stackato-0.3.13.0.18-macosx10.5-i386-x86_64
mv stackato-0.3.13.0.18-macosx10.5-i386-x86_64 /usr/local/bin/stackato

Note: Be sure /usr/local/bin is in your $PATH before continuing

Sandbox Terms and Services

I thought I’d include the limitations of what you can do with the Sandbox.

  • You can use the Sandbox at no charge for up to 45 days
  • It is not for production use
  • Applications launched will resolve to a *.sandbox.activestate.com URL
  • Account resources is limited to 256Mb application memory, 10Gb disk-space and 50Gb bandwidth
  • Maximum of 2 applications (Python, Perl, Ruby, Node.Js, or other languages as supported in the Sandbox)
  • Maximum of 2 services which represent a given database, such as MySQL, MongoDB, Redis, or Postgres

You should read the full terms and services for more details.

Obtaining Stackato Sandbox Access

Request access to the Stackato Sandbox from the main Stackato page.

You can find your Sandbox username and password on your ActiveState account page.

Deploying The Demo Application

First inform the stackato client which Stackato installation your will be deploying to. ActiveState’s Stackato Sandbox is found at https://api.sandbox.activestate.com, so we run the following command.

$ stackato target https://api.sandbox.activestate.com

Successfully targeted to [https://api.sandbox.activestate.com]

Next, login to Stackato using stackato login.

$ stackato login

Email: <your email>
Password: ****************
Successfully logged into [https://api.sandbox.activestate.com]

Checkout the demo applications, from github, locally onto your machine.

$ cd ~/src
$ git clone https://github.com/ActiveState/stackato-samples

Cloning into stackato-samples...
remote: Counting objects: 2353, done.
remote: Compressing objects: 100% (1152/1152), done.
remote: Total 2353 (delta 1067), reused 2319 (delta 1033)
Receiving objects: 100% (2353/2353), 1.05 MiB | 275 KiB/s, done.
Resolving deltas: 100% (1067/1067), done.

Choose your demo application by simply cd’ing into that directory…

$ cd stackato-samples/python/tornado-chat-mongo

The first time I ran the deployment I just accepted all the defaults…

$ stackato push tornado-chat

Would you like to deploy from the current directory ?  [Yn]:
Application Deployed URL [tornado-chat.sandbox.activestate.com]:
Application Url: tornado-chat.sandbox.activestate.com
Detected a Python Application, is this correct ?  [Yn]:
Memory Reservation [64M]:
Creating Application [tornado-chat]: Error 701: The URI: 'tornado-chat.sandbox.activestate.com' has already been taken or reserved

The default domain tornado-chat.sandbox.activestate.com is already taken, so I’ll need to come up with another one.

Let’s run stackato push tornado-chat again, but this time use a custom sub-domain…

$ stackato push tornado-chat

Would you like to deploy from the current directory ?  [Yn]:
Application Deployed URL [tornado-chat.sandbox.activestate.com]: bigfastblog-chat.sandbox.activestate.com
Application Url: bigfastblog-chat.sandbox.activestate.com
Detected a Python Application, is this correct ?  [Yn]:
Memory Reservation [64M]:
Creating Application [tornado-chat]: OK
Creating mongodb Service [mongo-chat]: OK
Binding Service [mongo-chat]: OK
Uploading Application [tornado-chat]:
  Checking for available resources: OK
  Packing application: OK
  Uploading (7K): 100% OK
Push Status: OK
Staging Application [tornado-chat]: OK
Starting Application [tornado-chat]: OK

Our App In Action

$ stackato apps

+--------------+---+---------+------------------------------------------+------------+
| Application  | # | Health  | URLS                                     | Services   |
+--------------+---+---------+------------------------------------------+------------+
| tornado-chat | 1 | RUNNING | bigfastblog-chat.sandbox.activestate.com | mongo-chat |
+--------------+---+---------+------------------------------------------+------------+

On visiting my custom sub-domian bigfastblog-chat.sandbox.activestate.com, we encounter the Google OAuth login.

Bigfastblog-chat.sandbox.activestate.com is asking for some information from your Google Account

After clicking “Allow”, we’re taken to the rather basic chat interface that is the Tornado Chat demo.

We are logged in our as Google Accounts user and can start chatting!

chat

Stop The Chatter

We can stop the application, if we intend to restart again.

$ stackato stop tornado-chat
$ stackato apps

+--------------+---+---------+------------------------------------------+------------+
| Application  | # | Health  | URLS                                     | Services   |
+--------------+---+---------+------------------------------------------+------------+
| tornado-chat | 1 | STOPPED | bigfastblog-chat.sandbox.activestate.com | mongo-chat |
+--------------+---+---------+------------------------------------------+------------+

Encase you are curious, this is what you’ve seen when you visit your sub-domain for this app…

deleted

VCAP ROUTER: 404 - DESTINATION NOT FOUND

No application is currently registered at this URL. If you are the site owner,
please make sure that your application is in RUNNING state by running the
`stackato stats 

Or we can simply delete it from the Sandbox.

$ stackato delete tornado-chat

Provisioned service [mongo-chat] detected would you like to delete it ?:  [yN]: y
Deleting application [tornado-chat]: OK
Deleting service [mongo-chat]: OK

$ stackato apps

No Applications

Conclusion

The Stackato sandbox gives you a great way to get a small taste of what Stackato is all about. When you graduate past using the sandbox, you will want to look at the “micro-cloud”. It’s free indefinitely for non-commercial use.

Resources

Comments

  1. jiaxiaolei

    hi, phil:

    I read your words about stackato in python-tornado groups, and according to your gudiance I finished a server in ~/src/stackato-samples/python of my own computer. you can find it in “https://jia-tornado-chat.sandbox.activestate.com/”

    A couple advises may be provided as follows:

    1: when you try to login, the default url is “https://api.stackato.local”, so :

    $ stackato login
    Attempting login to [https://api.stackato.local]
    Email: [email protected]
    Password: ****************
    Cannot access target (couldn’t open socket: host is unreachable (Name or service not known)

    In my view, some description like below should be appeared in your blog, do you think so ? :D

    $ stackato target https://api.sandbox.activestate.com
    Successfully targeted to [https://api.sandbox.activestate.com]

    2:Use the tornado-chat-mongo, I push my app in ActiveState. You can see in the url https://jia-tornado-chat.sandbox.activestate.com/
    okay, compared with your blog, it’s ugly!
    so, can you tell me what did you do about the blog we were watching ?
    Any response will be welcome!