A simple microservices application that consists of a frontend and a backend.
The frontend has a single endpoint /
that prints statistics about the
hostname and date/time. If you add ?services=backend
at the end, the frontend
sends a HTTP request to the backend service, asking for statistics as well.
It will print additional information about the outcome of the HTTP response.
In a nutshell:
make build
to build. You need Go 1.18+.make up
to run on Docker.make down
to stop on Docker.make build down up
ormake build restart
for a typical dev cycle.
To push the images into ECR repositories (after configuring your AWS account),
run make push
in the directory of each service.
First, configure your environment by doing:
- Install
direnv
from here cp .envrc.template .envrc
- Edit the
.envrc
file to your environment - Run
direnv allow
to set the environment variables every time your enter the directory - Double check with
env | sort
that the environments are actually set
Now, Backend and frontend services can be deployed to an AWS ECS cluster with
the code in the deploy
folder. It utilizes AWS CDK v2 to do so. You can do:
cd deploy
npm install
make bootstrap
to bootstrap the CDK. This is only required once per AWS account and region.make build
to synthesize the AWS resources into a CloudFormation templatemake deploy
to deploy the CloudFormation template to your AWS account- ...
make destroy
to remove the resources from your AWS account
Copyright (c) 2022 Oliver Eilhard. All rights reserved.