Skip to content

Instantly share code, notes, and snippets.

@colinsurprenant
Created June 12, 2012 20:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save colinsurprenant/2920012 to your computer and use it in GitHub Desktop.
Save colinsurprenant/2920012 to your computer and use it in GitHub Desktop.
Raad simple JRuby service example with Sinatra and Puma

start in console mode, verbose option

$ jruby --1.9 service.rb -v start

start in daemon mode, verbose option and stdout redirection option. note that by default in daemon mode, logging will be in "service name".log, here service.log.

$ jruby --1.9 service.rb -v -r service.stdout -d start
require 'sinatra/base'
class Controller < Sinatra::Base
set :server, 'puma'
set :port, 9595
get '/' do
Raad::Logger.info("Hello World")
"<html><body>Hello World</body></html>"
end
end
source :rubygems
gem 'raad'
gem 'puma'
gem 'sinatra'
require 'bundler/setup'
require 'controller'
require 'raad'
class Service
def start
Controller.run!
end
def stop
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment