Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Bob McWhirter
JBoss Middleware, a division of Red Hat, Inc.
1
JBoss-Rails
2
Agenda for JBoss-Rails
‣ Background on Ruby on Rails
‣ Rationale for JBoss-Rails
‣ HOWTO JBoss-Rails
‣ JBoss-Rails Microcontainer Deployer
‣ Web deployment
‣ Meta-data
‣ Parsing
‣ Structure
3
Ruby on Rails
Background
4
Ruby on Rails
Downsides
5
JBoss-Rails
Why?
6
JBoss-Rails
Really, why?
7
JBoss-Rails
Why JBoss is The Answer
8
JBoss-Rails
Why JBoss is The Answer
9
JBoss-Rails
It’s just a deployer
cp -R jboss-rails.deployer/ $JBOSS_HOME/server/all/deployers/
10
JBoss-Rails Deployer
Microcontainer
11
JBoss-Rails
Preparing your RoR app
‣ Your Rails application needs to have Rails
“vendorized”.
‣ Rails itself should be in your source-tree under
vendor/rails/**
12
JBoss-Rails
Preparing your RoR app
13
JBoss-Rails
Preparing your RoR app
14
JBoss-Rails Plugin
Setup JDBC
rake jboss:rails:jdbc:install
15
JBoss-Rails
Preparing your RoR app
16
JBoss-Rails
Deploying your app
rake jboss:rails:deploy
17
JBoss-Rails
Deploying your app
‣ It’ll seek out $JBOSS_HOME/server/default,
and drop a JBoss-Rails deployment
descriptor into the deploy/ directory.
‣ AS5 doesn’t even have to be running.
‣ The RAILS_ROOT of your application is the
live deployment:
‣ Editing of views & controllers will be reflected
immediately.
18
JBoss-Rails
Deployment descriptor
‣ The deployment descriptor is just a YAML
file acting as a symlink with meta-data to
replace web.xml:
deploy/myapp-rails.yml
---
application:
RAILS_ENV: development
RAILS_ROOT: /Users/bob/oddthesis
web:
context: /
19
JBoss-Rails
Deployment descriptor
‣ The context allows you to host multiple
apps, even alongside traditional WARs.
‣ An optional host is allowed for virtual-host
binding within AS5.
deploy/myapp-rails.yml
web:
host: api.mycorp.com
context: /api-v2
20
Your Rails App on JBoss
‣ Surf to your server’s normal web-listening
port, at the host and context specified...
21
Your other apps on JBoss
‣ And your other contexts work, too:
22
JBoss-Rails Internals
Microcontainer Pieces
23
Deploying a Web App
AS5 knows how to do that
24
Deploying a Web App
AS5 knows how to do that
25
How do we know RAILS_ROOT?
RailsApplicationMetaData & RackWebMetaData
26
MetaData comes from where?
Anywhere, really
27
One source of metadata
Parsing deployers!
‣ persistence.xml
‣ myapp-rails.yml
28
Rails parsing deployers
Files into MetaData
29
Symlink or Archive deployment
If you don’t use myapp-rails.yml
‣ config/jboss-web.yml
30
Meta-data files
Knowing where to look
31
Structure Deployers
Telling Microcontainer where to look
32
Deployer Review
Start-to-End
33
Other Ruby/Rails Deployers
Quartz Scheduler
34
Other Ruby/Rails Deployers
Future
35
JBoss-Rails Questions
Please hold your questions until the end
36
JBoss-Cloud
37
Agenda for JBoss-Cloud
‣ What’s “the cloud?”
‣ JBoss-Cloud project
‣ Thincrust Appliances
‣ Challenges working in the cloud
‣ Multicast
‣ DHCP
‣ Other configuration
‣ Launch JBoss in the cloud
‣ Future Work
38
What does “The Cloud” mean?
Virtualization
39
What does “The Cloud” mean?
Not grids
‣ Google’s AppEngine
‣ Sun’s GridEngine
40
Why the cloud?
Red Hat synergy
41
JBoss-Cloud
Project
42
JBoss-Cloud
Thincrust Appliances
43
JBoss-Cloud
Fedora Remix
44
Cloud Considerations
Some things work differently
45
Cloud Workarounds
Not problems, just challenges
‣ Instead of relying upon multicast for cluster
discovery and formation, fire up a
GossipRouter.
‣ Use Puppet to handle reconfiguration, such
as adjusting the bind IP based upon the
DHCP-assigned address.
‣ Inject any custom configuration using cloud
out-of-band boot-data facilities.
46
Gossip in the Cloud
Overcoming lack of multicast
47
Dynamic Reconfiguration
Using Puppet
48
Dynamic Reconfiguration
Puppet in action
49
/etc/init.d/jboss-as5
Configuration and booting
50
Clustering becomes easy
Boot and go
51
Web Proxies
JBoss mod_cluster
52
JBoss mod_cluster
Reversing the relationship
53
JBoss mod_cluster
If you have multicast
54
JBoss VM2
Slight Tangent
‣ Before we actually walk through using
JBoss-Cloud images, we need to pick a
virtualization environment.
‣ I’m using VMWare Fusion on an Apple
MacBook Pro.
‣ Instead of using the GUI, I use JBoss VM2,
a layer to allow VMWare to work somewhat
like Amazon EC2.
55
JBoss VM2
Images and Instances
56
Front-End Appliance
Launch your first machine
‣ JGroups GossipRouter
‣ Launch 1 instance:
$ vm2 run-instances vmi-ac731d2449
57
Write a cluster.conf
58
Boot up AS5 nodes
Build your cluster
‣ Launch an AS5 appliance with the
cluster.conf as boot meta-data:
$ vm2 run-instances vmi-42c8ee3ea4 -f cluster.conf
59
Confirm!
Fire up that browser
‣ Surf to the front-end box. Notice the IP
address reported by the JMX console
compared to the location bar:
60
Do it again
Launch more AS5 nodes
61
Deploy your App
Get code on the servers
62
Future Work
Actual EC2 Support
63
Future Work
JBoss Cloud-Control project
64
Resources
JBoss-Rails & JBoss-Cloud
65
OddThesis.org
Where it all goes down
OddThesis.org is the
primary project site
for both JBoss-Rails
and JBoss-Cloud.
66
GitHub.com
Where the source lives
The repositories
are hosted at
GitHub.com
‣ http://github.com/bobmcwhirter/jboss-rails
‣ http://github.com/bobmcwhirter/jboss-rails-plugin
‣ http://github.com/bobmcwhirter/jboss-cloud
‣ http://github.com/bobmcwhirter/vm2
67
irc.freenode.net
Where the developers chat
‣ irc://irc.freenode.net/jboss-rails
‣ irc://irc.freenode.net/jboss-cloud
68
Projects Mentioned
Project I use, but didn’t write
69
Thanks
Pause, thank crowd, exit.
http://creativecommons.org/licenses/by-sa/3.0/us/
70