TwitterServer Basics

All Finatra servers are TwitterServer-based servers and thus it helps to understand some basics of a TwitterServer.

HTTP Admin Interface

TwitterServer-based servers have the option to start an HTTP Admin Interface bound to a port configurable via the -admin.port flag. If you want to serve an external interface this will be bound to a separate port configurable via either the -http.port, -https.port or -thrift.port flags, depending.

For more information on using and setting command-line flags see Flags.

Disabling the TwitterServer AdminHttpServer

Some deployment environments such as Heroku, AppFog, and OpenShift only allow a single port to be used when deploying an application.

In these cases, you can programmatically disable the TwitterServer HTTP Admin Interface:

class ExampleServer extends HttpServer {
  override val disableAdminHttpServer: Boolean = true
  ...
}

Note

Since the -admin.port flag is currently still required to have a value by TwitterServer you should set the -admin.port flag and your external interface port e.g., -http.port flag to the same value when disabling the TwitterServer AdminHttpServer.

For a working example of disabling the TwitterServer HTTP Admin Interface, see the Heroku hello-world example.

Lifecycle Management

While TwitterServer provides a Lifecycle trait which exposes utilities to manage the lifecycle of your server it does not enforce how they are used.

Finatra orders the TwitterServer lifecycle events, including promoting OldGen and performing initial garbage collection before your server accepts traffic, making sure you bind any external interface before reporting your server is healthy, among other things.

How Finatra orders the lifecycle and uses the TwitterServer Lifecycle trait functions is detailed in the Application and Server Lifecycle section.