# Deployment Guide for Coolify This repository is optimized for deployment on **Coolify** using Docker or Docker Compose. --- ## Quick Deployment Options in Coolify ### Option A: Deployment via Git Repository (Recommended) 1. **Push Code to Git**: Push this repository to GitHub, GitLab, or your self-hosted Git service. 2. **Add New Resource in Coolify**: - Go to your Coolify dashboard. - Click **+ Add Resource** -> **Public Repository** or **Private Repository**. - Paste your repository URL and select the `main` branch. 3. **Select Build Pack**: - Select **Dockerfile**. Coolify will automatically detect the `Dockerfile` in the root directory. 4. **Configure Port & Network**: - **Port**: Set `3000`. 5. **Configure Persistent Volume**: - Under **Storage / Volumes**, add a persistent volume mapping to prevent data loss on container redeployments: - **Destination Path**: `/app/data` 6. **Deploy**: - Click **Deploy**. Coolify will build the multi-stage Docker image and start your application. --- ### Option B: Deployment via Docker Compose 1. **Add New Resource in Coolify**: - Click **+ Add Resource** -> **Docker Compose**. 2. **Source Code**: - Select your Git Repository or paste the contents of `docker-compose.yml`. 3. **Environment Variables**: - Add the following environment variables in Coolify UI: ```env NODE_ENV=production PORT=3000 DATA_PATH=/app/data/portal-data.json ``` 4. **Deploy**: - Click **Deploy**. Coolify will spin up the container and attach the `portal_data` volume automatically. --- ## Local Testing with Docker To build and test locally before deploying to Coolify: ### Using Docker Compose: ```bash docker-compose up --build -d ``` Access the app at: `http://localhost:3000` ### Using Docker directly: ```bash docker build -t balance-sheet-portal . docker run -p 3000:3000 -v portal_data:/app/data balance-sheet-portal ``` --- ## Health Check Endpoint The container includes a built-in health check targeting: `GET /api/health` It returns `{"status": "ok"}` when the Express server and Vite static engine are healthy.