Volume 13 · Infrastructure & Deployment
วัตถุประสงค์ของ Volume
Volume นี้เจาะลึกว่าระบบ VTRC ทั้ง 5 repositories ทำงานบน infrastructure ใด, เริ่มต้นอย่างไร, รับภาระงานอย่างไร, และ deploy ผ่านกระบวนการใด
เนื้อหาเน้นเฉพาะด้านปฏิบัติการ (operations) — สิ่งที่ทีมต้องรู้เพื่อดูแลระบบใน production และ UAT ทุก claim มี file:line reference อ้างอิงถึงไฟล์จริงในระบบ
ขอบเขตที่ครอบคลุม
- Hosting topology และโครงสร้าง environment ของทั้ง 5 services
- Dockerfile และ base image ที่ใช้ในแต่ละ service
- กระบวนการ start ของแต่ละ service รวมถึง entry point และ process manager
- โครงสร้าง docker-compose ที่กำหนดจำนวน replica และ network
- nginx reverse proxy ที่ทำหน้าที่ SSL termination และ load balancing
- การจัดการ environment variable ทั้งระบบ
- โครงสร้าง database และ Redis ที่ใช้งาน
- CI/CD pipeline ผ่าน Bitbucket Pipelines
- การจัดการ static file และ file upload
- ระบบ logging, monitoring, และการตรวจสอบสถานะ service
- cron scheduler และปัญหาเชิงปฏิบัติการ
ขอบเขตที่ไม่ครอบคลุม
- โครงสร้าง table และความสัมพันธ์ของข้อมูล — อยู่ใน Volume 8 (Data Model & Persistence)
- รายละเอียด authentication flow — อยู่ใน Volume 9 (Security & Authentication)
- รายละเอียด API endpoint — อยู่ใน Volume 10 (API Reference)
- การทำงานของ cron job ในเชิง business logic — อยู่ใน Volume 11 (Business Logic & Workflows)
ข้อเท็จจริงหลักที่ตรวจพบ
| หัวข้อ | สรุป |
|---|---|
| แพลตฟอร์ม hosting | ผสมระหว่าง GCP (container registry) และ on-prem (MariaDB, LDAP/AD) — ไม่ใช่ GKE ไม่ใช่ serverless |
| Orchestration | ใช้ docker-compose ทั้งระบบ ไม่มี Kubernetes |
| Load balancing | nginx upstream กระจายภาระระหว่าง Node replica บน localhost (host network) |
| CI/CD | Bitbucket Pipelines build Docker image แล้ว push ไป GCR — มีเฉพาะ vtrc-api และ vtrc-web |
| Node runtime | กระจาย 3 versions: Node 12, Node 14, Node 16 — ทั้งหมดเลยกำหนด End of Life ไปแล้ว |
| Health check | ไม่มี endpoint ตรวจสอบสถานะใน service ใด |
| Structured logging | ไม่มี — ใช้ console.log ล้วน |
| APM / error tracking | ไม่มี Sentry, Bugsnag, Datadog หรือ New Relic ใน repository ใด |
| Scheduler | node-schedule ทำงาน in-process ไม่มี high availability |
จำนวน replica ในแต่ละ service (จาก docker-compose)
| Service | Replica | ที่มา |
|---|---|---|
| vtrc-api | 4 (APP_NO = 1, 2, 3, 5 — ข้าม 4) | vtrc-api/docker-compose.yml:47-100 |
| cu-central-api | 3 (APP_NO = 1, 2, 3) | cu-central-api/docker-compose.yml:38-91 |
| centralize-api | 1 (เฉพาะ prod compose) | centralize-api/docker-compose.yml:16-28 |
| vtrc-web | 1 (nginx serve static) | vtrc-web/Dockerfile:11-19 |
| vtrc-rc-backoffice | 1 (nginx serve static) | vtrc-rc-backoffice/Dockerfile:13-17 |
วิธีอ่าน Volume
- บท 12.1–12.3 อ่านตามลำดับ — ปูพื้น hosting, container, และการ start service
- บท 12.4–12.5 เจาะจง docker-compose และ nginx ที่ใช้จริงใน production
- บท 12.6–12.7 อ้างอิงเมื่อต้องแก้ปัญหา config หรือ database
- บท 12.8 สำคัญสำหรับการ deploy ใหม่
- บท 12.9–12.11 อ่านเมื่อต้อง debug ปัญหาเชิงปฏิบัติการ