foreman icon indicating copy to clipboard operation
foreman copied to clipboard

Feature Request: ability to put comments in Procfiles

Open ruckus opened this issue 15 years ago • 37 comments

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.

ruckus avatar May 06 '11 21:05 ruckus

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

ddollar avatar May 09 '11 19:05 ddollar

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

t0d0r avatar Sep 17 '11 13:09 t0d0r

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

denmarkin avatar Sep 22 '11 12:09 denmarkin

Same. This would be super handy.

pguillory avatar Sep 24 '11 19:09 pguillory

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.

alan avatar Sep 27 '11 15:09 alan

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

christianl avatar Nov 06 '11 22:11 christianl

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...

lenary avatar Nov 07 '11 16:11 lenary

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

ddollar avatar Nov 07 '11 16:11 ddollar

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

lenary avatar Nov 07 '11 17:11 lenary

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

ddollar avatar Nov 07 '11 19:11 ddollar

+1 for comments

odigity avatar Sep 16 '12 15:09 odigity

+1

stationkeeping avatar Jan 23 '13 14:01 stationkeeping

+1 for comments

mariusbutuc avatar Feb 17 '13 03:02 mariusbutuc

:+1:

WattsInABox avatar Sep 13 '13 17:09 WattsInABox

+1 for comments too.

gueyeb avatar Mar 21 '14 09:03 gueyeb

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?

odigity avatar Mar 21 '14 15:03 odigity

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

WattsInABox avatar Mar 21 '14 15:03 WattsInABox

+1 for comments

macool avatar Apr 02 '14 18:04 macool

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.

dideler avatar Apr 17 '14 21:04 dideler

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.

joshnroy avatar Jul 10 '14 13:07 joshnroy