add a "sockets" option in Circus #142

Closed
tarekziade opened this Issue Jun 4, 2012 · 2 comments

Comments

Projects
None yet
2 participants
Owner

tarekziade commented Jun 4, 2012

Configuration files and API, will gain a 'sockets' option, which is a list of sockets.

Each socket is defined by :

  • unique name (likely the section name)
  • host
  • port
  • family (default: AF_INET)
  • type (default: SOCK_STREAM)
  • options (default SOL_SOCKET, SO_REUSEADDR)

Example:

[socket:web]
host = localhost
port = 8080

When Circus starts, it creates and bind + listen on the defined sockets.

Each socket is accessible by any process under any watchers, as long as the watcher section has the "use_sockets" flag enabled

Seeing a socket means that the process will be able to get a list of FDs with the socket name, and decide what to do.

Circus will also let the watchers use a socket fd value in the cmd line. example:

[watcher:web]

use_sockets = true
cmd = someserver --fd {SOCKET:web}

One use case -- a web worker - see https://github.com/tarekziade/chaussette, so Circus can act as a pre-fork web server

@ghost ghost assigned tarekziade Jun 6, 2012

Owner

tarekziade commented Jun 6, 2012

Chaussette, uWsgi and Meinheld trunk have the fd feature that makes them compatible.

myroslav commented Jun 6, 2012

I'd suggest looking into systemd socket activation (http://0pointer.de/blog/projects/inetd.html) to borrow ideas or build upon them.

The python approach to systemd socket activation support can be looked up at http://gfxmonk.net/2012/05/15/systemd-socket-activation-in-python.html

IMHO there is some overlap between Circus functionality and systemd --user mode functionality.

@tarekziade tarekziade referenced this issue Jun 13, 2012

Merged

Socket #154

@tarekziade tarekziade closed this Jun 14, 2012

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