# Flood DMS — Deployment Build

This ZIP is the deployment-ready version of the latest V3 dashboard.

## Included production setup

- Gunicorn production server
- WhiteNoise static-file serving
- `collectstatic` on startup
- Dockerfile
- Procfile
- Render blueprint
- Public `/healthz/` health-check endpoint
- Environment-based host / CSRF configuration
- Local `.env`, virtualenvs, `__pycache__`, and `.pyc` files are excluded

## Required environment variables

At minimum set:

```env
DEBUG=False
SECRET_KEY=<long-random-secret>
ALLOWED_HOSTS=<deployment-domain>
CSRF_TRUSTED_ORIGINS=https://<deployment-domain>
FLOOD_DMS_API_BASE=https://flooddms.noverahr.com/api/dashboard
FLOOD_DMS_API_TIMEOUT=15
```

The hosting platform normally supplies `PORT` automatically.

## Option A — Docker

From the project root:

```bash
docker build -t flood-dms-dashboard .
docker run --rm -p 8000:8000 \
  -e DEBUG=False \
  -e SECRET_KEY='replace-this' \
  -e ALLOWED_HOSTS='localhost' \
  -e FLOOD_DMS_API_BASE='https://flooddms.noverahr.com/api/dashboard' \
  flood-dms-dashboard
```

Open `http://localhost:8000/login/`.

## Option B — Linux / VPS

```bash
python3 -m venv venv
source venv/bin/activate
pip install -r server/requirements.txt
cd server
cp .env.example .env
# Edit .env with production values
bash start.sh
```

## Option C — Render

The included `render.yaml` can be used as a starting blueprint. Set the real domain
in `ALLOWED_HOSTS` and `CSRF_TRUSTED_ORIGINS` after the service URL is assigned.

## Health check

Use:

`/healthz/`

It does not require login and only verifies the dashboard process is running.

## Important session note

This dashboard stores its API-login session in an in-process Django cache.
The included startup command defaults to **1 Gunicorn worker with 4 threads**.
Do not increase workers above 1 unless the deployment team changes Django sessions
to a shared backend such as Redis.

## API note

Logs and Configuration depend on which endpoints the deployed Flood DMS API exposes.
The dashboard itself proxies API calls server-side; browsers never receive the upstream
API credentials directly.
