Deploy and develop your application in a PaaS - 0 to awesome in 3 minutes


Presented by:

Steven Pousty

talks.thesteve0.com/devnexus

@TheSteve0 on Twitter, IRC, Instagram, Ingress, SmugMug, and Github

 

Agenda

  1. Learn a bit about PaaS
  2. A little about OpenShift
  3. See some JEE6, MongoDB, and Spatial in Action

Assumptions

  1. You like writing code rather than managing servers
  2. You can use command line, git, and ssh
  3. You like being an Admin rather than dealing with Devs

But I know EC2...

One Source to Bind Them All


 

 

But wait - there's more

  1. Free! No time limit
  2. 3 gears (like servers) - each 512 Mb RAM, 1 Gb disk
  3. Auto-scaling
  4. Simple pricing

JEE - CDI and JAX-RS

  • Context Dependency Injection - allows you to make classes availble whenever you need them and let the calling class decide which class it wants
  • JAX-RS - the antiSOAP (three cheers). Makes it super easy to write REST like architectures

On to NoSQL and Mongo

 

A bit about MongoDB

  • A document is just a bunch of attributes and values - think of it like HashMap
  • Can be nested - helps avoid joins
  • Schemaless
  • Really good at fast writes - but you give up immediate consistency
  • Easy to horizontally scale

Now some spatial

The spatial functionality Mongo currently has is:

  1. Near ($near)
  2. Containment ($geoWithin)
  3. Intersection ($geoIntersects )


Two types of indices:

  1. 2D - for flat surfaces
  2. 2dsphere - helps with coords on an earth like sphere

How do you make it work

1. Put coordinates into an array


				{ loc : [ 50 , 30 ] }
				{ loc : { x : 50 , y : 30 } }
				{ loc : { foo : 50 , y : 30 } }
				{ loc : { lon : 40.739037, lat: 73.992964 } }
                    
                    If you use spherical make sure to put [lon, lat]
				    

2. Make a 2D index


				    	db.places.ensureIndex( { loc : "2dsphere" } )
				    	
				    	or
				    	
				    	db.places.ensureIndex( { loc : "2d" } )
				    

Let's look at some code

The app: http://bit.ly/1fiMrQd or http://jeemongomap-spatial.rhcloud.com/

On github https://github.com/thesteve0/jeemongomap

Let's wrap it up

  1. Openshift makes life great for you
  2. Spatial is easy and fun with MongoDB
  3. Free!
  4. Github repo: https://github.com/thesteve0/jeemongomap

Come hang out with us:
#openshift or #openshift-dev on freenode irc
OR
users@lists.openshift.redhat.com