Update README.md for dev container

This commit is contained in:
pmoharana-cmd 2024-09-21 16:04:27 -04:00
parent f9abc9169f
commit 70906fa231
2 changed files with 56 additions and 14 deletions

View File

@ -79,7 +79,7 @@ RUN curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.
# Set Locale for Functional Autocompletion in zsh # Set Locale for Functional Autocompletion in zsh
RUN sudo locale-gen en_US.UTF-8 RUN sudo locale-gen en_US.UTF-8
# Install Database Dependencies # Install Backend Dependencies
COPY backend/requirements.txt /workspace/backend/requirements.txt COPY backend/requirements.txt /workspace/backend/requirements.txt
WORKDIR /workspace/backend WORKDIR /workspace/backend
RUN python3 -m pip install -r requirements.txt RUN python3 -m pip install -r requirements.txt

View File

@ -10,6 +10,14 @@
## 📁 File Setup ## 📁 File Setup
``` ```
\backend
\api // Define API routes
\entities // Define entities in database
\models // How objects are represented in Python
\script // Scripts for init and demo
\services // Main business logic
\test // Testing suite
\compass \compass
\components // Components organized in folders related to specific pages \components // Components organized in folders related to specific pages
\pages // Store all pages here \pages // Store all pages here
@ -21,24 +29,24 @@
## 🚀 To Start ## 🚀 To Start
Follow these steps to set up your local environment: Follow these steps to set up your local environment (Dev Container):
``` ```
\\ Clone this repository \\ Clone this repository
git clone https://github.com/cssgunc/compass.git git clone https://github.com/cssgunc/compass.git
\\ Go into main folder
\\ Create .env file for frontend
cd compass cd compass
\\ Install dependencies touch .env
npm install
\\ Run local environment \\ Create .env file for backend
npm run dev cd ../backend
touch .env
``` ```
Also add following variables inside of a .env file inside of the backend directory **Backend .env** Contents:
``` ```
\\ .env file contents
POSTGRES_DATABASE=compass POSTGRES_DATABASE=compass
POSTGRES_USER=postgres POSTGRES_USER=postgres
POSTGRES_PASSWORD=admin POSTGRES_PASSWORD=admin
@ -47,19 +55,53 @@ POSTGRES_PORT=5432
HOST=localhost HOST=localhost
``` ```
## Backend Starter **Frontend (compass) .env** Contents:
- Please open the VS Code Command Palette ```
NEXT_PUBLIC_SUPABASE_URL=[ASK_TECH_LEAD]
NEXT_PUBLIC_SUPABASE_ANON_KEY=[ASK_TECH_LEAD]
NEXT_PUBLIC_API_HOST=http://localhost:8000
NEXT_PUBLIC_HOST=http://localhost:3000
```
## Dev Container Setup
- Please open the VS Code Command Palette (Mac - Cmd+Shift+P and Windows - Ctrl+Shift+P)
- Run the command **Dev Containers: Rebuild and Reopen in Container** - Run the command **Dev Containers: Rebuild and Reopen in Container**
- This should open the dev container with the same file directory mounted so any changes in the dev container will be seen in the local repo - This should open the dev container with the same file directory mounted so any changes in the dev container will be seen in the local repo
- The dev container is sucessfully opened once you can see file directory getting populated
### In Dev Container ### In Dev Container Setup
Run this to reset the database and populate it with the approprate tables that reflect the entities folder Open a new terminal and run these commands in sequence to setup the dependencies and database
``` ```
cd backend
python3 -m backend.script.reset_demo python3 -m backend.script.reset_demo
cd ../compass
npm ci
``` ```
## Starting up website and backend
Open a terminal and run these commands:
```
cd backend
fastapi dev main.py
```
Open another terminal and run these commands:
```
cd compass
npm run dev
```
1. Go to [localhost:3000/auth/login](localhost:3000/auth/login)
2. Login with username: root@compass.com, password: compass123
3. Explore website
### Possible Dev Container Errors ### Possible Dev Container Errors
- Sometimes the ports allocated to our services will be allocated (5432 for Postgres and 5050 for PgAdmin4) - Sometimes the ports allocated to our services will be allocated (5432 for Postgres and 5050 for PgAdmin4)