Skip to content

Instantly share code, notes, and snippets.

@lusis
Created April 15, 2011 07:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lusis/921292 to your computer and use it in GitHub Desktop.
The way I was FINALLY able to get Noah working on CF
require 'sinatra'
require 'rack'
require 'thin'
require 'noah'
require 'ohm'
vcap_services = JSON.load(ENV['VCAP_SERVICES'])
redis_host = vcap_services["redis-2.2"][0]["credentials"]["hostname"]
redis_port = vcap_services["redis-2.2"][0]["credentials"]["port"]
redis_password = vcap_services["redis-2.2"][0]["credentials"]["password"]
app_ip = vcap_services['VMC_APP_HOST']
app_port = vcap_services['VMC_APP_PORT']
Ohm.connect(:host => redis_host, :port => redis_port, :password => redis_password)
server = ::Rack::Server.new()
server.instance_variable_set('@config', 'config.ru' )
server.start
require 'rubygems'
require 'thin'
require 'noah'
vcap_services = JSON.load(ENV['VCAP_SERVICES'])
redis_host = vcap_services["redis-2.2"][0]["credentials"]["hostname"]
redis_port = vcap_services["redis-2.2"][0]["credentials"]["port"]
redis_password = vcap_services["redis-2.2"][0]["credentials"]["password"]
app_ip = vcap_services['VMC_APP_HOST']
app_port = vcap_services['VMC_APP_PORT']
ENV['REDIS_URL'] = "redis://#{redis_host}:#{redis_port}/0"
noah = Noah::App.new do
set :run, false
end
run noah
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment