0

I am working with an app and am looking to deploy to heroku. Full source here.

The primary error that I am seeing is

heroku[router]: at=info method=GET path="/" host=cheesyparts.herokuapp.com request_id=25d2dbb5-e13a-4146-bb3a-9386f997c44c fwd="54.234.191.55" dyno=web.1 connect=2 service=3 status=404 bytes=417

Locally when I attempt to lauch via foreman the same issue occurs. However, I am able to launch the server and run it if I use the ruby parts_server_control.rb run. Any tip is appreciated.

The config.ru looks like this

require './parts_server'
run Sinatra::Application

and the control script parts_server_control.rb looks like:

require "bundler/setup"
require "daemons"
require "pathological"
require "thin"

Daemons.run_proc("parts_server", :monitor => true) do
  require "parts_server"

  Thin::Server.start("0.0.0.0", PORT, CheesyParts::Server)
end
matt
  • 78,533
  • 8
  • 163
  • 197
Sam
  • 185
  • 2
  • 9

1 Answers1

1

The control script is running the app class CheesyParts::Server, but your but your config.ru (used by foreman and Heroku) assumes the app written in the classic style and is using the class Sinatra::Application. See the Sinatra docs on modular and classic application styles. Since nothing is added to Sinatra::Application it is an “empty” app and so you will get 404 errors for any route.

The fix is to change the line

run Sinatra::Application

in your config.ru to

run CheesyParts::Server

so that that class will be used as the main app.

matt
  • 78,533
  • 8
  • 163
  • 197