SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
Bring Spatial Love to your Java
             Application



      Shekhar Gulati
      @shekhargulati
      OpenShift Evangelist, Red Hat


1
Building A Location Aware Job Search App




2
User Stories

    As a User, I should be able to find all the jobs.

    As a User, I should be able to find all the jobs near to
    my location.

     As a User, I should be able to find all MongoDB (or
    any skill) jobs near to my location.

     As a User, I should be able to find all the MongoDB (or
    any other skill) jobs near to my location with distance.




3
Assumptions: as a developer ...
    
        Want to prototype quickly
    
        Need quick feedback
    
        Don't want to manage infrastructure
    
        Don't want to spend much money on infrastructure. Or, even
        better, you want it to be free.
    
        Use your existing knowledge
    
        Should be able to use the best tool for the job




4
Technology Choices
    
        MongoDB
    
        OpenShift
    
        Java 6
          
              Spring 3.1.2.RELEASE
          
              Spring 1.1.0.M1
    
        GIT
    
        SSH




5
Why MongoDB ?
    
        Easy to get running
    
        Open Source
    
        Active community
    
        Rich documents
    
        Geospatial indexing.
    
        Writes are very fast. You can customize it using
        WriteConcern.




6
Rich Document




7
Geospatial Indexing Basics
    
        What is it for?
           
               Find all the MongoDB jobs near me
           
               Find all the MongoDB jobs within Pune
    
        Supports only two dimensional indexes.
    
        You can only have one geospatial index per collection.
    
        The spatial functionality MongoDB currently has is:
           
             Near
           
             Containment
    http://www.mongodb.org/display/DOCS/Geospatial+
      Indexing

8
How to make it work

    1) Put your coordinates into an array
    { loc : [ 50 , 30 ] } //SUGGESTED OPTION
    { loc : { x : 50 , y : 30 } }
    { loc : { foo : 50 , y : 30 } }
    { loc : { lon : 40.739037, lat: 73.992964 } }

    1) Make a 2d index
       db.places.ensureIndex( { loc : "2d" } )




9
Why OpenShift ?
 
     Supports MongoDB. Also supports MySQL and
     PostgreSQL.
 
     Multi-language support. Supports Java, Node.js, Perl,
     Python, PHP and Ruby.
 
     No need to learn anything new.
 
     Scalable.
 
     FREE!




10
11
What else do I get and what is the
     catch?
• OpenShift is free-as-in-beer & free-as-in-freedom
• You get three free gears, each with 512MB memory
  and 1GB of disk space.
• Need more resources, just ask!
• The catch is we are in developer preview right now




12
Let's get our hands dirty




13
Create an OpenShift Account
     https://openshift.redhat.com/app/account/new
     Promo code is bangalore




14
Installing Client Tools
 Install Ruby 1.8.7 or greater
 Install Git
 Install rhc OpenShift gem


 Refer to documentation




15
Setup your OpenShift Environment



        rhc setup -l <openshift_login>




16
Creating an OpenShift Application




     rhc app create -a localjobs -t jbossas-7 -d




17
Adding MongoDB and RockMongo
               Cartridge


      rhc app cartridge add -a localjobs -c mongodb-2.0


     rhc app cartridge add -a localjobs -c rockmongo-1.1




18
Play with MongoDB running in the Cloud
 ssh into instance
 Type mongo on the shell
 Create a sample db
 Insert some documents in the collection
 Run some queries




19
Let's take a look at GIT

 Distributed version control
 A local repository – on your laptop
 A remote repository – on some other machine, usually a
   server




20
You need to understand at least 3 commands in Git
 1. Git add . (means add all news files as being tracked in
    the local repository)
 2. Git commit –am “your message” (means commit all
    my changes to the local repository with this message)
 3. Git push (means push from your local repository to the
    repository on your OpenShift gear)




21
Pulling the code from GitHub
 git rm -rf src pom.xml
 git commit -am “removed default files”
 git remote add localjobs -m master
    git://github.com/shekhargulati/localjobs.git


 git pull -s recursive -X theirs localjobs master




22
Importing Data into MongoDB
 rhc app show -a localjobs -l <openshift_login_email>
 scp -r jobs-data.json
   <instance_ssh_access>:localjobs/data
 ssh <instance_ssh_access>
 mongoimport -d localjobs -c jobs --file jobs-data.json -u
  $OPENSHIFT_NOSQL_DB_USERNAME -p
  $OPENSHIFT_NOSQL_DB_PASSWORD -h
  $OPENSHIFT_NOSQL_DB_HOST -port
  $OPENSHIFT_NOSQL_DB_PORT
 db.jobs.ensureIndex({"location":"2d"})


23
Show some geospatial queries




24
Deploy the code to OpenShift
               git push




25
Code Walkthrough




26
Conclusion
 1. MongoDB makes it very easy to build location aware
    applications.
 2. OpenShift is very easy to use and embraces rapid
    development.
 3. Did I mention – Free?
 4. What are you waiting for? Try it out.




27

Mais conteúdo relacionado

Mais procurados

Confessions of a relational addict
Confessions of a relational addictConfessions of a relational addict
Confessions of a relational addict
Chandra Patni
 
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJSNarwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Clinton Dreisbach
 
OSMC 2019 | Fast logs Ingestion by Nicolas Fraenkel
OSMC 2019 | Fast logs Ingestion by Nicolas FraenkelOSMC 2019 | Fast logs Ingestion by Nicolas Fraenkel
OSMC 2019 | Fast logs Ingestion by Nicolas Fraenkel
NETWAYS
 

Mais procurados (20)

Coding in the context era
Coding in the context eraCoding in the context era
Coding in the context era
 
Confessions of a relational addict
Confessions of a relational addictConfessions of a relational addict
Confessions of a relational addict
 
funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
funcs, func expressions, closure, returning funcs, recursion, the stack -goph...funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
 
Decision making - for loop , nested loop ,if-else statements , switch in goph...
Decision making - for loop , nested loop ,if-else statements , switch in goph...Decision making - for loop , nested loop ,if-else statements , switch in goph...
Decision making - for loop , nested loop ,if-else statements , switch in goph...
 
Ops Jumpstart: Admin 101
Ops Jumpstart: Admin 101Ops Jumpstart: Admin 101
Ops Jumpstart: Admin 101
 
Sharding - patterns & antipatterns, Константин Осипов, Алексей Рыбак
Sharding -  patterns & antipatterns, Константин Осипов, Алексей РыбакSharding -  patterns & antipatterns, Константин Осипов, Алексей Рыбак
Sharding - patterns & antipatterns, Константин Осипов, Алексей Рыбак
 
Introduction to Version Control with GIT
Introduction to Version Control with GITIntroduction to Version Control with GIT
Introduction to Version Control with GIT
 
Lessons Learned Migrating 2+ Billion Documents at Craigslist
Lessons Learned Migrating 2+ Billion Documents at CraigslistLessons Learned Migrating 2+ Billion Documents at Craigslist
Lessons Learned Migrating 2+ Billion Documents at Craigslist
 
Git Heaven with Wakanda
Git Heaven with WakandaGit Heaven with Wakanda
Git Heaven with Wakanda
 
How Openstack is Built
How Openstack is BuiltHow Openstack is Built
How Openstack is Built
 
Beating Python's GIL to Max Out Your CPUs
Beating Python's GIL to Max Out Your CPUsBeating Python's GIL to Max Out Your CPUs
Beating Python's GIL to Max Out Your CPUs
 
Clojure News Feed Performance Testing
Clojure News Feed Performance TestingClojure News Feed Performance Testing
Clojure News Feed Performance Testing
 
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJSNarwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
 
My talk at Linux Piter 2015
My talk at Linux Piter 2015My talk at Linux Piter 2015
My talk at Linux Piter 2015
 
DrupalANDElasticsearch
DrupalANDElasticsearchDrupalANDElasticsearch
DrupalANDElasticsearch
 
Максим Барышиков-«WoT: Geographically distributed cluster of clusters»
Максим Барышиков-«WoT: Geographically distributed cluster of clusters»Максим Барышиков-«WoT: Geographically distributed cluster of clusters»
Максим Барышиков-«WoT: Geographically distributed cluster of clusters»
 
OSMC - Fast logs management
OSMC - Fast logs managementOSMC - Fast logs management
OSMC - Fast logs management
 
OSMC 2019 | Fast logs Ingestion by Nicolas Fraenkel
OSMC 2019 | Fast logs Ingestion by Nicolas FraenkelOSMC 2019 | Fast logs Ingestion by Nicolas Fraenkel
OSMC 2019 | Fast logs Ingestion by Nicolas Fraenkel
 
Tuning Elasticsearch Indexing Pipeline for Logs
Tuning Elasticsearch Indexing Pipeline for LogsTuning Elasticsearch Indexing Pipeline for Logs
Tuning Elasticsearch Indexing Pipeline for Logs
 
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupДоклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
 

Destaque (6)

Rocking mongo db on the cloud
Rocking mongo db on the cloudRocking mongo db on the cloud
Rocking mongo db on the cloud
 
Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012Buildr In Action @devoxx france 2012
Buildr In Action @devoxx france 2012
 
Mongo db 2.6_security_architecture
Mongo db 2.6_security_architectureMongo db 2.6_security_architecture
Mongo db 2.6_security_architecture
 
Why I Believe MongoDB is The Dog's Bollocks
Why I Believe MongoDB is The Dog's BollocksWhy I Believe MongoDB is The Dog's Bollocks
Why I Believe MongoDB is The Dog's Bollocks
 
Munching the mongo
Munching the mongoMunching the mongo
Munching the mongo
 
Dig up the gold in your godowns
Dig up the gold in your godownsDig up the gold in your godowns
Dig up the gold in your godowns
 

Semelhante a Mongo db bangalore

Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud
Shekhar Gulati
 
Spatial Mongo and Node.JS on Openshift JS.Everywhere 2012
Spatial Mongo and Node.JS on Openshift JS.Everywhere 2012Spatial Mongo and Node.JS on Openshift JS.Everywhere 2012
Spatial Mongo and Node.JS on Openshift JS.Everywhere 2012
Steven Pousty
 
Bringing Spatial Love to Your Java Application
Bringing Spatial Love to Your Java ApplicationBringing Spatial Love to Your Java Application
Bringing Spatial Love to Your Java Application
MongoDB
 
Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...
Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...
Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...
AgileNCR2013
 
Introducing with MongoDB
Introducing with MongoDBIntroducing with MongoDB
Introducing with MongoDB
Mahbub Tito
 

Semelhante a Mongo db bangalore (20)

Bringing spatial love to your python application
Bringing spatial love to your python applicationBringing spatial love to your python application
Bringing spatial love to your python application
 
Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud
 
Spatial Mongo and Node.JS on Openshift JS.Everywhere 2012
Spatial Mongo and Node.JS on Openshift JS.Everywhere 2012Spatial Mongo and Node.JS on Openshift JS.Everywhere 2012
Spatial Mongo and Node.JS on Openshift JS.Everywhere 2012
 
MongoDB Part 2
MongoDB Part 2MongoDB Part 2
MongoDB Part 2
 
Bringing Spatial Love to Your Java Application
Bringing Spatial Love to Your Java ApplicationBringing Spatial Love to Your Java Application
Bringing Spatial Love to Your Java Application
 
Mdb dn 2016_07_elastic_search
Mdb dn 2016_07_elastic_searchMdb dn 2016_07_elastic_search
Mdb dn 2016_07_elastic_search
 
Building Social IRC Bots with Node.js and MongoDB
Building Social IRC Bots with Node.js and MongoDBBuilding Social IRC Bots with Node.js and MongoDB
Building Social IRC Bots with Node.js and MongoDB
 
Social IRC bots in the Cloud with OpenShift - Mongo London presentation by Ma...
Social IRC bots in the Cloud with OpenShift - Mongo London presentation by Ma...Social IRC bots in the Cloud with OpenShift - Mongo London presentation by Ma...
Social IRC bots in the Cloud with OpenShift - Mongo London presentation by Ma...
 
Spatial MongoDB, Node.JS, and Express - server-side JS for your application
Spatial MongoDB, Node.JS, and Express - server-side JS for your applicationSpatial MongoDB, Node.JS, and Express - server-side JS for your application
Spatial MongoDB, Node.JS, and Express - server-side JS for your application
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
 
Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...
Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...
Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...
 
A Happy Cloud Friendly Java Developer with OpenShift
A Happy Cloud Friendly Java Developer with OpenShiftA Happy Cloud Friendly Java Developer with OpenShift
A Happy Cloud Friendly Java Developer with OpenShift
 
IDEALIZE 2023 - NodeJS & Firebase Session
IDEALIZE 2023 - NodeJS & Firebase SessionIDEALIZE 2023 - NodeJS & Firebase Session
IDEALIZE 2023 - NodeJS & Firebase Session
 
Interop 2018 - Understanding Kubernetes - Brian Gracely
Interop 2018 - Understanding Kubernetes - Brian GracelyInterop 2018 - Understanding Kubernetes - Brian Gracely
Interop 2018 - Understanding Kubernetes - Brian Gracely
 
Javascript mynotes
Javascript mynotesJavascript mynotes
Javascript mynotes
 
Nodejs web service for starters
Nodejs web service for startersNodejs web service for starters
Nodejs web service for starters
 
Node.js vs. Python 5 Ways to Pick the Best Technology for Your Back-end
Node.js vs. Python 5 Ways to Pick the Best Technology for Your Back-endNode.js vs. Python 5 Ways to Pick the Best Technology for Your Back-end
Node.js vs. Python 5 Ways to Pick the Best Technology for Your Back-end
 
MongoDB presentation
MongoDB presentationMongoDB presentation
MongoDB presentation
 
Introducing with MongoDB
Introducing with MongoDBIntroducing with MongoDB
Introducing with MongoDB
 
Use open source software to develop ideas at work
Use open source software to develop ideas at workUse open source software to develop ideas at work
Use open source software to develop ideas at work
 

Mais de MongoDB

Mais de MongoDB (20)

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
 

Mongo db bangalore

  • 1. Bring Spatial Love to your Java Application Shekhar Gulati @shekhargulati OpenShift Evangelist, Red Hat 1
  • 2. Building A Location Aware Job Search App 2
  • 3. User Stories  As a User, I should be able to find all the jobs.  As a User, I should be able to find all the jobs near to my location.  As a User, I should be able to find all MongoDB (or any skill) jobs near to my location.  As a User, I should be able to find all the MongoDB (or any other skill) jobs near to my location with distance. 3
  • 4. Assumptions: as a developer ...  Want to prototype quickly  Need quick feedback  Don't want to manage infrastructure  Don't want to spend much money on infrastructure. Or, even better, you want it to be free.  Use your existing knowledge  Should be able to use the best tool for the job 4
  • 5. Technology Choices  MongoDB  OpenShift  Java 6  Spring 3.1.2.RELEASE  Spring 1.1.0.M1  GIT  SSH 5
  • 6. Why MongoDB ?  Easy to get running  Open Source  Active community  Rich documents  Geospatial indexing.  Writes are very fast. You can customize it using WriteConcern. 6
  • 8. Geospatial Indexing Basics  What is it for?  Find all the MongoDB jobs near me  Find all the MongoDB jobs within Pune  Supports only two dimensional indexes.  You can only have one geospatial index per collection.  The spatial functionality MongoDB currently has is:  Near  Containment http://www.mongodb.org/display/DOCS/Geospatial+ Indexing 8
  • 9. How to make it work 1) Put your coordinates into an array { loc : [ 50 , 30 ] } //SUGGESTED OPTION { loc : { x : 50 , y : 30 } } { loc : { foo : 50 , y : 30 } } { loc : { lon : 40.739037, lat: 73.992964 } } 1) Make a 2d index db.places.ensureIndex( { loc : "2d" } ) 9
  • 10. Why OpenShift ?  Supports MongoDB. Also supports MySQL and PostgreSQL.  Multi-language support. Supports Java, Node.js, Perl, Python, PHP and Ruby.  No need to learn anything new.  Scalable.  FREE! 10
  • 11. 11
  • 12. What else do I get and what is the catch? • OpenShift is free-as-in-beer & free-as-in-freedom • You get three free gears, each with 512MB memory and 1GB of disk space. • Need more resources, just ask! • The catch is we are in developer preview right now 12
  • 13. Let's get our hands dirty 13
  • 14. Create an OpenShift Account https://openshift.redhat.com/app/account/new Promo code is bangalore 14
  • 15. Installing Client Tools Install Ruby 1.8.7 or greater Install Git Install rhc OpenShift gem Refer to documentation 15
  • 16. Setup your OpenShift Environment rhc setup -l <openshift_login> 16
  • 17. Creating an OpenShift Application rhc app create -a localjobs -t jbossas-7 -d 17
  • 18. Adding MongoDB and RockMongo Cartridge rhc app cartridge add -a localjobs -c mongodb-2.0 rhc app cartridge add -a localjobs -c rockmongo-1.1 18
  • 19. Play with MongoDB running in the Cloud ssh into instance Type mongo on the shell Create a sample db Insert some documents in the collection Run some queries 19
  • 20. Let's take a look at GIT Distributed version control A local repository – on your laptop A remote repository – on some other machine, usually a server 20
  • 21. You need to understand at least 3 commands in Git 1. Git add . (means add all news files as being tracked in the local repository) 2. Git commit –am “your message” (means commit all my changes to the local repository with this message) 3. Git push (means push from your local repository to the repository on your OpenShift gear) 21
  • 22. Pulling the code from GitHub git rm -rf src pom.xml git commit -am “removed default files” git remote add localjobs -m master git://github.com/shekhargulati/localjobs.git git pull -s recursive -X theirs localjobs master 22
  • 23. Importing Data into MongoDB rhc app show -a localjobs -l <openshift_login_email> scp -r jobs-data.json <instance_ssh_access>:localjobs/data ssh <instance_ssh_access> mongoimport -d localjobs -c jobs --file jobs-data.json -u $OPENSHIFT_NOSQL_DB_USERNAME -p $OPENSHIFT_NOSQL_DB_PASSWORD -h $OPENSHIFT_NOSQL_DB_HOST -port $OPENSHIFT_NOSQL_DB_PORT db.jobs.ensureIndex({"location":"2d"}) 23
  • 24. Show some geospatial queries 24
  • 25. Deploy the code to OpenShift git push 25
  • 27. Conclusion 1. MongoDB makes it very easy to build location aware applications. 2. OpenShift is very easy to use and embraces rapid development. 3. Did I mention – Free? 4. What are you waiting for? Try it out. 27