On Mon, Feb 06, 2012 at 08:01:49AM -0800, Bradley wrote:
> I want to deploy a single codebase to two different Heroku apps.  I'd like 
> one of the apps to launch an API service, which is a small Rack app defined 
> in the same codebase of our much larger web app that uses Rails.
> 
> Ideally, I'd like to set something on the api app to use a different app 
> root (and hence different Procfile) for launching the  API.  This way I can 
> maintain one codebase, but a separate, lightweight API service that still 
> has access to things like models etc...
> 
> Is this possible?  I can't find anything in the docs.
> 
> My only other thought was to define a config variable that is the service 
> to actually launch, then use that in the 
> Procfile<https://gist.github.com/1752849>, 
> but this seems a bit messy and possibly error prone.  It would be much 
> nicer if I could specify which Procfile to use or change the root directory 
> of the app to launch on a per-app basis.
> 
> I know the Foremen gem allows you to specify different Procfiles and app 
> roots <http://ddollar.github.com/foreman/#OPTIONS>, but does Heroku?

I'm not sure about the different app roots. But the other approach
definitely works. My (working) example:

$ cat config.ru
$LOAD_PATH.unshift File.dirname(__FILE__)

if ENV['APP_NAME'] == 'web'
  require 'web'
  run Foo::Web
else
  require 'api'
  run Foo::API
end

$ cat Procfile 
web: bundle exec rackup -p $PORT 
worker: bundle exec rake queue:work VERBOSE=1 QUEUE=*

-- 
Jason Dixon
DixonGroup Consulting
http://www.dixongroup.net/

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to