SlideShare a Scribd company logo
My name is Trinidad
David Calavera
@calavera
Farmhouse
   conf!
Rubinius!
Why?
JSP


 Struts


 Spring


Hibernate
Rails
Rails


 Spring


Hibernate
maven
<plugin>
    <artifactId>exec-maven-plugin</artifactId>
    <executions>
      <execution>
         <id>create-mock-web-descriptor</id>
…        <phase>compile</phase>
spring
class UsersController < ApplicationController
  include_spring_bean :users_service

  def authorized?(user, action)
    @users_service.authorized?(user, action)
  end
end
hibernate
class User < HibernateModel
  def self.find(id)
    hibernate.find_by_id(HUser.class, id)
  end
end
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 install
trinidad


cd my_rails_application
jruby -S trinidad
cd my_threadsafe_rails_application
jruby -S trinidad -t
cd my_rack_application
jruby -S trinidad -r
1.2




cd my_application
jruby -S trinidad
conventions

lib/ spring.jar
     hibernate.jar
     junit.jar
conventions

classes/ Context.class
         FooBar.class
         BarBaz.class
conventions

config/ 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 install
trinidad_FOO_extension

---
extensions:
 FOO:
gem install
trinidad_FOO_extension



trinidad --load FOO
server extension
module Trinidad::Extensions
  class FOOServerExtension < ServerExtension
    def configure(tomcat)
      ...
    end
  end
end
app extension
module Trinidad::Extensions
  class FOOWebAppExtension < WebAppExtension
    def configure(tomcat, app_context)
      ...
    end
  end
end
options extension
module Trinidad::Extensions
  class FOOOptionsExtension < OptionsExtension
    def configure(parser, default_options)
      ...
    end
  end
end
daemon

     DAEMON
daemon
---
  extensions:
    daemon:
    pid_file: tmp/trinidad.pid
    jvm_args: -Xmx20Gb
ox
     db
  an
s
ox
     db
  an
s
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" />
sandbox howto
opts = {
  :context_path   =>   '/sandbox',
  :web_app_dir    =>   'sandbox',
  :public         =>   'app/public',
  :rackup         =>   'config.ru'
}
sandbox howto
web_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))
hot deploy
hot deploy
---
  monitor: tmp/restart.txt
“ hi David,
quick question
about
hot deploy... “
“ ... it would be
great if we could
have real zero
down time “
1.2




Trinidad Zero
scheduler
scheduler
class ScheduledJob < TrinidadScheduler.Cron
"0/5 * * * * ?"
  def run
    _logger.info "I’m printed every 5 seconds"
  end
end
scheduler
class ScheduledJob < TrinidadScheduler.Simple
:start => Time.now, :end => Time.now + 240

  def run
    _logger.info "I’m printed every 5 seconds"
  end
end
scheduler
TrinidadScheduler.run_later do # 3 seconds
  _logger.info "I’m inside this block"
end

TrinidadScheduler.run_later(:delay => 20) do
  _logger.info "I’m inside this block"
end
lifecycle
lifecycle
module Trinidad::Lifecycle::WebApp
  class MyListener
    ...
    def lifecycle_event(event)
      if BEFORE_START_EVENT == event.type
        # do something before the app starts
lifecycle
when   Lifecycle::START_EVENT
when   Lifecycle::BEFORE_START_EVENT
when   Lifecycle::AFTER_START_EVENT
when   Lifecycle::STOP_EVENT
when   Lifecycle::BEFORE_STOP_EVENT
when   Lifecycle::AFTER_STOP_EVENT
when   Lifecycle::PERIODIC_EVENT
u e
   s q
r e
resque
---
  extensions:
    resque:
      queues: critical,high,low
      redis_host: example.com:6379
My name is Trinidad
My name is Trinidad
My name is Trinidad
My name is Trinidad
what’s next?

better rack integration?
sandbox features?
clustering?
github.com/trinidad
thank you!
credits
http://www.flickr.com/photos/rooreynolds/243811287/

http://www.sxc.hu/photo/1192923

http://www.flickr.com/photos/streetfly_jz/2752896812

http://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/5697792356

http://www.flickr.com/photos/veganstraightedge/5696662117

http://www.flickr.com/photos/drumminhands/4757641653/

More Related Content

PDF
톰캣 #04-환경설정
PPTX
agri inventory - nouka data collector / yaoya data convertor
PDF
T.Pollak y C.Yaconi - Prey
DOCX
CAN in linux
PDF
A little systemtap
KEY
泣かないAppEngine開発
ODP
Perl dancer
PDF
nouka inventry manager
톰캣 #04-환경설정
agri inventory - nouka data collector / yaoya data convertor
T.Pollak y C.Yaconi - Prey
CAN in linux
A little systemtap
泣かないAppEngine開発
Perl dancer
nouka inventry manager

What's hot (20)

PDF
commit => #GitHub => #CircleCI => #Docker => #Kubernetes #AWS cluster
PDF
Docker: ao vivo e a cores
PDF
Docker command
PDF
Perlmania_Study - CPAN
ODP
Tools used for debugging
PDF
Intro django
PPTX
OpenStack Swift - MSST 2011 Tutorial Day
PDF
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
PDF
Puppet Camp 2012
PDF
AMS Node Meetup December presentation Phusion Passenger
PPTX
MySQL Monitoring using Prometheus & Grafana
PDF
gRPC with Scala and Swift
DOCX
Nginx 0.8.x 安装手册
DOCX
Lamp configuration u buntu 10.04
PDF
PFIセミナー資料 H27.10.22
DOCX
Nginx 0.9.x 安装手册
PDF
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
PDF
ByPat博客出品Lvs+keepalived
PDF
Migrating KSM page causes the VM lock up as the KSM page merging list is too ...
commit => #GitHub => #CircleCI => #Docker => #Kubernetes #AWS cluster
Docker: ao vivo e a cores
Docker command
Perlmania_Study - CPAN
Tools used for debugging
Intro django
OpenStack Swift - MSST 2011 Tutorial Day
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Puppet Camp 2012
AMS Node Meetup December presentation Phusion Passenger
MySQL Monitoring using Prometheus & Grafana
gRPC with Scala and Swift
Nginx 0.8.x 安装手册
Lamp configuration u buntu 10.04
PFIセミナー資料 H27.10.22
Nginx 0.9.x 安装手册
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
ByPat博客出品Lvs+keepalived
Migrating KSM page causes the VM lock up as the KSM page merging list is too ...
Ad

Similar to My name is Trinidad (20)

PDF
Trinidad
KEY
Deploying JRuby Web Applications
PDF
TorqueBox
KEY
TorqueBox - Ruby Hoedown 2011
PDF
Continuous Delivery: The Next Frontier
PDF
TorqueBox at DC:JBUG - November 2011
PDF
Instrumentación de entrega continua con Gitlab
PDF
A Tale of a Server Architecture (Frozen Rails 2012)
PDF
Torquebox OSCON Java 2011
KEY
Deploy, Scale and Sleep at Night with JRuby
PDF
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
PDF
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
PDF
Porting Rails Apps to High Availability Systems
PPTX
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
PDF
Infrastructureascode slideshare-160331143725
PDF
Infrastructureascode slideshare-160331143725
KEY
The use of Symfony2 @ Overblog
KEY
Rails services in the walled garden
PDF
JUDCon 2010 Boston : TorqueBox
PDF
Automated Java Deployments With Rpm
Trinidad
Deploying JRuby Web Applications
TorqueBox
TorqueBox - Ruby Hoedown 2011
Continuous Delivery: The Next Frontier
TorqueBox at DC:JBUG - November 2011
Instrumentación de entrega continua con Gitlab
A Tale of a Server Architecture (Frozen Rails 2012)
Torquebox OSCON Java 2011
Deploy, Scale and Sleep at Night with JRuby
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
Porting Rails Apps to High Availability Systems
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
The use of Symfony2 @ Overblog
Rails services in the walled garden
JUDCon 2010 Boston : TorqueBox
Automated Java Deployments With Rpm
Ad

More from David Calavera (7)

PDF
JRuby hacking guide
KEY
Rubyspec y el largo camino hacia Ruby 1.9
ZIP
GTAC: AtomPub, testing your server implementation
PDF
Conferencia Rails: Integracion Continua Y Rails
PDF
ApacheCon: Abdera A Java Atom Pub Implementation
PDF
Taller sobre la api 11870.com
PDF
atomPub, ruby y la api de 11870
JRuby hacking guide
Rubyspec y el largo camino hacia Ruby 1.9
GTAC: AtomPub, testing your server implementation
Conferencia Rails: Integracion Continua Y Rails
ApacheCon: Abdera A Java Atom Pub Implementation
Taller sobre la api 11870.com
atomPub, ruby y la api de 11870

My name is Trinidad