After a quick chat with Michal on #aeolus @ freenode

I decided to ACK it because it work and Michal promised will add the missing 
line that
was breaking.

Cheers,
-FV

On Mar 1, 2013, at 11:17 AM, mfoj...@redhat.com wrote:

> From: Michal Fojtik <mfoj...@redhat.com>
> 
> The 'puma' web server is much faster and reliable
> than java webrick.
> 
> Signed-off-by: Michal fojtik <mfoj...@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
> 

Reply via email to