Microservice framework following best cloud practices with a focus on productivity.
Patron has two basic concepts:
A Component
implements the following interface:
type Component interface {
Run(ctx context.Context) error
}
This allows a Service
to start and then gracefully shutdown a Component
via context cancellation.
The framework distinguishes between two types of components:
The following component implementations are available:
The Service
has the role of gluing all the above together:
The service has some default settings which can be changed via environment variables:
50000
with PATRON_HTTP_DEFAULT_PORT
PATRON_HTTP_READ_TIMEOUT
, PATRON_HTTP_WRITE_TIMEOUT
respectively. For acceptable values check here.INFO
log level with PATRON_LOG_LEVEL
0.0.0.0
with PATRON_JAEGER_AGENT_HOST
6831
with PATRON_JAEGER_AGENT_PORT
probabilistic
with PATRON_JAEGER_SAMPLER_TYPE
0.0
with PATRON_JAEGER_SAMPLER_PARAM
, which means that no traces are sent.The service provides also the option to bypass the legacy created HTTP component and use the new v2 component. This will effectively disable the default legacy HTTP component.
err = service.WithRouter(router).WithSIGHUP(sig).Run(ctx)
if err != nil {
log.Fatalf("failed to create and run service %v", err)
}
This above builder extension is temporary until we fully replace the legacy HTTP component with our v2 component.