SlideShare a Scribd company logo
1 of 60
Download to read offline
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
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

What's hot

commit => #GitHub => #CircleCI => #Docker => #Kubernetes #AWS cluster
commit => #GitHub => #CircleCI => #Docker => #Kubernetes #AWS clustercommit => #GitHub => #CircleCI => #Docker => #Kubernetes #AWS cluster
commit => #GitHub => #CircleCI => #Docker => #Kubernetes #AWS clusterJakub Kulhan
 
Docker command
Docker commandDocker command
Docker commandEric Ahn
 
Perlmania_Study - CPAN
Perlmania_Study - CPANPerlmania_Study - CPAN
Perlmania_Study - CPANJeen Lee
 
Tools used for debugging
Tools used for debuggingTools used for debugging
Tools used for debuggingMarian Marinov
 
OpenStack Swift - MSST 2011 Tutorial Day
OpenStack Swift - MSST 2011 Tutorial DayOpenStack Swift - MSST 2011 Tutorial Day
OpenStack Swift - MSST 2011 Tutorial DayJoshua McKenty
 
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...Develcz
 
AMS Node Meetup December presentation Phusion Passenger
AMS Node Meetup December presentation Phusion PassengerAMS Node Meetup December presentation Phusion Passenger
AMS Node Meetup December presentation Phusion Passengericemobile
 
MySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & GrafanaMySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & GrafanaYoungHeon (Roy) Kim
 
gRPC with Scala and Swift
gRPC with Scala and SwiftgRPC with Scala and Swift
gRPC with Scala and SwiftMarkus Jura
 
Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Yiwei Ma
 
Lamp configuration u buntu 10.04
Lamp configuration   u buntu 10.04Lamp configuration   u buntu 10.04
Lamp configuration u buntu 10.04mikehie
 
PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22Yuya Takei
 
Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册Yiwei Ma
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksCarlos Sanchez
 
ByPat博客出品Lvs+keepalived
ByPat博客出品Lvs+keepalivedByPat博客出品Lvs+keepalived
ByPat博客出品Lvs+keepalivedredhat9
 
Migrating KSM page causes the VM lock up as the KSM page merging list is too ...
Migrating KSM page causes the VM lock up as the KSM page merging list is too ...Migrating KSM page causes the VM lock up as the KSM page merging list is too ...
Migrating KSM page causes the VM lock up as the KSM page merging list is too ...Gavin Guo
 

What's hot (20)

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

Similar to My name is Trinidad

Automated Java Deployments With Rpm
Automated Java Deployments With RpmAutomated Java Deployments With Rpm
Automated Java Deployments With RpmMartin Jackson
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slidesharetomcopeland
 
Continuous testing In PHP
Continuous testing In PHPContinuous testing In PHP
Continuous testing In PHPEric Hogue
 
How to go the extra mile on monitoring
How to go the extra mile on monitoringHow to go the extra mile on monitoring
How to go the extra mile on monitoringTiago Simões
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiJérémy Derussé
 
Beyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with PuppetBeyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with Puppetlutter
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesLindsay Holmwood
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetAchieve Internet
 
Reutov, yunusov, nagibin random numbers take ii
Reutov, yunusov, nagibin   random numbers take iiReutov, yunusov, nagibin   random numbers take ii
Reutov, yunusov, nagibin random numbers take iiDefconRussia
 
Z-Ray: A customizable development tool belt (Zendcon 2016)
Z-Ray: A customizable development tool belt (Zendcon 2016)Z-Ray: A customizable development tool belt (Zendcon 2016)
Z-Ray: A customizable development tool belt (Zendcon 2016)Mathew Beane
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...Puppet
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configurationlutter
 
Spring into rails
Spring into railsSpring into rails
Spring into railsHiro Asari
 
Head First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationHead First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationJace Ju
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year laterChristian Ortner
 

Similar to My name is Trinidad (20)

Trinidad
TrinidadTrinidad
Trinidad
 
Automated Java Deployments With Rpm
Automated Java Deployments With RpmAutomated Java Deployments With Rpm
Automated Java Deployments With Rpm
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
Continuous testing In PHP
Continuous testing In PHPContinuous testing In PHP
Continuous testing In PHP
 
How to go the extra mile on monitoring
How to go the extra mile on monitoringHow to go the extra mile on monitoring
How to go the extra mile on monitoring
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
infra-as-code
infra-as-codeinfra-as-code
infra-as-code
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
 
Beyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with PuppetBeyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with Puppet
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Reutov, yunusov, nagibin random numbers take ii
Reutov, yunusov, nagibin   random numbers take iiReutov, yunusov, nagibin   random numbers take ii
Reutov, yunusov, nagibin random numbers take ii
 
Random numbers
Random numbersRandom numbers
Random numbers
 
Z-Ray: A customizable development tool belt (Zendcon 2016)
Z-Ray: A customizable development tool belt (Zendcon 2016)Z-Ray: A customizable development tool belt (Zendcon 2016)
Z-Ray: A customizable development tool belt (Zendcon 2016)
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
 
Spring into rails
Spring into railsSpring into rails
Spring into rails
 
Head First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationHead First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & Application
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year later
 
Ubic
UbicUbic
Ubic
 

More from David Calavera

Rubyspec y el largo camino hacia Ruby 1.9
Rubyspec y el largo camino hacia Ruby 1.9Rubyspec y el largo camino hacia Ruby 1.9
Rubyspec y el largo camino hacia Ruby 1.9David Calavera
 
GTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementationGTAC: AtomPub, testing your server implementation
GTAC: AtomPub, testing your server implementationDavid Calavera
 
Conferencia Rails: Integracion Continua Y Rails
Conferencia Rails: Integracion Continua Y RailsConferencia Rails: Integracion Continua Y Rails
Conferencia Rails: Integracion Continua Y RailsDavid Calavera
 
ApacheCon: Abdera A Java Atom Pub Implementation
ApacheCon: Abdera A Java Atom Pub ImplementationApacheCon: Abdera A Java Atom Pub Implementation
ApacheCon: Abdera A Java Atom Pub ImplementationDavid Calavera
 
Taller sobre la api 11870.com
Taller sobre la api 11870.comTaller sobre la api 11870.com
Taller sobre la api 11870.comDavid Calavera
 
atomPub, ruby y la api de 11870
atomPub, ruby y la api de 11870atomPub, ruby y la api de 11870
atomPub, ruby y la api de 11870David Calavera
 

More from David Calavera (7)

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

My name is Trinidad