This project contains three services:
quoteswhich serves a random quote fromquotes/resources/quotes.jsonnewsfeedwhich aggregates several RSS feeds togetherfront-endwhich 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 operation 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/dojoOn 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/dojoThis project is also using make, so ensure that you have that on your PATH too.
On Windows with:
Use the Linux steps above and use WSL2 (Windows Subsystem for Linux), you will need to be able to run Docker in this system to run the make commands.
Along with a lot of other things, dojo leverages git configuration of the host system.
The git binary that's included in the dojo image is complied with gnutls.
If you have your git configuration's (.gitconfig) http ssl backend set to openssl it will cause terraform module initializaition issues:
│ error downloading
│ /usr/bin/git exited with 128: Cloning into
│ fatal: Unsupported SSL backend 'openssl'. Supported SSL backends:
│ gnutls
│ .
Best option is to unset this configuration for the interview:
[http]
sslBackend
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.infraArtifacts 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.dockerBut you can build all images at once with
make dockerBefore applications can be deployed on AWS, the docker images have to be pushed:
make pushThen, we can provision the backend and front-end services:
make news.infraTerraform 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