Using Babl
Development Mode
Babl will start in high-performance mode by default, but this can use significant
system resources. For development purposes, use the config properties, or a system property to set
babl.performance.mode=DEVELOPMENT
.
This will cause the server to run in a single thread using a conservative idle strategy.
Library
Babl is available on Maven Central. Used as a project dependency, the server can be launched like so:
private static void launchBabl()
{
BablServer.main(new String[] {"/path/to/config.properties"});
}
Or programmatically:
private void launchBabl()
{
final BablConfig config = PropertiesLoader
.configure(Paths.get("/path/to/config.properties"));
config.applicationConfig().application(new MyApplication());
try (SessionContainers containers = BablServer.launch(config))
{
containers.start();
new ShutdownSignalBarrier().await();
}
}
Docker
Babl is packaged in a docker container for ease of deployment.
The base container is tagged as babl:0.10.0
,
and should be extended with your own container definition:
FROM babl:0.10.0 COPY my-app/build/lib/ /babl/lib/ COPY my-app/build/config/my-app.properties /babl/config ENV BABL_CONFIG_FILE="/babl/config/my-app.properties" ENV JVM_RUNTIME_PARAMETERS="-Dbabl.debug.enabled=true"
The project source code contains an example docker-compose file. This can be used to connect a simple echo application, with HTML resources hosted by an nginx instance.
Standalone
Babl can also be used in a standalone manner.
Simply build the project, and use the -all variant of the JAR from the build/dist
directory:
$ java -jar /path/to/babl-all-0.10.0.jar /path/to/config.properties
Note that there is no legacy HTTP server functionality, so any HTML resources will need to be hosted using a suitable technology. See the Docker Compose example.
For more information on configuration, see Configuration.