#tesla
Tesla is a basic set of components to build microservices in Clojure plus some useful components. It is built upon Mount to support stateful components in a very clojuresque way.
These are the (stateful) components defined by Tesla (gorillalabs.tesla/core
) itself:
- a metrics reporter to gather and distribute metrics
- a handler component to manage your http handlers and register them to your http server.
- an http server (actually, it's httpkit with a minimal wrapper)
- a state to aggregate component state to an appstate, so we can get a view into the state of our application as a whole. Register your components to use this.
- a health check you can set to UNHEALTHY from your code (will be set if Tesla is shutting down). This will give your loadbalancers a signal to take a certain instance off the balancing.
- a scheduling component based upon Quarzite.
- a Shutdown mechanism. If necessary delayed, so load-balancers have time to notice.
Tesla is a fork of Tesla Microservices by Otto.de, or to be more precise one of Kai Brandes' fork.
We us tesla for a number of different services now. However, it's not a 1.0.0 version and it still is to be considered work in progress. See CHANGES.md for instructions on breaking changes.
(ns gorillalabs.ms-example
(:require [gorillalabs.tesla :as tesla]
[clojure.tools.logging :as log]
[gorillalabs.tesla.component.httpkit :as server])
(:gen-class))
(defn -main [& args]
(log/info "Starting MS-EXAMPLE")
(tesla/start
{:http-server #'server/server}
;put your custom states you want to start with the default states here
))
Yes, just fork the Github repo, make changes and create a pull request
against the develop
branch.
Make sure to have documentation, tests, etc. Whatever it takes to
be a good OSS citizen.
Apache License