Skip to content

maksat-software/tesla-microservice

 
 

Repository files navigation

#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.

Clojars Project

Build Status Dependencies Status

Breaking changes

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.

Features included

  • 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.

Choosing a server

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:

Configuring

Applications build with tesla-microservices can be configured via edn-files, that have to be located in the class path.

Order of loading and merging

  1. A file named default.edn is loaded.
  2. A file named by the ENV-variable $CONFIG_FILE is loaded.
  3. A file name local.edn is 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.

ENV-variables

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"]
}

Addons

The basis included is stripped to the very minimum. Additional functionality is available as addons:

More features will be released at a later time as separate addons.

Examples

  • 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.

FAQ

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.

Initial Contributors

Christian Stamm, Felix Bechstein, Ralf Sigmund, Kai Brandes, Florian Weyandt

License

Apache License

About

Common basis for some of otto.de's clojure microservices

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Clojure 100.0%