Fix WESP UI after git clone: serve from public/wesp and materialize static.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -24,7 +24,7 @@ jobs:
|
||||
- name: Install backend deps
|
||||
run: pip install -r apps/api/requirements-dev.txt
|
||||
- name: Sync WESP UI parity
|
||||
run: bash scripts/sync-wesp-ui.sh
|
||||
run: bash scripts/materialize-wesp-static.sh
|
||||
- name: Lint
|
||||
run: pnpm lint
|
||||
- name: Types
|
||||
|
||||
@@ -7,11 +7,16 @@
|
||||
## Быстрый старт
|
||||
|
||||
```bash
|
||||
python apps/api/scripts/bootstrap_install.py # один раз, до первого up
|
||||
git clone https://git.groupkomton.ru/Matvey/site.git && cd site
|
||||
python apps/api/scripts/bootstrap_install.py # один раз, до первого up (секреты БД)
|
||||
bash scripts/materialize-wesp-static.sh # WESP UI → public/static (авто при pnpm dev)
|
||||
docker compose --profile docker-web up -d --build
|
||||
curl http://localhost:8000/api/v1/health # Windows: curl.exe
|
||||
```
|
||||
|
||||
> **После `git clone` обязательно:** `bootstrap_install.py` **до** `docker compose up` — иначе Postgres не примет пароль из `install.env`.
|
||||
> WESP UI лежит в git (`apps/web/public/wesp/`); `public/static/` генерируется скриптом (не в git).
|
||||
|
||||
| URL | Что там |
|
||||
|-----|---------|
|
||||
| http://localhost:5173 | Лендинг `/` + SPA (`/login`, `/admin`, …) |
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"materialize:wesp": "bash ../../scripts/materialize-wesp-static.sh",
|
||||
"predev": "pnpm run materialize:wesp",
|
||||
"prebuild": "pnpm run materialize:wesp",
|
||||
"prepreview": "pnpm run materialize:wesp",
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
|
||||
@@ -9,7 +9,8 @@ const apiProxyTarget = process.env.VITE_API_URL ?? "http://127.0.0.1:8000";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
wespStaticPlugin(resolve(__dirname, "public/static")),
|
||||
// public/wesp is in git; public/static is generated (see scripts/materialize-wesp-static.sh).
|
||||
wespStaticPlugin(resolve(__dirname, "public/wesp")),
|
||||
react(),
|
||||
mainStaticPlugin(resolve(__dirname, "main"))
|
||||
],
|
||||
|
||||
@@ -24,6 +24,7 @@ services:
|
||||
- postgres
|
||||
- redis
|
||||
- minio
|
||||
command: ["sh", "-c", "bash scripts/materialize-wesp-static.sh && pnpm --filter web exec vite --host 0.0.0.0"]
|
||||
|
||||
api:
|
||||
build: ./apps/api
|
||||
|
||||
+3
-1
@@ -173,7 +173,9 @@ Staging/prod: `EMAIL_DELIVERY_MODE=smtp`. Dev: `memory` (письма в RAM, SM
|
||||
| Проблема | Решение |
|
||||
|----------|---------|
|
||||
| `install.env missing` | `python apps/api/scripts/bootstrap_install.py` |
|
||||
| `password authentication failed` | [восстановление секретов](#восстановление-секретов) |
|
||||
| `password authentication failed` | [восстановление секретов](#восстановление-секретов) — bootstrap **до** первого `docker compose up` |
|
||||
| `/login`, `/recipes` пустые / 404 после clone | `bash scripts/materialize-wesp-static.sh` (или `pnpm --filter web dev` — predev сам) |
|
||||
| `WESP static not found` в CI/скрипте | обновите repo: `public/wesp/` в git; скрипт materialize не требует соседний `wesp/` |
|
||||
| Login failed | `curl …/health`, проверить `.env`, restart web |
|
||||
| 401 refresh в консоли (гость) | норма на публичных страницах |
|
||||
| Logout после F5 на `/admin` | rebuild web, перелогиниться |
|
||||
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build apps/web/public/static from git-tracked public/wesp.
|
||||
# Optionally refresh public/wesp from an external WESP hub checkout first.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
WESP_EXTERNAL="${WESP_STATIC:-$ROOT/../wesp/static}"
|
||||
SRC="$ROOT/apps/web/public/wesp"
|
||||
DEST="$ROOT/apps/web/public/static"
|
||||
|
||||
if [ ! -d "$SRC" ]; then
|
||||
echo "WESP UI source not found: $SRC" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "$WESP_EXTERNAL" ]; then
|
||||
rsync -a --delete \
|
||||
--exclude '.DS_Store' \
|
||||
"$WESP_EXTERNAL/" "$SRC/"
|
||||
echo "Refreshed $SRC from $WESP_EXTERNAL"
|
||||
fi
|
||||
|
||||
mkdir -p "$DEST"
|
||||
rsync -a --delete \
|
||||
--exclude '.DS_Store' \
|
||||
"$SRC/" "$DEST/"
|
||||
|
||||
echo "Materialized WESP static: $SRC -> $DEST"
|
||||
+4
-32
@@ -1,36 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# Mirror WESP zootech + admin static UI into site web public/static (1:1 paths).
|
||||
# Sync WESP UI: optional external hub refresh, then materialize public/static.
|
||||
# External source: WESP_STATIC or ../wesp/static (when present).
|
||||
# Fallback: git-tracked apps/web/public/wesp (works after clone without WESP repo).
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
WESP_STATIC="${WESP_STATIC:-$ROOT/../wesp/static}"
|
||||
DEST="$ROOT/apps/web/public/static"
|
||||
ORCH_BOOT="$ROOT/apps/web/public/wesp/js/wesp-orchestrator-boot.js"
|
||||
AUTH_BRIDGE_SRC="$ROOT/apps/web/public/wesp/js/wesp-orchestrator-auth-bridge.js"
|
||||
|
||||
if [ ! -d "$WESP_STATIC" ]; then
|
||||
echo "WESP static not found: $WESP_STATIC" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$DEST"
|
||||
|
||||
# Full mirror: same /static/* and page HTML paths as on the WESP hub.
|
||||
rsync -a --delete \
|
||||
--exclude '.DS_Store' \
|
||||
"$WESP_STATIC/" "$DEST/"
|
||||
|
||||
# Orchestrator-only adapters (never overwritten by hub copy).
|
||||
mkdir -p "$DEST/js"
|
||||
if [ -f "$ORCH_BOOT" ]; then
|
||||
cp "$ORCH_BOOT" "$DEST/js/wesp-orchestrator-boot.js"
|
||||
fi
|
||||
if [ -f "$AUTH_BRIDGE_SRC" ]; then
|
||||
cp "$AUTH_BRIDGE_SRC" "$DEST/js/wesp-orchestrator-auth-bridge.js"
|
||||
fi
|
||||
LOGIN_ADAPTER_SRC="$ROOT/apps/web/public/wesp/js/wesp-orchestrator-login.js"
|
||||
if [ -f "$LOGIN_ADAPTER_SRC" ]; then
|
||||
cp "$LOGIN_ADAPTER_SRC" "$DEST/js/wesp-orchestrator-login.js"
|
||||
fi
|
||||
|
||||
echo "Synced WESP static from $WESP_STATIC -> $DEST"
|
||||
exec bash "$ROOT/scripts/materialize-wesp-static.sh"
|
||||
|
||||
Reference in New Issue
Block a user