Java (for development only):
compile group: "org.http4k", name: "http4k-cloudnative", version: "3.101.0"
http4k applications are naturally at home operating in distributed, Cloud Native environments. Whilst simple to create, this module provides requisite tooling to get apps up and running with the minimum of effort to enable the following operational aspects:
Because http4k does not use reflection or annotation process for application startup, all of the supported Server-backends start up and shutdown very quickly - this is crucial for cloud-based environments where an orchestration framework might move instances around to redistribute load or avoid problematic server/rack/DCs.
All application configuration should be injected via environmental variables. http4k provides an
Environment object, along with
typesafe variable binding using the in-built Lenses mechanism. This typesafe API is consistent with the other usages of Lenses
throughout http4k, so should have a near-zero learning curve. Also provided are a set of extension methods for retrieving standard
environmental config for service ports from Kubernetes.
Orchestration software such as Kubernetes and CloudFoundry regularly query a set of diagnostic endpoints to monitor the state of an
application. This module provides standardised
HttpHandler implementations to model the following endpoints:
- Liveness - used to determine if the application is actually alive.
- Readiness - used to determine if the application is available to receive production traffic from the cloud Load Balancer. This
endpoint performs a series of diagnostic checks against it's dependencies (such as database connectivity) and collates the
results to report back to the orchestrator. http4k provides the
ReadinessCheckinterface which can be implementaed as required and plugged into the endpoint.
In Kubernetes, his set of endpoints is generally hosted on a second port to avoid the API clashes, so http4k provides the machinery to
easily start these services on a different port to the main application API via the