A small service for sending e-mails via different providers
The service is designed with an API defined by the protocol buffer defined in proto/email.proto
. Here we have the gRPC endpoint for sending e-mail, and message types for requests and responses. This gives is a programming language agnostict specification that we can easy use to generate code for new clients.
The structure of the service and the interface to the underlying e-mail providers is specified in pkg/email/email.go
, while the implementations of the specific providers and the handling of sending is in pkg/email/handler.go
.
The services is setup with a Prometheus scrap endpoint for metrics, to monitor traffic... TODO actual metrics
In manifests/email-service.yaml
are definitions of Kubernetes resources, to deploy the service. This creates 2 replicas of the service that are loadbalanced through a GCP ingress, and will automatically scale on CPU load up to 12 replicas through a Kubernetes HorizontalPodAutoscaler. In cmd/async-client/client.go
is a client implementation that does a lot of parallel requests to test the scaling.
The e-mail service can be started with:
go run cmd/service/service.go
When the service is running, it can be tested with the client:
go run cmd/client/client.go
go test ./...