Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
My name is TrinidadDavid Calavera@calavera
Farmhouse   conf!
Rubinius!
Why?
JSP Struts SpringHibernate
Rails
Rails SpringHibernate
maven<plugin>    <artifactId>exec-maven-plugin</artifactId>    <executions>      <execution>         <id>create-mock-web-d...
springclass UsersController < ApplicationController  include_spring_bean :users_service  def authorized?(user, action)    ...
hibernateclass User < HibernateModel  def self.find(id)    hibernate.find_by_id(HUser.class, id)  endend
development    staging /              production  Mongrel      Tomcat
development    staging /              production  GF Gem       Tomcat
development     staging /               production Jetty-Rails    Tomcat
what about tomcat?
development    staging /              production  Tomcat-               Tomcat   Rails
gem installtrinidadcd my_rails_applicationjruby -S trinidad
cd my_threadsafe_rails_applicationjruby -S trinidad -t
cd my_rack_applicationjruby -S trinidad -r
1.2cd my_applicationjruby -S trinidad
conventionslib/ spring.jar     hibernate.jar     junit.jar
conventionsclasses/ Context.class         FooBar.class         BarBaz.class
conventionsconfig/ web.xml       trinidad.yml
secure layer---  ssl:    port: 3443    keystore: keystore.p12    ...
multiple apps---  web_apps:    app1:      context_path: /foo    app2:      rackup: config.ru
multiple apps$ jruby -S trinidad --apps webapps---  apps_base: webapps
extensible
gem installtrinidad_FOO_extension---extensions: FOO:
gem installtrinidad_FOO_extensiontrinidad --load FOO
server extensionmodule Trinidad::Extensions  class FOOServerExtension < ServerExtension    def configure(tomcat)      ... ...
app extensionmodule Trinidad::Extensions  class FOOWebAppExtension < WebAppExtension    def configure(tomcat, app_context)...
options extensionmodule Trinidad::Extensions  class FOOOptionsExtension < OptionsExtension    def configure(parser, defaul...
daemon     DAEMON
daemon---  extensions:    daemon:    pid_file: tmp/trinidad.pid    jvm_args: -Xmx20Gb
ox     db  ans
ox     db  ans
sandbox$ curl http://example.com/sandbox/apps.xml<applications>  <application>    <name>default</name>    <link href=".../...
sandbox howtoopts = {  :context_path   =>   /sandbox,  :web_app_dir    =>   sandbox,  :public         =>   app/public,  :r...
sandbox howtoweb_app = Trinidad::RackupWebApp.new({}, opts)app_ctx = tomcat.add_webapp(   opts[:context_path], [:web_app_d...
hot deploy
hot deploy---  monitor: tmp/restart.txt
“ hi David,quick questionabouthot deploy... “
“ ... it would begreat if we couldhave real zerodown time “
1.2Trinidad Zero
scheduler
schedulerclass ScheduledJob < TrinidadScheduler.Cron"0/5 * * * * ?"  def run    _logger.info "I’m printed every 5 seconds"...
schedulerclass ScheduledJob < TrinidadScheduler.Simple:start => Time.now, :end => Time.now + 240  def run    _logger.info ...
schedulerTrinidadScheduler.run_later do # 3 seconds  _logger.info "I’m inside this block"endTrinidadScheduler.run_later(:d...
lifecycle
lifecyclemodule Trinidad::Lifecycle::WebApp  class MyListener    ...    def lifecycle_event(event)      if BEFORE_START_EV...
lifecyclewhen   Lifecycle::START_EVENTwhen   Lifecycle::BEFORE_START_EVENTwhen   Lifecycle::AFTER_START_EVENTwhen   Lifecy...
u e   s qr e
resque---  extensions:    resque:      queues: critical,high,low      redis_host: example.com:6379
what’s next?better rack integration?sandbox features?clustering?
github.com/trinidad
thank you!
creditshttp://www.flickr.com/photos/rooreynolds/243811287/http://www.sxc.hu/photo/1192923http://www.flickr.com/photos/street...
My name is Trinidad
My name is Trinidad
My name is Trinidad
My name is Trinidad
Upcoming SlideShare
Loading in …5
×

My name is Trinidad

2,197 views

Published on

  • Be the first to comment

  • Be the first to like this

My name is Trinidad

  1. 1. My name is TrinidadDavid Calavera@calavera
  2. 2. Farmhouse conf!
  3. 3. Rubinius!
  4. 4. Why?
  5. 5. JSP Struts SpringHibernate
  6. 6. Rails
  7. 7. Rails SpringHibernate
  8. 8. maven<plugin> <artifactId>exec-maven-plugin</artifactId> <executions> <execution> <id>create-mock-web-descriptor</id>… <phase>compile</phase>
  9. 9. springclass UsersController < ApplicationController include_spring_bean :users_service def authorized?(user, action) @users_service.authorized?(user, action) endend
  10. 10. hibernateclass User < HibernateModel def self.find(id) hibernate.find_by_id(HUser.class, id) endend
  11. 11. development staging / production Mongrel Tomcat
  12. 12. development staging / production GF Gem Tomcat
  13. 13. development staging / production Jetty-Rails Tomcat
  14. 14. what about tomcat?
  15. 15. development staging / production Tomcat- Tomcat Rails
  16. 16. gem installtrinidadcd my_rails_applicationjruby -S trinidad
  17. 17. cd my_threadsafe_rails_applicationjruby -S trinidad -t
  18. 18. cd my_rack_applicationjruby -S trinidad -r
  19. 19. 1.2cd my_applicationjruby -S trinidad
  20. 20. conventionslib/ spring.jar hibernate.jar junit.jar
  21. 21. conventionsclasses/ Context.class FooBar.class BarBaz.class
  22. 22. conventionsconfig/ web.xml trinidad.yml
  23. 23. secure layer--- ssl: port: 3443 keystore: keystore.p12 ...
  24. 24. multiple apps--- web_apps: app1: context_path: /foo app2: rackup: config.ru
  25. 25. multiple apps$ jruby -S trinidad --apps webapps--- apps_base: webapps
  26. 26. extensible
  27. 27. gem installtrinidad_FOO_extension---extensions: FOO:
  28. 28. gem installtrinidad_FOO_extensiontrinidad --load FOO
  29. 29. server extensionmodule Trinidad::Extensions class FOOServerExtension < ServerExtension def configure(tomcat) ... end endend
  30. 30. app extensionmodule Trinidad::Extensions class FOOWebAppExtension < WebAppExtension def configure(tomcat, app_context) ... end endend
  31. 31. options extensionmodule Trinidad::Extensions class FOOOptionsExtension < OptionsExtension def configure(parser, default_options) ... end endend
  32. 32. daemon DAEMON
  33. 33. daemon--- extensions: daemon: pid_file: tmp/trinidad.pid jvm_args: -Xmx20Gb
  34. 34. ox db ans
  35. 35. ox db ans
  36. 36. sandbox$ curl http://example.com/sandbox/apps.xml<applications> <application> <name>default</name> <link href=".../default/start.xml" rel="start" /> <link href=".../default/stop.xml" rel="stop" /> <link href=".../default/restart.xml" rel="restart" />
  37. 37. sandbox howtoopts = { :context_path => /sandbox, :web_app_dir => sandbox, :public => app/public, :rackup => config.ru}
  38. 38. sandbox howtoweb_app = Trinidad::RackupWebApp.new({}, opts)app_ctx = tomcat.add_webapp( opts[:context_path], [:web_app_dir])app_ctx.add_lifecycle_listener( Trinidad::Lifecycle::Default.new(web_app))
  39. 39. hot deploy
  40. 40. hot deploy--- monitor: tmp/restart.txt
  41. 41. “ hi David,quick questionabouthot deploy... “
  42. 42. “ ... it would begreat if we couldhave real zerodown time “
  43. 43. 1.2Trinidad Zero
  44. 44. scheduler
  45. 45. schedulerclass ScheduledJob < TrinidadScheduler.Cron"0/5 * * * * ?" def run _logger.info "I’m printed every 5 seconds" endend
  46. 46. schedulerclass ScheduledJob < TrinidadScheduler.Simple:start => Time.now, :end => Time.now + 240 def run _logger.info "I’m printed every 5 seconds" endend
  47. 47. schedulerTrinidadScheduler.run_later do # 3 seconds _logger.info "I’m inside this block"endTrinidadScheduler.run_later(:delay => 20) do _logger.info "I’m inside this block"end
  48. 48. lifecycle
  49. 49. lifecyclemodule Trinidad::Lifecycle::WebApp class MyListener ... def lifecycle_event(event) if BEFORE_START_EVENT == event.type # do something before the app starts
  50. 50. lifecyclewhen Lifecycle::START_EVENTwhen Lifecycle::BEFORE_START_EVENTwhen Lifecycle::AFTER_START_EVENTwhen Lifecycle::STOP_EVENTwhen Lifecycle::BEFORE_STOP_EVENTwhen Lifecycle::AFTER_STOP_EVENTwhen Lifecycle::PERIODIC_EVENT
  51. 51. u e s qr e
  52. 52. resque--- extensions: resque: queues: critical,high,low redis_host: example.com:6379
  53. 53. what’s next?better rack integration?sandbox features?clustering?
  54. 54. github.com/trinidad
  55. 55. thank you!
  56. 56. creditshttp://www.flickr.com/photos/rooreynolds/243811287/http://www.sxc.hu/photo/1192923http://www.flickr.com/photos/streetfly_jz/2752896812http://www.flickr.com/photos/58376723@N07/5359060059/http://www.flickr.com/photos/cosacutro/4820222363/http://www.flickr.com/photos/darek-zon/2457168503/http://www.flickr.com/photos/veganstraightedge/5697792356http://www.flickr.com/photos/veganstraightedge/5696662117http://www.flickr.com/photos/drumminhands/4757641653/

×