free mongo on openshift
DESCRIPTION
My talk to the Bay Area Mongo Users Group. It has a basic introduction to PaaS, OpenShift, and using Openshift, RockMongo, and MMS on OpenShift.TRANSCRIPT
1
Getting Started with Mongo DB &
OpenShift
Steve Citron-PoustyDeveloper Evangelist, Red HatMarch 20, 2012
Aka Free Mongo applications for you!
2
Agenda
• What is OpenShift?
• Getting Started
• Using Mongo with OpenShift
• Next Steps
3
My Goal for today
Introduce you to OpenShift
Get you comfortable with using the tools.
I want you to be ready to start writing apps
A bit about me:
Long time Java, RDBMS, SpatialNew to: OpenShift and Mongo
4
Assumptions
1) You might know some Mongo
2) You have a favorite programming language
3) You are comfortable with the command line (for now)
4) You might know GIT
5) You are unfamiliar with PaaS
PLEASE ASK QUESTIONS!!!!
5
What is OpenShift?
Red Hat’s free platform as a service for applications in the cloud.
6
Kind of like Amazon, right? Nope.
7
What’s Infrastructure as a Service?
• Network, storage and compute offered as an on-demand service
• Basically, servers in the cloud
• You’re still on the hook to configure & manage the cloud & stack
• Example: Amazon EC2
“How do I use this?”
8
What’s Platform as a Service?
• It’s an application platform
• Basically, an app run-time environment in the cloud
• PaaS configures & manages the cloud & stack for you
• Example: OpenShift
“The cloud is now useful!”
9
What’s Software as a Service?
• It’s an on-demand application
• Nothing to install or configure
• Example: Salesforce, Gmail
“This is all my customers and users care about!”
10
So, why should I use a PaaS?
• Realize the benefits of the cloud quickly
• Let the PaaS configure, manage & scale the stack
• Make deployments to the cloud easy
• Focus on your app & users, not the stack
11
What’s supported?
12
How does it work?
• Install the client tools
• Create a domain name
• Create an application
• Congrats! You are now in the cloud!
rhc-create-app –a my_app –t my_lang
13
Looks great, but how much does it cost?
• OpenShift is free-as-in-beer
• Five 512 MB RAM / 1 GB Storage instances
• Need more resources, just ask!
14
But, First….SSH
• To keep things secure we do most things over SSH
• You need to have your keys working properly
Git
• Is used to push changes to apps on OpenShift
• Is a distributed revision control and source code management system
Builds
• Java – we use Maven
• For others we just copy from the git repo over
15
So, Let’s Get Started!
1. Sign up
2. Install the client tools
3. Create a domain name
4. Create an application
16
DEMO – Finally!
17
So here are the steps1) Create an account on openshift.com using the web console
2) Create a Domain using the command line
• Remember your domain has to be unique to the rhcloud.com namespace.
• It will be used in all your apps urls
3) Then go ahead and create an app
4) I am going to use eclipse to add other cartridges and edit the source code
• Make sure to store the usernames and passwords for the mongo and rockmongo
5) You can now modify the source and then commit and push to remote repository
18
1. Sign Up!• openshift.com
• All it takes is an email address
• Promo Code: BAMUG
19
Now to install the client tools
On the openshift site:
OpenShift > Community > Knowledge Base > Installing OpenShift Express client tools…
Basically
1. Install ruby and ruby gems
2. Gem install rhc
3. Make sure you have git and ssh
20
On the different platforms
Easy Cheesy on Linux machines
Mac you need to install the full Xcode
Windows…well a bit more work
21
Don’t have Cygwin installed?
Get it here: cygwin.com/install.html
22
Hold up, what’s Cygwin?
A Linux-like environment for Windows making it possible
to port software running on Linux systems to Windows.
23
2. Install the Client Tools on Windows
• What you are going to need: Cygwin
• Plus these cygwin components:
• openssh
• Ruby
• Git
• You will need all these for SSH and for advanced command line usage. Eclipse plugin does a lot
24
2. Install the Client Tools on Windows
Next, download and extract rubygems from:
http://rubyforge.org/projects/rubygems
25
2. Install the Client Tools on Windows
• In Cygwin run:
$ ruby <path_to_extracted_rubygems>/setup.rb install
Cygwin is unix so your path looks like c:/<path_to_extracted_rubygems>/setup.rb install
• Install the gem
$ gem install rhc
26
Quick Tip: Client Tool Commands
rhc-* : prefix for all commands
rhc-create-domain : Create a namespace
rhc-create-app : Create an application
rhc-ctl-app : Control an app and embed components
rhc-snapshot : Backup and restore an application
27
3. Create a Domain Name
$ rhc domain create –n <your domain> -l <your login>
Password:
• When creating apps the URLs will look like this:
http://<app name>-<your domain>.rhcloud.com
Example: http://javarules-jgsdomain.rhcloud.com
28
Some tech to help with more learning for OpenShift1. Git – the source control and publishing system to
openshift. For SVN users:https://git.wiki.kernel.org/articles/g/i/t/GitSvnCrashCourse_512d.html
2. Eclipse tooling – use the latest Jboss Studio pluginhttp://www.jboss.org/tools/download/dev
3. -bliss
4. Our new shiny web consolehttps://openshift.redhat.com/app/console
29
4. Create an Application
$ rhc app create –a <your app name> -t jbossas-7
Password:
30
Mongo Specific awesomeness
RockMongo
MMS
Spatial is enabled
Sharding and replication are not running yet but they will be by time we leave Beta
31
GitHub
• Full featured applications on GitHub
• www.github.com/gshipley
• BeerShift
• www.github.com/openshift
• A whole bunch
32
One more demo
A little bit of spatial goodness
Mongo has built in 2D spatial indexing capabilities
You can build your own FourSquare or similar app.
Quick demo of loading some spatial data on an OpenShift Mongo Instance and then doing a query at the command line (or in RockMongo)
33
Next Steps
• Forum: redhat.com/openshift/community
• Email: [email protected]
• IRC: #openshift on freenode