Giter Site home page Giter Site logo

Comments (7)

sehrope avatar sehrope commented on May 17, 2024

Yes there is actually! The log files are explicitly named with the process number to eventually support something like this (i.e. web.00.log instead of web.log).

Two points I'm looking at first though:

  • How to handle multiple web processes? - Currently Dokku forwards a single port per deployed app. If you have multiple, separate web processes you need to be able to forward traffic to each of them.
  • Where to house the config data for this? - I'm thinking of having an additional file in the Dokku app home directory for it. Something like SCALE. It would have the number of processes of each type to spin up for each process type in the Procfile. It needs to be separate from the command itself so that subsequent deployments via "git push" can reuse the previously set value.

from dokku-logging-supervisord.

sehrope avatar sehrope commented on May 17, 2024

This has been added to the plugin. The post-release process now checks for a SCALE file in the app's home directory and uses that to determine how many processes of each type to run. If it does not exist then it will default to just one per process type.

You can also also scale via the command line:

dokku scale myapp web=1 worker=4

Everything still runs in the same container though so for web > 1 to work your web processes must be able to share the listening socket (lookup SO_REUSEPORT for how to do this).

Try it out and let me know how it goes!

from dokku-logging-supervisord.

kelvin22 avatar kelvin22 commented on May 17, 2024

Sorry to comment on an old issue...

How exactly do you go about using SO_REUSEPORT?

from dokku-logging-supervisord.

sehrope avatar sehrope commented on May 17, 2024

How exactly do you go about using SO_REUSEPORT?

It's a socket option when you're creating a server socket that listens on a port. The specifics of how to configure it will depend on your programming language. Your best bet is to do a search for it plus your language/framework for a working example.

from dokku-logging-supervisord.

kelvin22 avatar kelvin22 commented on May 17, 2024

So on a nginx (dokku's), gunicorn, flask, Python stack, would it be handled
by gunicorn? Seems like each of those supports it in some form.

On Saturday, 1 August 2015, Sehrope Sarkuni [email protected]
wrote:

How exactly do you go about using SO_REUSEPORT?

It's a socket option when you're creating a server socket that listens on
a port. The specifics of how to configure it will depend on your
programming language. Your best bet is to do a search for it plus your
language/framework for a working example.


Reply to this email directly or view it on GitHub
#1 (comment)
.

from dokku-logging-supervisord.

sehrope avatar sehrope commented on May 17, 2024

You wouldn't have to touch nginx. I think it also supports that option but it's outside the scope of what I'm describing here.

Using the option within a dokku app is to allow for separate web processes to listen on the same port. That way when nginx forwards a web request to your app, it can be processed by any one of the processes. Without the SO_REUSEPORT option, whichever web process binds to the port first will "win" and the rest will be rejected from listening on it as it's already in use.

Note that it's probably simpler to use a web stack that handles this internally without SO_REUSEPORT and stick to web=1. For example gunicorn supports forking multiple processes and will automatically handle them listening on the same port.

from dokku-logging-supervisord.

kelvin22 avatar kelvin22 commented on May 17, 2024

Thanks @sehrope, your comments gave me the direction I needed to research. There isn't always much information on how all the components of the web stack interact. I've now got a deeper understanding, and have taken on board your suggested gunicorn method of handling multiple processes.

from dokku-logging-supervisord.

Related Issues (19)

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.