# Coolify deploy — Phoenix Ai desk

## What this service is

PHP Apache image (`Dockerfile`). Document root = `public/`. Secrets come from **Coolify Environment Variables** (not baked into the image).

License admin (`extension/`) is **separate** — already on zentraapi.site. Do not put `extension/` in this container.

## Coolify steps

1. New Resource → **Dockerfile**
2. Repo / upload this folder (`Finorix Sofware` / Phoenix Ai desk)
3. Dockerfile path: `Dockerfile` (root)
4. Port: **80**
5. Domain: your Phoenix domain (HTTPS)
6. Healthcheck path: `/health`

## Environment variables (required)

| Variable | Example |
|----------|---------|
| `APP_URL` | `https://phoenix.yourdomain.com` |
| `BROKER_API_URL` | `https://qx-market.com/api/provider` |
| `BROKER_API_KEY` | same as broker `PHOENIX_PROVIDER_KEY` |
| `SESSION_SECRET` | long random string |
| `LICENSE_PRODUCT` | `phoenix_ai` |
| `LICENSE_ACTIVATE_URL` | `https://zentraapi.site/extension/license_activate.php` |
| `LICENSE_VERIFY_URL` | `https://zentraapi.site/extension/license_verify.php` |
| `LICENSE_VERIFY_TTL` | `300` |
| `LICENSE_HTTP_TIMEOUT` | `12` |

Copy values from `.env.example` (production block).

## Broker first

On **qx-market** Coolify env:

```
PHOENIX_PROVIDER_KEY=<same-as-BROKER_API_KEY>
```

Redeploy broker so `/api/provider/health` returns JSON (not 404). Then deploy Phoenix.

## Local Docker test

```bat
cd /d "D:\Finorix Sofware"
docker compose up --build
```

Open http://127.0.0.1:8787/health  
Broker on host port 5001 is reached via `host.docker.internal`.

## After deploy checklist

- [ ] `https://YOUR-DOMAIN/health` → `{"ok":true,...}`
- [ ] Login with a `PHX-…` license key
- [ ] Chart loads (broker key + URL correct)
- [ ] No `BROKER_API_KEY` in browser Network tab (only same-origin `/api/*`)
