blog single gear
Tutorials

100-day Challenge #011: Running chatapp on Cloud Foundry

Translator’s note: This is the fourth article of the series “Cloud Foundry 100-day Challenge selection”. “#011” in the title means that it is 11th (published on June 18, 2015) in the original Japanese series.


The 11th topic of “Cloud Foundry 100-Day Challenge” is chatapp, which is a chat application written in Python. Let us deploy it and enjoy some chatting.

Basic Information

Retrieving Source Code

$ git clone https://github.com/vinceprignano/chatapp.git

Enter into the chatapp directory.

$ cd chatapp/

Pushing Application

Since this is a simple chat application in Python that does not even use a database, let us push it as is first.

$ cf push chatapp
Creating app chatapp in org ueno / space test1 as ueno...

:

As we let it run, a Python environment is being built, the deployment proceeds, and ..

:

requested state: started
instances: 1/1
usage: 256M x 1 instances
urls: chatapp.10.244.0.34.xip.io
last uploaded: Wed Jun 17 06:14:50 +0000 2015
stack: lucid64

     state     since                    cpu    memory        disk      details   
#0   running   2015-06-17 03:16:46 PM   0.0%   70M of 256M   0 of 1G  

The deployment has been successful, and the application has been started!

Checking Application Behavior

Anyways, the application is running, so let us go ahead and access the URL http://chatapp.10.244.0.34.xip.io first.

Initial Screen (User Entry)

Enter user name.

Chat Screen

Enter with multiple users, and chat away.
You will be able to enjoy chatting in real time.

In Conclusion

And just like that, with merely a simle push command! Today, we have confirmed how easy things can be with Cloud Foundry.

By the way, today’s application should require the python-buildpack , since Python is used. How was this processed? The answer is that the buildpack was already included, by default, in the bosh-lite environment which we used. Let us confirm.

$ cf buildpacks
Getting buildpacks...

buildpack          position   enabled   locked   filename
java_buildpack     1          true      false    java-buildpack-v2.5.zip
ruby_buildpack     2          true      false    ruby_buildpack-offline-v1.1.4.zip
nodejs_buildpack   3          true      false    nodejs_buildpack-offline-v1.0.4.zip
go_buildpack       4          true      false    go_buildpack-offline-v1.0.4.zip
python_buildpack   5          true      false    python_buildpack-offline-v1.0.5.zip
php_buildpack      6          true      false    php_buildpack-offline-v1.0.2.zip

If your current environment doesn’t have the python-buildpack, please specify -b https://github.com/cloudfoundry/python-buildpack when executing the push for the application. Alternatively, you can also create a manifest file and write in the specifications, like you found in the end section of the fifth article. (Translator’s note: the “fifth article” indicates the one in the original Japanese articles, which is Running 243 Game on Cloud Foundry.)

The Environment Used in this Post

Written by: Isoo Ueno