FinMK / DOCKER_SETUP_GUIDE.md
Kumar
Refactor: Exclude PDF and CSV files from Git to fix HF push error
24e6f5b
# 🐳 Koyeb_FInMK: Beginner's Docker Setup Guide
Welcome! This guide will take you from a fresh clone of the repository to a fully running, containerized version of **Koyeb_FInMK** (Django Backend + React Frontend + MongoDB Atlas).
---
## πŸ“‹ Prerequisites
Before you begin, ensure you have the following installed on your computer:
1. **Docker Desktop**: [Download for Windows/Mac](https://www.docker.com/products/docker-desktop/)
2. **Git**: [Download Git](https://git-scm.com/downloads)
3. **MongoDB Atlas Account**: A free cloud database. (The pre-configured `.env` uses a demo cluster, but you should create your own for privacy).
---
## πŸš€ Step-by-Step Installation
### 1. Clone the Repository
Open your terminal (Command Prompt or PowerShell on Windows) and run:
```bash
git clone https://github.com/Manikumar4/Koyeb_FInMK.git
cd Koyeb_FInMK
```
### 2. Configure Environment Variables
The application needs some "secrets" to run.
- Navigate to the `backend` folder.
- Ensure there is a file named `.env`.
- If it's missing, create it and paste the following (replace placeholder values with your real keys):
```env
ALLOWED_HOSTS=localhost,127.0.0.1,0.0.0.0
DB_NAME=finance
DEBUG=True
ENVIRONMENT=development
GEMINI_API_KEY=your_gemini_key_here
MONGODB_URI=your_mongodb_atlas_uri_here
OPENROUTER_API_KEY=your_openrouter_key_here
SECRET_KEY=generate_a_random_secret_string_here
```
### 3. Build and Run with Docker
This is the "magic" step that sets everything up automatically. Back in the **root** folder (`Koyeb_FInMK`), run:
```bash
docker-compose up --build
```
> [!NOTE]
> The first time you run this, it will take **5-10 minutes** because it needs to download and install heavy libraries like NumPy and Pandas. Subsequent runs will take only seconds!
---
## 🏁 Accessing the Application
Once you see logs appearing in your terminal without errors, your app is live!
- **Frontend UI**: [http://localhost](http://localhost) (Open this in your browser)
- **Backend API**: [http://localhost/api/](http://localhost/api/)
- **Django Admin**: [http://localhost/admin/](http://localhost/admin/)
---
## πŸ› οΈ Troubleshooting & Common Issues
### ❌ "Port 80 is already in use"
This happens if you have another web server (like IIS or Apache) running.
- **Fix**: Open `docker-compose.yml` and change `"80:80"` under `frontend` to `"8080:80"`. Then use `http://localhost:8080`.
### ❌ Python version errors during build
Make sure you are using the latest `Dockerfile` provided in this setup. We use **Python 3.11-slim** for the backend to ensure compatibility with all data science libraries.
### ❌ "Module not found" in Frontend
If the frontend fails to build, it might be due to an old Node.js version in simple Dockerfiles. This project uses **Node 20-alpine** specifically to support Vite 7.
---
## πŸ›‘ How to Stop
To shut down the application, press `Ctrl + C` in your terminal, or run:
```bash
docker-compose down
```
---
**Happy Coding! πŸš€**