Safe Haskell | None |
---|
- type Port = Int
- type Host = String
- data PortManager
- data PortEntry
- data Settings
- portRange :: Settings -> [Port]
- getPort :: PortManager -> KIO (Either SomeException Port)
- releasePort :: PortManager -> Port -> KIO ()
- addEntry :: PortManager -> Host -> PortEntry -> KIO ()
- removeEntry :: PortManager -> Host -> KIO ()
- lookupPort :: PortManager -> ByteString -> KIO (Maybe PortEntry)
- start :: Settings -> KIO (Either SomeException PortManager)
Types
data PortManager Source
An abstract type which can accept commands and sends them to a background nginx thread.
Settings
Controls execution of the nginx thread. Follows the settings type pattern. See: http://www.yesodweb.com/book/settings-types.
Actions
getPort :: PortManager -> KIO (Either SomeException Port)Source
Gets an unassigned port number.
releasePort :: PortManager -> Port -> KIO ()Source
Inform the nginx thread that the given port number is no longer being used, and may be reused by a new process. Note that recycling puts the new ports at the end of the queue (FIFO), so that if an application holds onto the port longer than expected, there should be no issues.
addEntry :: PortManager -> Host -> PortEntry -> KIO ()Source
Add a new entry to the configuration for the given hostname and reload nginx. Will overwrite any existing configuration for the given host. The second point is important: it is how we achieve zero downtime transitions between an old and new version of an app.
removeEntry :: PortManager -> Host -> KIO ()Source
Remove an entry from the configuration and reload nginx.
lookupPort :: PortManager -> ByteString -> KIO (Maybe PortEntry)Source
Initialize
start :: Settings -> KIO (Either SomeException PortManager)Source
Start running a separate thread which will accept commands and modify Nginx's behavior accordingly.