Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Change app root directory or Procfile name using config vars
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Bradley  
View profile  
 More options Feb 6, 11:01 am
From: Bradley <bradleyrobert...@gmail.com>
Date: Mon, 6 Feb 2012 08:01:49 -0800 (PST)
Local: Mon, Feb 6 2012 11:01 am
Subject: Change app root directory or Procfile name using config vars

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?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil Middleton  
View profile  
 More options Feb 6, 2:26 pm
From: Neil Middleton <neil.middle...@gmail.com>
Date: Mon, 6 Feb 2012 19:26:05 +0000
Local: Mon, Feb 6 2012 2:26 pm
Subject: Re: Change app root directory or Procfile name using config vars

From what I know of Procfiles, it's routine and reliable to have environment variables available to your Procfile, so I'm not sure that the gist approach you link to is as messy and error-prone as you might think.

If you were to abstract it one layer down so that your rack processes pickup which application they're meant to be running, you're still essentially doing the same thing, but in a different place.

To be honest, there's probably a billion ways of doing this, all of which have some sort of pain.  The approach I've taken in the past is either to have two deployable branches which go to different applications on Heroku, or do abstract the common code out and share it with two deployable applications.

However, saying this, stipulating the web command in your environment seems a fairly reasonable way of tackling this.

-Neil


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bradley  
View profile  
 More options Feb 6, 3:16 pm
From: Bradley <bradleyrobert...@gmail.com>
Date: Mon, 6 Feb 2012 12:16:56 -0800 (PST)
Local: Mon, Feb 6 2012 3:16 pm
Subject: Re: Change app root directory or Procfile name using config vars

So potential errors aren't the only concern.  If my API uses different
workers/process etc. from the App it becomes a bit onerous to define all
these different process types using config vars...

Definitely don't want to split my code out (yet) if I can get away with it.
 I wonder if anyone at Heroku can comment on this?  Presumably they have an
internal mechanism for finding the Procfile, it would be great if this was
configurable.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil Middleton  
View profile  
 More options Feb 6, 3:34 pm
From: Neil Middleton <neil.middle...@gmail.com>
Date: Mon, 6 Feb 2012 20:34:29 +0000
Local: Mon, Feb 6 2012 3:34 pm
Subject: Re: Change app root directory or Procfile name using config vars

On Monday, 6 February 2012 at 20:16, Bradley wrote:
> So potential errors aren't the only concern.  If my API uses different workers/process etc. from the App it becomes a bit onerous to define all these different process types using config vars...

Sure, but remember that Heroku won't scale any of the other processes unless you ask it to.  You can easily declare all the other processes in the Procfile and scale them as needs be for each deployment of the application (so the names would need to be unique), only your web process would need to be configurable.

For instance

web:  bundle exec $APP
worker_app1: bundle exec blah
worker_app2: bundle exec blah blah

etc

> Definitely don't want to split my code out (yet) if I can get away with it.  I wonder if anyone at Heroku can comment on this?  Presumably they have an internal mechanism for finding the Procfile, it would be great if this was configurable.

If there is it isn't something that they mention in the docs ("Process types are declared via a file named Procfile placed in the root of your app.") nor is it something that you really have control with with custom build packs (unless you want to get /really/ fruity).

-Neil


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bradley  
View profile  
 More options Feb 6, 3:47 pm
From: Bradley <bradleyrobert...@gmail.com>
Date: Mon, 6 Feb 2012 12:47:45 -0800 (PST)
Local: Mon, Feb 6 2012 3:47 pm
Subject: Re: Change app root directory or Procfile name using config vars

ya I pretty much guessed all of that, just thought I'd see if I could get a
definitive answer from Heroku.

Thanks for the help!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jason Dixon  
View profile  
 More options Feb 6, 11:11 am
From: Jason Dixon <ja...@dixongroup.net>
Date: Mon, 6 Feb 2012 11:11:36 -0500
Local: Mon, Feb 6 2012 11:11 am
Subject: Re: Change app root directory or Procfile name using config vars

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »