mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 15:12:08 +01:00
updated report
This commit is contained in:
@@ -52,46 +52,45 @@ flowchart LR
|
|||||||
|
|
||||||
- Backend: Python, FastAPI, FastAPI Users, SQLAlchemy, Pydantic, Alembic, Celery
|
- Backend: Python, FastAPI, FastAPI Users, SQLAlchemy, Pydantic, Alembic, Celery
|
||||||
- Frontend: React, TypeScript, Vite
|
- Frontend: React, TypeScript, Vite
|
||||||
- Database: PostgreSQL
|
- Database: MariaDB (Maxscale)
|
||||||
- Messaging: RabbitMQ
|
- Background jobs: RabbitMQ, Celery
|
||||||
- Cache: Redis
|
|
||||||
- Containerization/Orchestration: Docker, Docker Compose (dev), Kubernetes, Helm
|
- Containerization/Orchestration: Docker, Docker Compose (dev), Kubernetes, Helm
|
||||||
- IaC/Platform: OpenTofu (Terraform), Argo CD, cert-manager, MetalLB, Cloudflare Tunnel, Prometheus
|
- IaC/Platform: Proxmox, Talos, Cloudflare pages, OpenTofu (Terraform), cert-manager, MetalLB, Cloudflare Tunnel, Prometheus, Loki
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
### System Requirements
|
### System Requirements
|
||||||
|
|
||||||
- Operating System: Linux, macOS, or Windows
|
- Operating System (dev): Linux, macOS, or Windows with Docker support
|
||||||
|
- Operating System (prod): Linux with kubernetes
|
||||||
- Minimum RAM: 4 GB (8 GB recommended for running backend, frontend, and database together)
|
- Minimum RAM: 4 GB (8 GB recommended for running backend, frontend, and database together)
|
||||||
- Storage: 2 GB free (Docker images may require additional space)
|
- Storage: 4 GB free (Docker images may require additional space)
|
||||||
|
|
||||||
### Required Software
|
### Required Software
|
||||||
|
|
||||||
- Docker Desktop or Docker Engine 24+
|
- Docker Desktop or Docker Engine
|
||||||
- Docker Compose v2+
|
- Docker Compose
|
||||||
- Node.js 20+ and npm 10+ (for local frontend dev/build)
|
- Node.js and npm
|
||||||
- Python 3.12+ (for local backend dev outside Docker)
|
- Python 3.12+
|
||||||
- PostgreSQL 15+ (optional if running DB outside Docker)
|
- MariaDB 11
|
||||||
- Helm 3.12+ and kubectl 1.29+ (for Kubernetes deployment)
|
- Helm 3.12+ and kubectl 1.29+
|
||||||
- OpenTofu 1.7+ (for infrastructure provisioning)
|
- OpenTofu
|
||||||
|
|
||||||
### Environment Variables (common)
|
### Environment Variables (common)
|
||||||
|
|
||||||
|
# TODO: UPDATE
|
||||||
- Backend: SECRET, FRONTEND_URL, BACKEND_URL, DATABASE_URL, RABBITMQ_URL, REDIS_URL
|
- Backend: SECRET, FRONTEND_URL, BACKEND_URL, DATABASE_URL, RABBITMQ_URL, REDIS_URL
|
||||||
|
|
||||||
- OAuth vars (Backend): MOJEID_CLIENT_ID/SECRET, BANKID_CLIENT_ID/SECRET (optional)
|
- OAuth vars (Backend): MOJEID_CLIENT_ID/SECRET, BANKID_CLIENT_ID/SECRET (optional)
|
||||||
- Frontend: VITE_BACKEND_URL
|
- Frontend: VITE_BACKEND_URL
|
||||||
|
|
||||||
### Dependencies (key libraries)
|
### Dependencies (key libraries)
|
||||||
I am not sure what is meant by "key libraries"
|
Backend: FastAPI, fastapi-users, SQLAlchemy, pydantic v2, Alembic, Celery, uvicorn
|
||||||
|
Frontend: React, TypeScript, Vite
|
||||||
|
|
||||||
Backend: FastAPI, fastapi-users, SQLAlchemy, pydantic v2, Alembic, Celery
|
## Local development
|
||||||
Frontend: React, TypeScript, Vite
|
|
||||||
Services: PostgreSQL, RabbitMQ, Redis
|
|
||||||
|
|
||||||
## Build Instructions
|
You can run the project with Docker Compose and Python virtual environment for testing and dev purposes
|
||||||
|
|
||||||
You can run the project with Docker Compose (recommended for local development) or run services manually.
|
|
||||||
|
|
||||||
### 1) Clone the Repository
|
### 1) Clone the Repository
|
||||||
|
|
||||||
@@ -103,9 +102,8 @@ cd 7project
|
|||||||
### 2) Install dependencies
|
### 2) Install dependencies
|
||||||
Backend
|
Backend
|
||||||
```bash
|
```bash
|
||||||
# In 7project/backend
|
python3 -m venv .venv
|
||||||
python3.12 -m venv .venv
|
source .venv/bin/activate
|
||||||
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
Frontend
|
Frontend
|
||||||
@@ -120,9 +118,10 @@ Backend
|
|||||||
```bash
|
```bash
|
||||||
# From the 7project/ directory
|
# From the 7project/ directory
|
||||||
docker compose up --build
|
docker compose up --build
|
||||||
# This starts: PostgreSQL, RabbitMQ/Redis (if defined)
|
# This starts: MariaDB, RabbitMQ
|
||||||
|
|
||||||
# Set environment variables (or create .env file)
|
# Set environment variables (or create .env file)
|
||||||
|
# TODO: fix
|
||||||
export SECRET=CHANGE_ME_SECRET
|
export SECRET=CHANGE_ME_SECRET
|
||||||
export BACKEND_URL=http://127.0.0.1:8000
|
export BACKEND_URL=http://127.0.0.1:8000
|
||||||
export FRONTEND_URL=http://localhost:5173
|
export FRONTEND_URL=http://localhost:5173
|
||||||
@@ -131,13 +130,12 @@ export RABBITMQ_URL=amqp://guest:guest@127.0.0.1:5672/
|
|||||||
export REDIS_URL=redis://127.0.0.1:6379/0
|
export REDIS_URL=redis://127.0.0.1:6379/0
|
||||||
|
|
||||||
# Apply DB migrations (Alembic)
|
# Apply DB migrations (Alembic)
|
||||||
# From 7project/backend
|
# From 7project
|
||||||
alembic upgrade head
|
bash upgrade_database.sh
|
||||||
|
|
||||||
# Run API
|
# Run API
|
||||||
uvicorn app.app:fastApi --reload --host 0.0.0.0 --port 8000
|
uvicorn app.app:fastApi --reload --host 0.0.0.0 --port 8000
|
||||||
|
|
||||||
# Run Celery worker (optional, for emails/background tasks)
|
|
||||||
celery -A app.celery_app.celery_app worker -l info
|
celery -A app.celery_app.celery_app worker -l info
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -152,18 +150,22 @@ npm run dev
|
|||||||
- Backend default: http://127.0.0.1:8000 (OpenAPI at /docs)
|
- Backend default: http://127.0.0.1:8000 (OpenAPI at /docs)
|
||||||
- Frontend default: http://localhost:5173
|
- Frontend default: http://localhost:5173
|
||||||
|
|
||||||
If needed, adjust compose services/ports in compose.yml.
|
## Build Instructions
|
||||||
|
### Backend
|
||||||
|
```bash
|
||||||
|
# run in project7/backend
|
||||||
|
docker buildx build --platform linux/amd64,linux/arm64 -t your_container_registry/your_name --push .
|
||||||
|
```
|
||||||
|
### Frontend
|
||||||
|
```bash
|
||||||
|
# run in project7/frontend
|
||||||
|
npm ci
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
## Deployment Instructions
|
## Deployment Instructions
|
||||||
|
|
||||||
### Local (Docker Compose)
|
1) Install base services to cluster
|
||||||
|
|
||||||
Described in the previous section (Manual Local Run)
|
|
||||||
|
|
||||||
### Kubernetes (via OpenTofu + Helm)
|
|
||||||
|
|
||||||
1) Provision platform services (RabbitMQ/Redis/ingress/tunnel/etc.) with OpenTofu
|
|
||||||
```bash
|
```bash
|
||||||
cd tofu
|
cd tofu
|
||||||
# copy and edit variables
|
# copy and edit variables
|
||||||
|
|||||||
Reference in New Issue
Block a user