# 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 ```