Code Monkey home page Code Monkey logo

Comments (8)

nickstenning avatar nickstenning commented on May 23, 2024 2

No, that's exactly what honcho is meant to do, and it's exactly what foreman does too:

$ honcho start -f test/fixtures/Procfile.ports -c web=3,es=1,redis=1,worker=1 | grep PORT
21:41:02 web.1    | PORT=5000
21:41:02 web.2    | PORT=5001
21:41:02 web.3    | PORT=5002
21:41:02 worker.1 | PORT=5100
21:41:02 redis.1  | PORT=5200
21:41:02 es.1     | PORT=5300
$ foreman start -f test/fixtures/Procfile.ports -m web=3,es=1,redis=1,worker=1 | grep PORT
21:41:07 web.1    | PORT=5000
21:41:07 web.2    | PORT=5001
21:41:07 web.3    | PORT=5002
21:41:07 worker.1 | PORT=5100
21:41:07 redis.1  | PORT=5200
21:41:07 es.1     | PORT=5300

The Heroku stack has a native understanding of the Procfile format, and you shouldn't need to use either honcho or foreman directly. See the Heroku documentation for further information.

Closing.

from honcho.

eelkevdbos avatar eelkevdbos commented on May 23, 2024 1

This ticket saved me another hour of debugging.

For those interested: https://ddollar.github.io/foreman/#PROCFILE

The special environment variables $PORT and $PS are available within the Procfile. $PORT is the port selected for that process. $PS is the name of the process for the line.

The $PORT value starts as the base port as specified by -p, then increments by 100 for each new process line. Multiple instances of the same process are assigned $PORT values that increment by 1.

from honcho.

alej0varas avatar alej0varas commented on May 23, 2024

I'm working on this at https://github.com/alej0varas/honcho

from honcho.

heyman avatar heyman commented on May 23, 2024

I have a related problem, which is that there seem to be some automatic PORT incrementing going on (https://github.com/nickstenning/honcho/blob/master/honcho/command.py#L171), which makes honcho hard to use with heroku which kills processes that listens on any other port than the one specified in $PORT. Also, it's a behavior that is different from foreman.

from honcho.

heyman avatar heyman commented on May 23, 2024

Hi! I've now investigated this a little more, and of course found out that the port incrementing is done by both foreman as well. Sorry for the assumption that this was wrong.

However, I believe I've managed to find a difference with the $PORT between foreman and honcho. If i use -p 5000, Foreman seems to consistently set the $PORT variable for the first process of the first process type to 5000, while the process that gets assigned the 5000 port with honcho seems more random.

The following Procfile

p1: echo $PORT; sleep 1
p2: echo $PORT; sleep 1
p3: echo $PORT; sleep 1

Results in the following output with foreman:

§ foreman start -f TestProcfile -p 5000
10:08:56 p3.1      | started with pid 95661
10:08:56 p2.1      | started with pid 95660
10:08:56 p1.1      | started with pid 95659
10:08:56 p3.1      | 5200; sleep 1
10:08:56 p2.1      | 5100; sleep 1
10:08:56 p1.1      | 5000; sleep 1
10:08:56 p3.1      | process terminated
10:08:56 system    | sending SIGTERM to all processes
10:08:56 system    | sending SIGTERM to pid 95659
10:08:56 system    | sending SIGTERM to pid 95660
10:08:56 p2.1      | process terminated
10:08:56 p1.1      | process terminated

And the following with honcho:

§ honcho start -f TestProcfile -p 5000
10:09:46 p2.1   | started with pid 95670
10:09:46 p3.1   | started with pid 95671
10:09:46 p1.1   | started with pid 95672
10:09:46 p2.1   | 5000
10:09:46 p3.1   | 6001
10:09:46 p1.1   | 7002
10:09:47 p2.1   | process terminated
10:09:47 system | sending SIGTERM to all processes
10:09:47 p3.1   | process terminated
10:09:47 p1.1   | process terminated

If you're running honcho/foreman on Heroku (and I know this is unorthodox, but there are scenarios where this can be beneficial) it's good to have a deterministic way that the $PORT gets assigned.

from honcho.

nickstenning avatar nickstenning commented on May 23, 2024

This issue is known and has been addressed in the master branch. See issue #13.

If you have additional problems, would you mind filing separate tickets rather than using this one as a forum for discussion? Thank you!

from honcho.

heyman avatar heyman commented on May 23, 2024

I believed the problem I saw was related to this issue, otherwise I wouldn't have posted here. I jumped to conclusions that was wrong, and I'm very sorry about that. I never meant to use this one as a forum, or to waste your time. Sorry =/.

from honcho.

nickstenning avatar nickstenning commented on May 23, 2024

No need to be sorry, and sorry if my last comment sounded curt. It was just composed on a train, that's all =).

You're not wasting my time, and not to worry about this ticket!

from honcho.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.