Feature Request: ability to put comments in Procfiles #12

Closed
ruckus opened this Issue May 6, 2011 · 35 comments

Comments

Projects
None yet

ruckus commented May 6, 2011

I'd like to add comments to my Procfile, I tried starting a line with "#" but it complained and failed to boot.

Comments would be great for documentation for team projects.

Owner

ddollar commented May 9, 2011

For now I'd like to leave the Procfile as simple as possible to be easily parseable. Thanks for the feedback!

ddollar closed this May 9, 2011

t0d0r commented Sep 17, 2011

I need this ability too :), will be very usefull for documenting things for the project.

diff --git a/lib/foreman/engine.rb b/lib/foreman/engine.rb
index b624986..21df7d9 100644
--- a/lib/foreman/engine.rb
+++ b/lib/foreman/engine.rb
@@ -29,6 +29,7 @@ class Foreman::Engine
     @processes ||= begin
       @order = []
       procfile.split("\n").inject({}) do |hash, line|
+        next hash if line =~ /^#/
         next hash if line.strip == ""
         name, command = line.split(/\s*:\s+/, 2)
         unless command

I also need an ability to quickly enable/disable some things in development env. + 1 to t0d0r

Same. This would be super handy.

alan commented Sep 27, 2011

I'd like this too.

There is a problem with resque where we have to modify the normal startup of the worker. It would be great to document this change with a link to the existing resque problem.

Agree, this would be extremely useful. "as simple as possible but no simpler". Cheers

lenary commented Nov 7, 2011

as a counterpoint - for development i have a Procfile.dev which runs extra tasks like compiling coffeescript (not a rails app) and running the app with shotgun not rackup. Could you try that instead? the -f option on foreman allows you to specify a different Procfile...

Owner

ddollar commented Nov 7, 2011

The pattern I like to use for these cases is bin/ scripts:

$ cat Procfile
web: bin/web

$ cat bin/web
#!/bin/sh
if [ "$RACK_ENV" == "development" ]; then
  shotgun start -p $PORT
else
  thin start -p $PORT
fi

This keeps the Procfile simple, and should always allow you to start your app using bin/web

lenary commented Nov 7, 2011

ah, that makes sense too, if it weren't for the extra tasks

Owner

ddollar commented Nov 7, 2011

For what it's worth, the Procfile parser now only tries to parse lines that match a certain regex, so comments will likely work.

odigity commented Sep 16, 2012

+1 for comments

marcoceppi referenced this issue in discourse/discourse Feb 13, 2013

Merged

Add foreman procfile #150

+1 for comments

👍

gueyeb commented Mar 21, 2014

+1 for comments too.

odigity commented Mar 21, 2014

This is trivial to implement. In fact, I think that someone demonstrated a one-line change that would do the simplest version of it above. I'd submit a PR myself, but will it be accepted?

A file without comments like is a car without doors. Sure, you can get in through the window, Dukes-of-Hazard-style, but... why?

I thought the same thing. I'd be happy to implement it you, @odigity, can't. And with approval from the makers.

macool commented Apr 2, 2014

+1 for comments

dideler commented Apr 17, 2014

I'm also in favour of this issue being reopened. The suggested workaround doesn't allow you to make a general comment about the Procfile, since the comments would go in the specific shell scripts.

I'm in favor of reopening this as well. Commenting in the procfile during development would allow users to easily test different configurations during development.

+1 I just want to turn things on and off for dev, but not have to delete the whole line and copy it somewhere else!

Matt-- commented Jan 12, 2015

+1 for comments

+1 for comments

+1 for comments

+1 for comments

adisos commented Feb 9, 2015

+1 for comments

+1 for comments

diziet commented Mar 8, 2015

+1, especially as we want to have a Profile.example that folks can use easily

Owner

ddollar commented Mar 8, 2015

Foreman has used a matching filter on the Procfile to only parse lines that look like process entries for a few years now. Are you still running into problems with this?

diziet commented Mar 8, 2015

@ddollar You're correct -- appending # to the beginning of line at the Procfile effectively makes it function like a comment. Sorry for bringing up a nonexistent issue.

I swear I tried it at some point and it didn't work, but it's totally working now. Thanks, guys.

josephabrahams referenced this issue in istrategylabs/mo-django Feb 10, 2016

Closed

use `forego start` to run the application locally #13

jwfearn commented Jun 21, 2016 edited

Using foreman 0.82.0 on OS X 10.11.5 and Ruby 2.1.2 I found that lines starting with # ARE processed, whereas lines starting with // are ignored. For example this Procfile:

# foo: cd foo && bundle exec rails s -p 3000
// bar: cd bar && bundle exec rails s -p 3001
baz: cd baz && bundle exec rails s -p 3002

starts two processes: foo and baz

Would it be possible to add true comments rather than a parser-matching-filter to recognize lines that look like process entries?

If so, please also update docs to indicate how comments work (e.g., comment string: #, //, or other?, whole lines only?, end of line only?, multi-line? __END__? etc.)

+1 for comments

+1 for comments

+1 for comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment