#tesla-microservice
"If Edison had a needle to find in a haystack, he would proceed at once with the diligence of the bee to examine straw after straw until he found the object of his search." - Nikola Tesla
This is the common basis for some of otto.de's microservices. It is written in clojure using the component framework.
tesla-microservice is used for a number of different services now. Still it is a work in progress. See CHANGES.md for instructions on breaking changes.
- Load configuration from filesystem.
- Aggregate a status.
- Reply to a health check.
- Deliver a json status report.
- Report to graphite using the metrics library.
- Manage handlers using ring.
- Shutdown gracefully. If necessary delayed, so load-balancers have time to notice.
As of version 0.1.15 there is no server included any more directly in tesla-microservice.
This gives you the freedom to a) not use any server at all (e.g. for embedded use) b) choose another server e.g. a non-blocking one like httpkit or immutant. The available options are:
- tesla-jetty: The tried and tested embedded jetty.
- tesla-httpkit: The non-blocking httpkit.
Applications build with tesla-microservices can be configured via
edn-files, that have to be located in the class path.
- A file named
default.ednis loaded. - A file named by the ENV-variable
$CONFIG_FILEis loaded. - A file name
local.ednis loaded.
The configuration hash-map in those files is loaded and merged in the specified order. Which mean configurations for the same key is overridden by the latter occurrence.
In contrast to former versions of tesla-microservice ENV-variables are not
merged into the configuration.
But you can easily specify ENV-variables, that should be accessible in your configuration:
{
:my-app-secret #ts/env [:my-env-dep-app-secret "default"]
}The basis included is stripped to the very minimum. Additional functionality is available as addons:
- tesla-zookeeper-observer: Read only access to zookeeper.
- tesla-mongo-connect: Read/write access to mongodb.
- tesla-cachefile: Read and write a cachefile. Locally or in hdfs.
More features will be released at a later time as separate addons.
- A growing set of example apllications can be found at tesla-examples.
- David & Germán created an example application based, among other, on tesla-microservice. They wrote a very instructive blog post about it
- Moritz created tesla-pubsub-service. It showcases how to connect components via core.async channels. Also the embedded jetty was replaced by immutant.
Q: Is it any good? A: Yes.
Q: Why tesla? A: It's a reference to the ingenious scientist and inventor.
Q: Are there alternatives? A: Yes. You might want to look at modularity.org, system and duct.
Christian Stamm, Felix Bechstein, Ralf Sigmund, Kai Brandes, Florian Weyandt
Apache License