Skip to content

Standalone in-house Digital Landscape in React.js and Node.js hosted on AWS ECS Fargate.

License

Notifications You must be signed in to change notification settings

ONS-Innovation/keh-digital-landscape

Repository files navigation

Tech Radar

Tech Radar is a tool that helps you track the infrastructure, languages, frameworks and CI/CD used in the ONS repositories and then categorises them into Adopt, Trial, Assess or Hold.

Use the following keyboard shortcuts to navigate the tech radar:

  • 2 to move up the list of technologies
  • 1to move down the list of technologies

Getting started

Clone the repository:

git clone https://github.com/ONS-innovation/keh-tech-radar.git

Install both backend and frontend dependencies:

make install

How to setup

First, ensure you have Node.js installed. It is recommended to use Node Version Manager (nvm) to manage Node.js versions:

  1. Install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
  1. Install Node.js using nvm:
nvm install 18.19.0
  1. Set the Node.js version to use:
nvm use 18.19.0
  1. Remember to export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY:
export AWS_ACCESS_KEY_ID=<your_access_key>
export AWS_SECRET_ACCESS_KEY=<your_secret_key>

Running locally

Make dev.sh executable:

chmod +x dev.sh

To run the project locally (frontend and backend together):

make dev

This runs the frontend and backend locally on ports 3000 and 5001.

To run the frontend only:

make frontend

To run the backend only:

make backend

How to deploy locally

make docker-build
make docker-up

This should build the project and then start the project locally on port 3000 and 5001.

To stop the project:

make docker-down

How to containerise and deploy to ECR on AWS

Build the frontend container:

docker build -t <account_id>.dkr.ecr.<region>.amazonaws.com/<repo>:<version_tag> ./frontend

Push the frontend container to ECR:

docker push <account_id>.dkr.ecr.<region>.amazonaws.com/<repo>:<version_tag>

Build the backend container:

docker build -t <account_id>.dkr.ecr.<region>.amazonaws.com/<repo>:<version_tag> ./backend

Push the backend container to ECR:

docker push <account_id>.dkr.ecr.<region>.amazonaws.com/<repo>:<version_tag>

How to deploy infrastructure to AWS

Login to AWS via CLI:

aws ecr get-login-password --region eu-west-2 | docker login --username AWS --password-stdin 999999999999.dkr.ecr.eu-west-2.amazonaws.com

Change directory to the authentication folder:

cd terraform/authentication

Set the environment variables. Check the terraform/service/env/dev/example_tfvars.txt file for the correct values.

Run Terraform:

terraform init -backend-config="env/dev/backend-dev" -reconfigure
terraform plan -var-file=env/dev/dev.tfvars
terraform apply -var-file=env/dev/dev.tfvars

Change directory to the service folder (if in authentication folder):

cd ../service

Set the environment variables. Check the terraform/service/env/dev/example_tfvars.txt file for the correct values.

Run Terraform:

terraform init -backend-config="env/dev/backend-dev" -reconfigure
terraform plan -var-file=env/dev/dev.tfvars
terraform apply -var-file=env/dev/dev.tfvars