Dev & Ops friendly
Configure the Systems (services) once: apps don't have to care about networking settings. Script deployments using simple commands over netcat or activation files.
Containium Reactor is a Clojure Application Server in Clojure with some truly unique features. A full deployment consists of three parts: core services we call Systems which your apps can use, your Clojure apps put in a special container, making it what we call Containium, and a Reactor process that runs these Systems and Containium.
Configure the Systems (services) once: apps don't have to care about networking settings. Script deployments using simple commands over netcat or activation files.
Wheras projects like Tomcat and WildFly act like a framework, Containium Systems are built so that you can easily compose your own “Reactor”. Easily add custom shared Systems.
Pick and choose what System should run in each JVM, e.g. embed ElasticSearch and Cassandra or run them seperately, it doesn't matter to applications. This gives operations the power to adjust deployment to workloads with no application changes.
Applications only need to implement a Component like start/stop protocol, receiving Systems and configuration as arguments. Quickly spin up Systems locally or during unit tests. All systems optional.
Blazing fast deployments. Once started, the Clojure runtime is loaded. Dependency isolated applications can communicate using Clojure data without serialization.
Deploy your code once or as multiple instances. Simple “deployment descriptor“ (a Clojure map) allowing arbitrary per-instance configuration. Sane conventions reduce the amount of configuration needed.
nREPL is just another optional System. Connect to a single nREPL socket and eval in every running application or the Application Server itself.
Embedded Cassandra server or connect to an existing cluster? Both? Apps don't care, all they see is Cassandra. Unit test queries and run the same in production.
Embedded ElasticSearch server or connect to an existing cluster? Both? Apps don't care, all they see is ElasticSearch. Unit test queries and run the same in production. (hmm this sounds familiar)
Did we mention Apache Kafka yet? It's awesome and another optional System. Unit test your queueing code using the real thing.
The Ring-Analytics System stores requests and reponse ring maps directly and asynchronously in ElasticSearch. No HTTP server log parsing and other complications needed.
New version? If the start function returns successfully, the global ring handler is atomically swapped. In progress requests of the old version simply continue until completed. Start fails? No sweat, existing version is still up!
Scale your applications by adding servers. Ring sessions are (de)serialized quickly using nippy and stored in Cassandra.
Your application needs to send e-mail notifications otherwise known as SPAM? No problem! Postal System included.
Until we release a standalone download you can simply clone the git repository and lein run
.
The full Reactor requires a running Apache Zookeeper server for the Kafka system.
Our Containium Reactor runs in production on SmartOS as an SMF service. We need some time to provide a nice example repository. Contact us if you’re interested.
To build a release:
lein do with-profile +aot compile, jar, libdir
mv target/containium*.jar lib/
To run it:
java -d64 -Djava.awt.headless=true -Dfile.encoding=UTF-8 -javaagent:jamm-0.2.5.jar '-XX:OnOutOfMemoryError=kill -9 %p' -cp /var/lib/containium/config:lib/* -server containium.core
project.clj
(defproject my-project-using-containium "0.1.0-SNAPSHOT"
:dependencies [
[containium "0.1.0-SNAPSHOT" :exclusions [boxure/clojure]]]
:main my-project.main/main)
main.clj
(ns my-project.main
(:require [containium.standalone :as standalone]))
(defn start [systems conf & [routes]]
(println "Starting with config:\n" (print-str conf)))
(defn stop [start-result]
(printlin "Stopping"))
(defn app [request]
{:status 200 :body "Hello world!"})
(defn main []
(standalone/run
;; Define config for all the Systems you want here
{:http-kit {:port 8080} :repl {:port 2121}}
;; The "deployment descriptor" of this app
{:start start :stop stop :ring {:handler 'my-project/app}}))
Then just lein run
and see your app start up.
For a more detailed example, read: Using Containium as a library.
The Containium source code is provided under the Mozilla Public License 2.0
Systems (like Cassandra, ElasticSearch, Kafka, Ring, ...) may use libraries that have other licenses.
© Copyright 2013-2017, the Containium Project Contributors.
Have a few questions? Need a little help getting up and running?
You can get free help from the Containium open source community.