feat(web): pwa offline caching, dockerized SPA, full-stack nginx smoke
This commit is contained in:
@@ -36,3 +36,18 @@ go test -p 1 -count=1 ./...
|
||||
## 改 schema 前必读
|
||||
|
||||
`db.Migrate` 只执行 `schema.sql` 的 `CREATE TABLE IF NOT EXISTS`——对已存在的库**加列/改列不会生效**。任何列变更之前,必须先引入 `schema_migrations` 版本表 + 有序迁移脚本,否则老部署会静默跑在旧结构上。
|
||||
|
||||
## 前端开发(web/)
|
||||
|
||||
- `cd web && npm install`;`npm run dev`(:5173,`/api` 代理到 :8080)。
|
||||
- 后端起法:`docker compose -f deploy/docker-compose.dev.yml up -d --wait` 起 PG(:5433)/Redis(:6380),
|
||||
然后 `cd backend && DATABASE_URL=postgres://lib:lib@localhost:5433/lib?sslmode=disable \
|
||||
REDIS_URL=redis://localhost:6380 JWT_SECRET=dev go run ./cmd/server`。
|
||||
- 门槛:`npm run check`(tsc + vitest + vite build)。
|
||||
|
||||
## 生产部署(含前端)
|
||||
|
||||
- `.env` 配 `JWT_SECRET/ADMIN_USER/ADMIN_PASSWORD` 后 `docker compose up -d --build`;
|
||||
打开 http://localhost:8080(web=SPA+nginx,/api 反代 api:8080)。
|
||||
- PWA:不可变资源(封面/CBZ 页/原文件)SW cache-first,读过的内容离线可翻;登出会清 SW 缓存。
|
||||
- 冒烟:`bash scripts/smoke.sh`(后端直连)、`bash scripts/smoke-web.sh`(经 nginx 全栈,需 :8080 空闲)。
|
||||
|
||||
Reference in New Issue
Block a user