This project contains three services:
quotes
which serves a random quote fromquotes/resources/quotes.json
newsfeed
which aggregates several RSS feeds togetherfront-end
which calls the two previous services and displays the results.
The services are provided as docker images. This README documents the steps to build the images and provision the infrastructure for the services.
There are 2 options for getting the right tools on developer's laptop:
- quick leverage Docker+Dojo. Requires only to install docker and dojo on your laptop.
- manual requires to install all tools manually
The rest of this file describes the quick way, please refer to MANUAL_SETUP.md for the other option.
We can leverage docker to define required build and operations dependencies by referencing docker images.
Dojo is a similar tool to batect. It is just a wrapper around docker commands to bring up a well-defined development environment in containers.
This is the recommended approach as it enforces consistency between CI setup and the tools used by developers.
Assuming you already have a working docker, you can install dojo
On OSX with:
brew install kudulab/homebrew-dojo-osx/dojo
On Linux with:
DOJO_VERSION=0.8.0
wget -O dojo https://github.com/kudulab/dojo/releases/download/${DOJO_VERSION}/dojo_linux_amd64
sudo mv dojo /usr/local/bin
sudo chmod +x /usr/local/bin/dojo
This project is also using make
, so ensure that you have that on your PATH too.
This is a multi-step guide to setup some base infrastructure, and then, on top of it, the test environment for the newsfeed application.
With an assumption that we have a new, empty AWS account, we need to provision some base infrastructure just one time. These steps will provision:
- terraform backend in S3 bucket and locking with DynamoDB
- a minimal VPC with 2 subnets
- ECR repositories for docker images
The interviewer will send you an email with AWS credentials, which you should export in your shell.
export CODE_PREFIX=****
export AWS_SECRET_ACCESS_KEY=****
export AWS_ACCESS_KEY_ID=****
Now run:
source randomize.sh && randomize
make backend-support.infra
make base.infra
Artifacts from previous stage will be packaged into docker images, then pushed to ECR.
Each application has its own image. Individual image can be built with:
make <app-name>.docker
# for example:
make front-end.docker
But you can build all images at once with
make docker
Before applications can be deployed on AWS, the docker images have to be pushed:
make push
Then, we can provision the backend and front-end services:
make news.infra
Terraform will print the output with URL of the front_end server, e.g.
Outputs:
frontend_url = http://34.244.219.156:8080
To delete the deployment provisioned by terraform, run following commands:
make news.deinfra