Can a Procfile have comments?
It seems Heroku does not actually accept //
as comments (it breaks), whereas #
seems to work.
Anyway, to test your Procfile you can use the heroku local
command
As a 2020 update to this question, Heroku has switched from using Forego within Heroku Local to node-foreman (a port of the original foreman). That being said, not much has changed regarding how Procfiles are read and wrote by foreman since 2017. However around the end of June 2016 (after the May 2016 update to this question), it seems users have found processes will still be launched from lines starting with #
. The following will still launch a process:
# foo: cd foo && bundle exec rails s -p 3000
On the other hand, it seems //
does prevent a process from being launched on that line. Preventing the following from running:
// foo: cd foo && bundle exec rails s -p 3000
You may be able to use either one to create comments since, as the above suggests, lines starting with #
will be not be read unless they have a valid process declared on it. On the other hand, if you're attempting to comment out a line with a valid process declared on it, it seems //
is the comment style to use.
Yes, you can put comments in a Procfile. I know of two programs which parse Procfiles, foreman and forego.
In foreman, which originated the Procfile format, a Procfile can contain comments, blank lines, and in fact any line that doesn't look like a meaningful Procfile line.
From the class that parses a Procfile:
# A valid Procfile entry is captured by this regex:
#
# /^([A-Za-z0-9_]+):\s*(.+)$/
#
# All other lines are ignored.
forego, which Heroku uses, follows the same scheme.