feat(storage): move project data to SQLite via node:sqlite
- server/db.mjs: schema (site + projects), transactional replace, WAL, VACUUM INTO backups (keep 10), JSON export, first-run seed from data/projects.json - publish.mjs: read/write through the database, export mirror JSON for git/static/offline, validate duplicate project_id - ui/data.js: read live data from /api/projects first, fall back to data/projects.json - Dockerfile/compose/.env.example: DB_PATH, drop experimental sqlite warning flag - docs: AGENTS.md + README describe the database layer and traps
This commit is contained in:
1 parent
830dba58ec
commit
5fb095b872
11 files changed
+364
-61
No files matched your search
+2
-1
@@ -13,12 +13,13 @@ services:
|
||||
HOST: 0.0.0.0
|
||||
ADMIN_TOKEN: ${ADMIN_TOKEN:-}
|
||||
PUBLISH_PUSH: ${PUBLISH_PUSH:-0}
|
||||
DB_PATH: ${DB_PATH:-data/hobbypj.sqlite}
|
||||
NODE_ENV: production
|
||||
ports:
|
||||
# ฝั่งโฮสต์ผูกกับ loopback ก่อน ถ้าต้องให้เครื่องอื่นเข้าตั้ง BIND_ADDRESS=0.0.0.0
|
||||
- "${BIND_ADDRESS:-127.0.0.1}:${PORT:-8090}:${PORT:-8090}"
|
||||
|
||||
# คงไฟล์ข้อมูลจริงไว้ที่โฮสต์ (แก้ผ่านหลังบ้านแล้วไม่หายเมื่อ recreate container)
|
||||
# คงไฟล์ข้อมูลจริงไว้ที่โฮสต์ (SQLite + สำเนา JSON + backups) ไม่หายเมื่อ recreate container
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
|
||||
|
||||
Reference in new issue
Block a user