Getting Started

1. Install the RHC Client Tools for your platform

2. Set up RHC and connect your OpenShift account

Go to where you want your project to live and type:

                            
$ rhc setup
                            
                    

You'll have to enter the OpenShift username and password you were sent by email. Enter 'yes' for generating a token and uploading your key to OpenShift. Use your team name as a namespace (or a similar variant if it's already taken).

3. Create your application's base files

For Node.js (version 0.6) projects

						
$ rhc app create MyApp nodejs-0.6   # version 0.6 only
						
					

For Node.js (any other version), you'll need to use something like openshift-origin-cartridge-nodejs

						
$ rhc create-app MyApp https://raw.github.com/wshearn/openshift-origin-cartridge-nodejs/master/metadata/manifest.yml
						
					

For Ruby projects

						
$ rhc app create MyApp ruby-1.9
						
					

For Python projects

						
$ rhc app create MyApp python-2.6
						
					

For PHP projects

						
$ rhc app create MyApp php-5.3
						
					

4. Add a database (if needed)

For MySQL

                        
$ rhc cartridge add mysql-5.1 -a MyApp
                        
                    

For MongoDB

                        
$ rhc cartridge add mongodb-2.0 -a MyApp
                        
                    

For PostgreSQL

                        
$ rhc cartridge add postgresql-9.2 -a MyApp
                        
                    

5. Add your Github repository as a remote

Go to your project directory and add your Github repository URL as a remote:

                        
$ git remote add github https://github.com/user/repo.git
                        
                    

If, during the hackathon, you want to commit without deploying, just push to the "github" remote:

                        
$ git push github
                        
                    

6. Deploy!

Your origin will be automatically set to push to OpenShift servers and deploy your project:

                        
$ git add path/to/newfile
$ git commit -m "commit message"
$ git push origin
                        
                    

Once deployed, your project will be available at: [appName]-[namespace].rhcloud.com

Node

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Popular Node.js frameworks are Express, Geddy, Derby and Meteor.


APIs & Examples

Socket.IO

Socket.IO aims to make realtime apps possible in every browser and mobile device, blurring the differences between the different transport mechanisms. It's care-free realtime 100% in JavaScript.

NPM Install
                        
npm install socket.io
                        
                    
Server
                        
var io = require('socket.io').listen(80);

io.sockets.on('connection', function (socket) {
  socket.emit('news', { hello: 'world' });
  socket.on('my other event', function (data) {
    console.log(data);
  });
});
                        
                    
Client
                        
<script src="/socket.io/socket.io.js"></script>
<script>
  var socket = io.connect('http://localhost');
  socket.on('news', function (data) {
    console.log(data);
    socket.emit('my other event', { my: 'data' });
  });
</script>
                        
                    
Learn More View on Github

PubNub

NPM Install
                        
npm install pubnub
                        
                    
Example Usage
                        
var pubnub = require("pubnub").init({
    publish_key   : "demo",
    subscribe_key : "demo"
});
                        
                    
Publish
                        
var stdin = process.openStdin();
stdin.on( 'data', function(chunk) {
    pubnub.publish({
        channel : "my_channel",
        message : ''+chunk
    });
});
                        
                    
Listen
                        
pubnub.subscribe({
    channel  : "my_channel",
    callback : function(message) {
        console.log( " > ", message );
    }
});
                        
                    
Learn More View on Github

Ruby

Ruby is a language of careful balance. Its creator, Yukihiro “Matz” Matsumoto, blended parts of his favorite languages (Perl, Smalltalk, Eiffel, Ada, and Lisp) to form a new language that balanced functional programming with imperative programming.

The most popular Ruby frameworks are Ruby on Rails, Sinatra and Firehose


APIs & Examples

PubNub

Require PubNub Gem
                        
require 'pubnub'
Instantiate a new PubNub Object

pubnub = Pubnub.new(
    :publish_key   => 'demo', # publish_key only required if publishing.
    :subscribe_key => 'demo', # required
    :secret_key    => nil,    # optional, if used, message signing is enabled
    :cipher_key    => nil,    # optional, if used, encryption is enabled
    :ssl           => nil     # true or default is false
)
                        
                    
Publish
                        
a "String"
a Number 123
an array [ 1, 2, 3 ]
an object { :a => "apple" }
it will be serialized as a JSON for the transport to your mobile and web apps.
@my_callback = lambda { |message| puts(message) }

pubnub.publish(
    :channel  => :hello_world,
    :message  => "hi",
    :callback => @my_callback
)
                        
                    
Subscribe
                        
pubnub.subscribe(
    :channel  => :hello_world,
    :callback => @my_callback
)
                        
                    
Learn More View on Github

PHP

PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.

Popular PHP frameworks are Laravel, FuelPHP and Ratchet


APIs & Examples

PubNub

PHP Push API
                        
$pubnub = new Pubnub(
    "demo",  ## PUBLISH_KEY
    "demo",  ## SUBSCRIBE_KEY
    "",      ## SECRET_KEY
    false    ## SSL_ON?
);
                        
                    
Publish
                        
$info = $pubnub->publish(array(
    'channel' => 'hello_world', ## REQUIRED Channel to Send
    'message' => 'Hey World!'   ## REQUIRED Message String/Array
));
print_r($info);
                        
                    
Subscribe
                        
$pubnub->subscribe(array(
    'channel'  => 'hello_world',        ## REQUIRED Channel to Listen
    'callback' => function($message) {  ## REQUIRED Callback With Response
        var_dump($message);  ## Print Message
        return true;         ## Keep listening (return false to stop)
    }
));
                        
                    
Learn More View on Github

Python

Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs. Python runs on Windows, Linux/Unix, Mac OS X, and has been ported to the Java and .NET virtual machines.

Popular Python web frameworks are Django, Flask and Tornado


APIs & Examples

PubNub

                        
pubnub = Pubnub(
    "demo",  ## PUBLISH_KEY
    "demo",  ## SUBSCRIBE_KEY
    None,    ## SECRET_KEY
    False    ## SSL_ON?
)
                        
                    
Publish
                        
info = pubnub.publish({
    'channel' : 'hello_world',
    'message' : {
        'some_text' : 'Hello my World'
    }
})
print(info)
                        
                    
Subscribe
                        
def receive(message) :
    print(message)
    return True

pubnub.subscribe({
    'channel'  : 'hello_world',
    'callback' : receive 
})
                        
                    
View on Github Learn More

Tools

Trello

Infinitely flexible. Incredibly easy to use. Trello keeps track of everything, from the big picture to the minute details.

Team projects are where Trello really shines. Improve communication, eliminate email traffic, and get everyone on the same page—fast.

Learn More

Woopra

Woopra is the leading real-time web analytics and targeted customer engagement service.

A stunning Live Dashboard delivers key real-time stats in a glance, while a simple click will break any metric down to an individual-level view.

Gauge the level of activity of important customer segments currently engaged with your website and dig deeper to discover the users behind the numbers.

Learn More

Example Projects

Firepad

Open source collaborative text editing.

Learn More View Example

Lord of Pomelo

Lordofpomelo is a browser-based MMORPG(massively multiplayer online role-playing game). The backend is written in node.js based on pomelo, which is a fast, scalable, distributed game server framework for node.js.

Learn More View Example

Dashing

Dashing is a Sinatra based framework that lets you build beautiful dashboards.

Learn More View Example