feat: add Easypanel deployment config
Some checks failed
CI / Detect changes (push) Has been cancelled
CI / API Lint (push) Has been cancelled
CI / Admin UI Tests (push) Has been cancelled
CI / Admin UI Build (push) Has been cancelled
CI / API Tests (push) Has been cancelled
CI / Scanner Lint (push) Has been cancelled
CI / Scanner Tests (push) Has been cancelled
CI / Banner Lint & Typecheck (push) Has been cancelled
CI / Banner Tests (push) Has been cancelled
CI / Banner Build (push) Has been cancelled
CI / Admin UI Typecheck (push) Has been cancelled

- Dockerfile.app: single container with supervisord (API + Worker + Beat + Scanner)
- supervisord.conf: process manager for 4 services in one container
- EASYPANEL.md: step-by-step deploy guide for Easypanel
- EASYPANEL-README.md: repo structure and deploy flow overview
This commit is contained in:
Ami Bot
2026-04-20 18:37:20 +07:00
parent d8e0a34e04
commit 062a384444
4 changed files with 471 additions and 0 deletions

88
EASYPANEL-README.md Normal file
View File

@@ -0,0 +1,88 @@
# ConsentOS — Repository Structure for Easypanel
## Files to Add to Repository
```
consent-os/ ← ต้อง push ขึ้น Git
├── Dockerfile.app ← ✅ สร้างใหม่ (API container)
├── supervisord.conf ← ✅ สร้างใหม่ (process manager)
├── docker-compose.yml ← ✅ สร้างให้แล้ว
├── .env.example ← ✅ สร้างให้แล้ว
├── DEPLOY.md ← ✅ คู่มือ deploy ทั่วไป
└── EASYPANEL.md ← ✅ คู่มือ deploy บน Easypanel
```
## Files ที่มีอยู่แล้วใน Repo (อย่าลบ)
```
consent-os/
├── apps/
│ ├── api/ ← ✅ keep
│ │ ├── Dockerfile ← ใช้แทน Dockerfile.app สำหรับ dev
│ │ ├── src/ ← ✅ keep
│ │ ├── pyproject.toml ← ✅ keep
│ │ └── ...
│ ├── scanner/ ← ✅ keep
│ │ ├── Dockerfile ← ใช้แทน Dockerfile.app สำหรับ dev
│ │ └── ...
│ ├── admin-ui/ ← ✅ keep (deploy แยก)
│ │ └── Dockerfile
│ └── banner/ ← ✅ keep (admin-ui ดึงมาตอน build)
└── ...
```
## Deploy Flow on Easypanel
```
Git push
├──► Project: consentos
│ Service: consentos-db (Postgres) ───┐
│ Service: consentos-redis (Redis) ───┤
│ Service: consentos-app (App) ───┤
│ ───┘
│ (auto network)
└──► Project: consentos-admin
Service: consentos-admin (Admin UI)
```
## Important Notes
### 1. Database Connection
- Easypanel ใช้ **service name** เป็น hostname ภายใน Docker network
- `DATABASE_URL=postgresql+asyncpg://consentos:PASS@consentos-db:5432/consentos`
- `REDIS_URL=redis://:PASS@consentos-redis:6379/0`
### 2. Dockerfile.app Location
- ต้องอยู่ที่ **root ของ repo** ไม่ใช่ใน apps/
- เพราะ Easypanel build จาก repo root
### 3. Admin UI Deploy แยก
- Admin UI deploy เป็น **separate project/service** เพราะ:
- ใช้ Dockerfile คนละตัว
- ต้องการ domain + SSL แยก
- nginx รันใน container ของตัวเอง
### 4. CORS
- หลัง deploy admin UI → copy domain ไปใส่ใน `ALLOWED_ORIGINS` ของ consentos-app
## Quick Setup Commands
```bash
# Clone repo
git clone https://github.com/kunthawat/consentos.git
cd consentos
# Copy deployment files
cp ~/consent-deploy/Dockerfile.app .
cp ~/consent-deploy/supervisord.conf .
cp ~/consent-deploy/docker-compose.yml .
cp ~/consent-deploy/.env.example .env
cp ~/consent-deploy/EASYPANEL.md .
# Push to your Git
git add .
git commit -m "Add Easypanel deployment config"
git push
```