Giter VIP home page Giter VIP logo

solid-solid's Introduction

Prerequisites

Before running the application, make sure you have the following dependencies installed:

  • Node.js
  • NestJS CLI
  • Docker
  • Docker Compose

Getting Started

To set up the development environment, follow these steps:

  1. Clone this repository:
git clone https://github.com/your-username/interview-challenge.git
  1. Navigate to the project directory:
cd app
  1. Start the development environment:
docker-compose up -d --build
  1. Access the API documentation: Open your browser and visit http://localhost:3000/api to view the Swagger documentation for the API.

Codebase

The code follows NestJS conventions and best practices, with each path represented as a directory in the app/src folder. Later on, organizing the code into app/src/modules can improve better maintainability as there may be other directory (e.g common, utils, middleware).

Codebase improvement

  • Version of the application (/ root endpoint) is getting from the commit sha but it can be improved to read from tag.
  • Middleware to count requests per path

CI pipeline

Helm chart

  • Templates include deployment, service, and serviceaccount. Ingress isn't included but will be considered if knowing which ingress controller is used.
  • MONGODB_CONNECTION_STRING variable is read from app-secret. Which can be generated using below script
#!/bin/bash

# Prompt for the mongodb_url value
read -p "Enter the value for mongodb_url: " mongodb_url_value

# Encode the mongodb_url value as base64
mongodb_url_base64=$(echo -n "$mongodb_url_value" | base64)

# Generate the YAML file
cat <<EOF > secret.yaml
apiVersion: v1
kind: Secret
metadata:
  name: app-secret
data:
  mongodb_url: $mongodb_url_base64
EOF

echo "Secret YAML file 'secret.yaml' generated successfully!"
  • To install the Helm chart app
  1. Clone this repository:
helm repo add myrepo https://maiquanghiep.github.io/solid-solid
  1. Navigate to the project directory:
helm repo update
  1. Start the development environment:
helm install myapp myrepo/app --values ./helm/app/values.yaml

Devops improvement

  • Continuous deployment (CD) hasn't been considered so the Helm value image.tag need to be updated manually. Simple CD can be added directly to the pipeline to install helm, access to k8s for the runner and, run helm upgrade --install app . --set image.tag=${{ github.sha }}. Alternatively, ArgoCD (https://argo-cd.readthedocs.io/en/stable/) with https://argocd-image-updater.readthedocs.io/en/stable/ can be used.
  • As Ingress isn't considered,port-forward is required to test the application for now.
    kubectl port-forward [pod-name] 3000:3000
  • Updating the helm/app/values.yaml can cause the helm package pipeline to fail as the tag is already created. Ideally, values.yaml can be hosted in a different repo as live data for deployment.

solid-solid's People

Contributors

maiquanghiep avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.