CS3219-AY2324S1 / ay2324s1-course-assessment-g05

A collaborative technical interview preparation platform that is going to boost your interview performance!
MIT License
0 stars 3 forks source link

Bug fixes in collaboration service and containerize applications for local deployment #149

Closed weidak closed 1 year ago

weidak commented 1 year ago

Pull Request

Description

Fix collaboration service loading bug when pressing back and forwards on the navigation bar of your browser causing inconsistencies in viewing state:

image

As our deployments become more complex and laggier in development environments, using npm run dev for our markers is not ideal as it is perceived as a laggy application. As such, we should move our builds into a fully deployed environment:

Read the setup process here: README

cs3219_overall_architecture-local deployment drawio (2)

Example .env containing ALL environment variables required to run our applications: (to submit as AssignmentX-environmentVariables.txt)

# Backend environment variables
LOG_LEVEL=debug
DATABASE_URL=
NODE_ENV=development
MATCHING_TIMEOUT=15000
EVENT_BUS_CONTAINER_NAME=event-bus
REDIS_URL=collaboration-cache
JWT_SECRET=
EMAIL_VERIFICATION_SECRET=
EMAIL_RESET_SECRET=
NM_MAIL=
NM_PASS=
SERVICE_SECRET=

USER_GATEWAY=http://user-service:5005
AUTH_GATEWAY=http://auth-service:5050

CONTAINERIZED=true

AMZ_REGION=ap-southeast-1
AMZ_ACCESS_KEY_ID=
AMZ_SECRET_ACCESS_KEY=
AMZ_BUCKET_NAME=

BUILD_ENV=development
ENDPOINT=http://localhost
ENDPOINT_USER_PORT=5005
ENDPOINT_QUESTION_PORT=5100
ENDPOINT_AUTH_PORT=5050
ENDPOINT_COLLABORATION_PORT=5300
ENDPOINT_MATCHING_PORT=5200
ENDPOINT_HISTORY_PORT=5400

NEXT_PUBLIC_RAPID_API_HOST=
NEXT_PUBLIC_RAPID_API_KEY=
NEXT_PUBLIC_RAPID_API_URL=

NEXT_PUBLIC_OPENAI_API_KEY=

Related Issue(s)

Checklist

Additional Notes/References

- I was unable to deploy NextJS in a docker image, and the resultant image size is > 2GB anyways so I think its easier + quicker for markers to npm run build and node ./.next/standalone/server.js instead.

Keeps running into internal server error in docker image, but runs fine with: ~~1. npm run build && npm run start ~~ 2. npm run build && node ./.next/standalone/server.js:

image

Update: @c0j0s made a patch to auth middleware, and now frontend is dockerized and running well for local deployment

weidak commented 1 year ago

I will merge this after #131 and #150 bah, such that I can add the env variables and edit the Dockerfiles for deployment in both local and AWS