chart/README.md

59 lines
1.7 KiB
Markdown

# chart
FastAPI backend + Vue 3 (from CDN, no build step) served at
<https://chart.amow.com>.
Currently a placeholder: the frontend calls `/api/hello` and prints the JSON.
## Local development
```bash
docker compose up --build
```
Then open <http://localhost:8000>. The source tree is bind-mounted and uvicorn
runs with `--reload`, so edits to `main.py` or `static/` take effect without a
rebuild. Rebuild only when `requirements.txt` changes.
Without Docker:
```bash
python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload
```
## Layout
| Path | Purpose |
|---|---|
| `main.py` | FastAPI app — JSON under `/api`, serves the SPA at `/` |
| `static/` | `index.html`, `app.js`, `style.css` — Vue 3 loaded from unpkg |
| `requirements.txt` | Python deps |
| `Procfile` | Start command; **nixpacks needs this** or the deploy has nothing to run |
| `Dockerfile.dev`, `docker-compose.yml` | Local dev only — production does not use them |
## Deployment
Push to `main` → Forgejo webhook → Coolify rebuilds with nixpacks → live in
roughly 25 seconds.
```bash
git push
```
Two things to know before changing the deploy config:
- The Coolify domain is registered as `https://chart.amow.com:8000`. The port
suffix is how Coolify decides the Traefik target port; drop it and every
request 502s while the container looks perfectly healthy. It does not appear
in the public URL.
- Ignore a 502 in the first minute after a deploy — that's the rolling container
swap, and it clears on its own.
Manual redeploy:
```bash
curl -X POST -H "Authorization: Bearer $(cat ~/.coolify-token)" \
"http://127.0.0.1:8000/api/v1/deploy?uuid=$COOLIFY_UUID&force=true"
```