docs: Docker run instructions, env table, and compose deploy topology
This commit is contained in:
1 parent
af19d04496
commit
22fdd37869
3 files changed
+62
-8
No files matched your search
+9
-8
@@ -259,17 +259,18 @@ irrcal/
|
||||
## 10. Deploy
|
||||
|
||||
```
|
||||
[nginx :443]
|
||||
/ → dist/ (Vue build · hash router จึงไม่ต้อง rewrite)
|
||||
/docs/ → dist/docs/ (ตำรา 10 บท)
|
||||
/api/ → proxy_pass http://127.0.0.1:8000
|
||||
[julia service] systemd unit farm-api.service · FARM_API_HOST=127.0.0.1
|
||||
[postgresql] psql -f service/db/001_init.sql · seed ETo ด้วย tools/seed_eto.py
|
||||
[docker compose] (ตอนนี้)
|
||||
web nginx:alpine listen ${WEB_CONTAINER_PORT} · root /app · /api/ → api
|
||||
api julia:1.13-bookworm FARM_API_HOST=0.0.0.0 · FARM_API_PORT=${API_CONTAINER_PORT}
|
||||
db postgres:17-alpine volume pgdata · service/db/001_init.sql (ครั้งแรก)
|
||||
|
||||
[แบบเดิม ไม่ใช้แล้ว] nginx บน host + systemd unit + postgres ในเครื่อง
|
||||
```
|
||||
|
||||
- prod ตั้ง `FARM_CORS_ORIGIN=https://<โดเมน>` (ไม่ใช่ `*`)
|
||||
- พอร์ตทุกตัวมาจาก `.env` ที่ราก repo (`.env.example` ขึ้น git, `.env` ไม่ขึ้น)
|
||||
- prod: `FARM_CORS_ORIGIN` ใส่ origin จริง และไม่ต้อง publish `DB_HOST_PORT`/`API_HOST_PORT` ออกนอก
|
||||
- ถ้า API ตาย เว็บยังคำนวณได้ด้วย `js-offline` — deploy จึงไม่ใช่ single point of failure
|
||||
- `service/.env` อยู่นอก git เสมอ · `.env.example` มีชื่อคีย์เท่านั้น
|
||||
- `service/.env` (แบบรันบน host) และ `.env` (แบบ compose) อยู่นอก git เสมอ
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in new issue
Block a user