Safe Haskell | None |
---|
- type Port = Int
- type Host = String
- data Entry
- data Nginx
- data Settings
- configFile :: Settings -> FilePath
- reloadAction :: Settings -> KIO (Either SomeException ())
- startAction :: Settings -> KIO (Either SomeException ())
- portRange :: Settings -> [Port]
- getPort :: Nginx -> KIO (Either SomeException Port)
- releasePort :: Nginx -> Port -> KIO ()
- addEntry :: Nginx -> Host -> Entry -> KIO ()
- removeEntry :: Nginx -> Host -> KIO ()
- start :: Settings -> KIO (Either SomeException Nginx)
Types
An individual virtual host may either be a reverse proxy to an app
(AppEntry
), or may serve static files (StaticEntry
).
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.
configFile :: Settings -> FilePathSource
Location of config file. Default: /etc/nginx/sites-enabled/keter
reloadAction :: Settings -> KIO (Either SomeException ())Source
How to tell Nginx to reload config file. Default: /etc/init.d/nginx reload
startAction :: Settings -> KIO (Either SomeException ())Source
How to tell Nginx to start running. Default: /etc/init.d/nginx start
Actions
releasePort :: Nginx -> 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 :: Nginx -> Host -> Entry -> 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 :: Nginx -> Host -> KIO ()Source
Remove an entry from the configuration and reload nginx.