Skip to content

Latest commit

 

History

History
115 lines (86 loc) · 3.28 KB

custom_build.md

File metadata and controls

115 lines (86 loc) · 3.28 KB

Custom Build Instructions

This guide will walk you through setting up the system by building each part using Docker.

Table of Contents

  1. Set Up MongoDB Database
  2. Run Backend (FastAPI)
  3. Run Frontend
  4. Set Up NGINX

Set Up MongoDB Database

You can set up a MongoDB database using Docker. Refer to the official MongoDB documentation.

For GUI management, download MongoDB Compass.

Useful resources:

Step-by-Step MongoDB Setup

  1. Create a Docker network for your app:

    docker network create app-network
  2. Run MongoDB:

    mkdir -p data/test-change-streams
    
    docker run -d \
       --name mongodb \
       -v /data/test-change-streams:/data/db \
       -p 27017:27017 \
       --network app-network \
       mongo:latest \
       mongod --replSet test-change-streams --logpath /data/db/mongodb.log --dbpath /data/db --port 27017
    
    docker exec -it mongodb mongosh --eval "rs.initiate()"
    
    docker exec -it mongodb mongosh --eval "rs.reconfig({_id: 'test-change-streams', members: [{ _id : 0, host : 'mongodb:27017'}]}, {force: true})"
    
    docker exec -it mongodb mongosh --eval "rs.status()"

Run Backend (FastAPI)

  1. Build the FastAPI Docker image:

    docker build -t multilanguage_invoice_ocr-fastapi .
  2. Run the backend container:

    docker run -d --env-file .env \
       -v $(pwd)/config:/app/config \
       -v $(pwd)/src:/app/src \
       -p 8149:8149 \
       --network app-network \
       multilanguage_invoice_ocr-fastapi:latest

Run Frontend

  1. Navigate to the frontend directory:

    cd jwt-auth-frontend/
  2. Build the frontend Docker image:

    docker build -t jwt-auth-frontend .
  3. Run the frontend container:

    docker run -d \
       --name jwt-frontend-container \
       --network app-network \
       -p 3000:3000 \
       -v $(pwd)/src:/app/src \
       jwt-auth-frontend

Set Up NGINX

Follow the steps outlined in this guide to set up NGINX.

  1. Navigate to the nginx directory:

    cd nginx
  2. Run the NGINX container:

    docker run -d \
       --name nginx \
       --network app-network \
       -p 80:80 \
       -v $(pwd)/nginx/nginx.conf.template:/etc/nginx/nginx.conf.template:ro \
       -e CLIENT_MAX_BODY_SIZE=${CLIENT_MAX_BODY_SIZE} \
       -e SERVER_IP=${SERVER_IP} \
       nginx