Files
evrak/deploy/local/README.md
gitmuhammedalbayrak b9148cfa4b
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
feat: Add full CRUD functionality, project detail panel, and improved UI
- Add UPDATE and DELETE endpoints to backend
- Implement project detail panel with comprehensive editing
- Add drag-and-drop functionality for projects in mind map
- Show all projects in map (not just selected + children)
- Fix infinite render loop in MindMap component
- Improve UI spacing and button layouts
- Add local development database schema with RLS disabled
- Update docker-compose for regular docker-compose (not Swarm)
- Add CORS support and nginx API proxying
- Improve button spacing and modern design principles
2025-11-27 03:18:48 +03:00

115 lines
3.6 KiB
Markdown

# Local Development with Docker Compose
This directory contains the configuration to run the Evrak application locally using Docker Compose.
## Prerequisites
1. **Docker Desktop**: Ensure Docker Desktop is installed and running on your machine.
2. **Ports**: Make sure ports 80, 3000, and 5432 are available on your host machine.
## Quick Start
### 1. Build and Start Services
From the project root directory, run:
```bash
docker compose -f deploy/local/docker-compose.yml up --build
```
Or in PowerShell:
```powershell
docker compose -f deploy/local/docker-compose.yml up --build
```
This will:
- Build the Docker images for backend and frontend
- Start PostgreSQL database
- Start the backend API server
- Start the frontend web server
### 2. Access the Application
Once all services are running, access the application at:
* **Frontend**: http://localhost
* **Backend API**: http://localhost:3000
* **Database**: localhost:5432 (user: `evrak_user`, password: `evrak_password`, database: `evrak`)
### 3. Stop Services
To stop all services:
```bash
docker compose -f deploy/local/docker-compose.yml down
```
To stop and remove volumes (database data):
```bash
docker compose -f deploy/local/docker-compose.yml down -v
```
## Development Workflow
### Running in Detached Mode
To run services in the background:
```bash
docker compose -f deploy/local/docker-compose.yml up -d --build
```
### View Logs
View logs from all services:
```bash
docker compose -f deploy/local/docker-compose.yml logs -f
```
View logs from a specific service:
```bash
docker compose -f deploy/local/docker-compose.yml logs -f backend
docker compose -f deploy/local/docker-compose.yml logs -f frontend
docker compose -f deploy/local/docker-compose.yml logs -f postgres
```
### Rebuild After Code Changes
If you make changes to the code, rebuild the affected service:
```bash
docker compose -f deploy/local/docker-compose.yml up --build backend
docker compose -f deploy/local/docker-compose.yml up --build frontend
```
## Troubleshooting
* **Ports occupied**: Ensure ports 80, 3000, and 5432 are free on your host machine.
* **Build errors**: Make sure all dependencies are properly installed. Try removing `node_modules` and rebuilding.
* **Database connection issues**: Wait a few seconds after starting services for the database to initialize.
* **CORS errors**: The backend is configured to allow requests from `http://localhost:80`. If you're accessing from a different port, update the `FRONTEND_URL` environment variable in `docker-compose.yml`.
## Service Details
- **PostgreSQL**: Database service with automatic health checks and schema initialization
- The database schema (including ltree extension, indexes, and helper functions) is automatically initialized on first startup
- Row Level Security (RLS) is **disabled** for local development to simplify testing
- A default tenant is created automatically: `00000000-0000-0000-0000-000000000001`
- **Backend**: NestJS API server running on port 3000
- Supports hierarchical project structure using PostgreSQL ltree
- Multi-tenant architecture (RLS disabled for local dev)
- **Frontend**: React application served via Nginx on port 80, with API proxying configured
## Database Schema
The database is automatically initialized with:
- PostgreSQL extensions: `uuid-ossp`, `ltree`, `pg_trgm`
- Tables: `tenants`, `users`, `projects`
- Indexes: GIST for ltree paths, GIN for JSONB attributes
- Helper function: `move_project_subtree()` for moving project hierarchies
**Note**: For production deployments, use `backend/src/database/schema.sql` which enables Row Level Security (RLS) for proper tenant isolation.