deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <mfoj...@redhat.com>
Subject Re: [PATCH core] Core: Added support for jruby Puma server
Date Fri, 01 Mar 2013 16:18:51 GMT
On 03/01, Francesco Vollero wrote:

Yeah, this is not related to this patch. For some reason we
removed the org.sqlite.JDBC initialization.

The patch:

server/lib/initializers/database_initialize.rb

+if RUBY_PLATFORM == 'java'
+  require 'jdbc/sqlite3'
+  Jdbc::SQLite3.load_driver
+end

I'll send it separately. The server will start if you use only '-f
deltacloud'.

  -- Michal

> I tested the patch within the mock driver and seems to work from curl and from browser
> 
> While I was running the tests on mock driver I hit a problem and the backtrace is here:
> 
> Obviously before testing it, I run it from a "clean" gemset and run bundle install on
it.
> 
> 
> -FV 
> 
> ## Backtrace
> 
> [fvollero@nosside server][jruby_puma*]$ rake test:drivers:mock 
> NameError: missing class or uppercase package name (`org.sqlite.JDBC')
>   get_proxy_or_package_under_package at org/jruby/javasupport/JavaUtilities.java:54
>                       method_missing at file:/Users/raven/.rvm/rubies/jruby-1.7.3/lib/jruby.jar!/jruby/java/java_package_module_template.rb:14
>                                 JDBC at /Users/raven/.rvm/gems/jruby-1.7.3@deltacloud/gems/sequel-3.42.0/lib/sequel/adapters/jdbc.rb:52
>                                 call at org/jruby/RubyProc.java:249
>                           initialize at /Users/raven/.rvm/gems/jruby-1.7.3@deltacloud/gems/sequel-3.42.0/lib/sequel/adapters/jdbc.rb:174
>                              connect at /Users/raven/.rvm/gems/jruby-1.7.3@deltacloud/gems/sequel-3.42.0/lib/sequel/database/connecting.rb:78
>                              connect at /Users/raven/.rvm/gems/jruby-1.7.3@deltacloud/gems/sequel-3.42.0/lib/sequel/core.rb:147
>                             database at /Users/raven/tmp/deltacloud/server/lib/db.rb:26
>                  initialize_database at /Users/raven/tmp/deltacloud/server/lib/db.rb:30
>                               (root) at /Users/raven/tmp/deltacloud/server/lib/initializers/database_initialize.rb:46
>                              require at org/jruby/RubyKernel.java:1027
>                               (root) at file:/Users/raven/.rvm/rubies/jruby-1.7.3/lib/jruby.jar!/jruby/kernel19/kernel.rb:1
>                     require_relative at file:/Users/raven/.rvm/rubies/jruby-1.7.3/lib/jruby.jar!/jruby/kernel19/kernel.rb:19
>                              require at org/jruby/RubyKernel.java:1027
>                               (root) at /Users/raven/tmp/deltacloud/server/lib/initialize.rb:27
>                               (root) at file:/Users/raven/.rvm/rubies/jruby-1.7.3/lib/jruby.jar!/jruby/kernel19/kernel.rb:1
>                              require at org/jruby/RubyKernel.java:1027
>                     require_relative at file:/Users/raven/.rvm/rubies/jruby-1.7.3/lib/jruby.jar!/jruby/kernel19/kernel.rb:19
>                               (root) at /Users/raven/tmp/deltacloud/server/tests/test_helper.rb:13
>                              require at org/jruby/RubyKernel.java:1027
>                               (root) at file:/Users/raven/.rvm/rubies/jruby-1.7.3/lib/jruby.jar!/jruby/kernel19/kernel.rb:1
>                     require_relative at file:/Users/raven/.rvm/rubies/jruby-1.7.3/lib/jruby.jar!/jruby/kernel19/kernel.rb:19
>                              require at org/jruby/RubyKernel.java:1027
>                               (root) at /Users/raven/tmp/deltacloud/server/tests/drivers/mock/common.rb:1
>                                 each at org/jruby/RubyArray.java:1613
>                               (root) at file:/Users/raven/.rvm/rubies/jruby-1.7.3/lib/jruby.jar!/jruby/kernel19/kernel.rb:1
>                     require_relative at file:/Users/raven/.rvm/rubies/jruby-1.7.3/lib/jruby.jar!/jruby/kernel19/kernel.rb:19
>                               (root) at /Users/raven/tmp/deltacloud/server/tests/drivers/mock/buckets_test.rb:4
>                               (root) at /Users/raven/.rvm/rubies/jruby-1.7.3/bin/testrb:3
> rake aborted!
> 1
> org/jruby/RubyProc.java:249:in `call'
> org/jruby/RubyProc.java:249:in `call'
> org/jruby/RubyArray.java:1613:in `each'
> org/jruby/RubyArray.java:1613:in `each'
> org/jruby/RubyKernel.java:1046:in `load'
> org/jruby/RubyKernel.java:1066:in `eval'
> /Users/raven/.rvm/gems/jruby-1.7.3@deltacloud/bin/ruby_noexec_wrapper:14:in `(root)'
> Tasks: TOP => test:drivers:mock
> (See full trace by running task with --trace)
> 
> ##
> 
> 
> On Mar 1, 2013, at 11:17 AM, mfojtik@redhat.com wrote:
> 
> > From: Michal Fojtik <mfojtik@redhat.com>
> > 
> > The 'puma' web server is much faster and reliable
> > than java webrick.
> > 
> > Signed-off-by: Michal fojtik <mfojtik@redhat.com>
> > ---
> > server/Gemfile         |  1 +
> > server/bin/deltacloudd | 24 +++++++++++++++++-------
> > 2 files changed, 18 insertions(+), 7 deletions(-)
> > 
> > diff --git a/server/Gemfile b/server/Gemfile
> > index 4df57fe..bd56845 100644
> > --- a/server/Gemfile
> > +++ b/server/Gemfile
> > @@ -4,6 +4,7 @@ gemspec
> > 
> > platforms :jruby do
> >   gem 'jruby-openssl'
> > +  gem 'puma'
> > end
> > 
> > group :development do
> > diff --git a/server/bin/deltacloudd b/server/bin/deltacloudd
> > index 8cb8702..836bc55 100755
> > --- a/server/bin/deltacloudd
> > +++ b/server/bin/deltacloudd
> > @@ -178,7 +178,6 @@ if !options[:daemon] || options[:daemon] && !have_thin
> >     msg << ":: http://#{ENV["API_HOST"]}:#{ENV["API_PORT"]}/#{api_uri}"
> >   end
> >   puts msg
> > -  puts
> > end
> > 
> > if ENV['API_USER'] && ENV['API_PASSWORD']
> > @@ -192,11 +191,11 @@ unless have_thin
> > 
> >   puts "To start Deltacloud as a daemon, install 'thin' (gem install thin)\n\n"
if options[:daemon]
> > 
> > +  port = ENV["API_PORT"].to_i
> >   # Read in config.ru and convert it to an instance of Rack::Builder
> >   cfgfile = File.read(File.join($top_srcdir, 'config.ru'))
> >   inner_app = eval("Rack::Builder.new {(" + cfgfile + "\n )}.to_app",
> >                    nil, 'config.ru')
> > -
> >   app = Rack::Builder.new {
> >     use Rack::CommonLogger # apache-like logging
> >     use Rack::Reloader #if options[:env] == "development"
> > @@ -208,11 +207,22 @@ unless have_thin
> >   port = ENV["API_PORT"].to_i
> >   puts "=> Ctrl-C to shutdown server"
> >   Dir::chdir($top_srcdir)
> > -  Rack::Server::start(:app => app,
> > -                      :server => :webrick,
> > -                      :Host => ENV["API_HOST"],
> > -                      :Port => port,
> > -                      :AccessLog => [])
> > +
> > +  if RUBY_PLATFORM == 'java'
> > +    require 'puma'
> > +    events = Puma::Events.new STDOUT, STDERR
> > +    server = Puma::Server.new app, events
> > +    server.add_tcp_listener ENV['API_HOST'], port
> > +    server.run(false)
> > +  else
> > +    # There's a bug with string ports on JRuby so convert to int
> > +    # http://jira.codehaus.org/browse/JRUBY-4868
> > +    puts "=> Ctrl-C to shutdown server"
> > +    Rack::Server::start(:app => app,
> > +                        :Host => ENV["API_HOST"],
> > +                        :Port => port,
> > +                        :AccessLog => [])
> > +  end
> > else
> >   argv_opts = ARGV.clone
> >   argv_opts << ['start'] unless Thin::Runner.commands.include?(options[0])
> > -- 
> > 1.8.1.2
> > 
> 

-- 
Michal Fojtik <mfojtik@redhat.com>
Deltacloud API, CloudForms

Mime
View raw message