Cloud DevOpsSec Inventory

Overview

This repository contains the source code, deployment and infrastructure configuration for a React and Nest.js application. In this project, the infrastructure is provisioned on AWS using terraform and the delivery and integration of the application is automated using GitHub actions. Also, static code analysis is performed using SonarQube.

Prerequisites

Tools used in the development of this application:

Local Development

To run the application locally, follow these steps:

  1. Clone the repository
  2. On Auth0, create an Application and an API. Add the the keys to the environment variable of the client and backend application.
# apps/api/.env
CLIENT_ORIGIN_URL=http://localhost:3000
AUTH0_ISSUER_BASE_URL=<Auth0-api-issuer-base-url>
AUTH0_AUDIENCE=http://localhost:8000
# apps/client/.env
VITE_API_URL=http://localhost:8000/api/v1
VITE_AUTH0_DOMAIN=<Auth0-application-domain-name>
VITE_AUTH0_CLIENT_ID=<Auth0-application-client-id>
VITE_AUTH0_CALLBACK_URL=http://localhost:3000/callback
VITE_API_AUTH0_AUDIENCE=http://localhost:8000

Alternatively, you can setup the doppler cli and configure a development and production environment

  1. To start services:
docker compose up

Provisioning Infrastructure Using Terraform

  • Setup AWS Credentials
  • Create an S3 bucket to store the terraform state and add the name of the bucket to the "infra/main" file (backend "s3").
  • Initialize Terraform
terraform init
  • Create a workspace (development or production)
 ENV=development make tf-create-workspace
  • Using the environment, run:
TF_COMMAND=plan ENV=development make tf
  • To apply changes, run:
TF_COMMAND=apply ENV=development make tf
  • To destroy changes, run:
TF_COMMAND=destroy ENV=development make tf

Setup Auth0

API
  • Create new Auth API "Applications > APIs > Create New API"
  • Add to environment variables:
  AUTH0_ISSUER_BASE_URL=
  AUTH0_AUDIENCE=
CLIENT
  VITE_AUTH0_DOMAIN=
  VITE_AUTH0_CLIENT_ID=