Skip to content

2025-Spring-CloudNative/dc-manager-backend

Repository files navigation

dc-manager-backend

backend for tsmc datacenter management system

Install NodeJS and NPM

For Windows WSL / MacOS / Linux

# install node/npm via nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install --lts
# check if node and npm are installed
node --version
npm --version

Install Dependencies

npm i
  • to run an example postgres database, run
    docker run \
        --name drizzle-postgres \
        -e POSTGRES_USER=postgres \
        -e POSTGRES_PASSWORD=mypassword \
        -e POSTGRES_DB=postgres \
        -d -p 5432:5432 postgres
    ref: drizzle doc
  • under the root folder, remember to create a .env file containing DATABASE_URL
    DATABASE_URL=postgres://postgres:mypassword@localhost:5432/postgres
  • generate sql file and metadata in ./migration folder

    npm run db:generate
  • run migration for initializing example db (only need to do it once)

    npm run db:migrate
  • visualize db using drizzle-studio

    npm run db:studio

Run Local Server

npm run local

Build the Project

npm run build

swagger

npm install swagger-autogen swagger-ui-express  
npm install --save-dev @types/swagger-ui-express
npm run doc:generate
npm run local

Production Environment Setup

Please modify the .env file first

DATABASE_URL=postgres://postgres:mypassword@db:5432/postgres

Start the Service

Start the backend and database services using docker-compose in detached mode

docker compose up -d

Rebuild the service

Stop the service before rebuilding:

docker compose down
docker compose build --no-cache

Verify the Service

Check if the containers are running

docker compose ps

View logs for trouble-shooting

docker compose logs backend

Stopping the Service

To stop the running services

docker compose down

About

backend for tsmc datacenter management system

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages