118 lines
2.9 KiB
YAML
118 lines
2.9 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# PostgreSQL - 共用資料庫
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: tobiichiGPT-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: tobiichiGPT
|
|
POSTGRES_USER: tobiichi3227
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
volumes:
|
|
- /mnt/data/External/tobiichiGPT/db_data:/var/lib/postgresql/data
|
|
networks:
|
|
- tobiichiGPT-network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U tobiichi3227"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# API 轉接層 - 偽裝 OpenAI API
|
|
api:
|
|
image: python:3.11-slim
|
|
container_name: tobiichiGPT-api
|
|
restart: unless-stopped
|
|
ports:
|
|
- "18000:8000"
|
|
environment:
|
|
- DB_HOST=postgres
|
|
- DB_PORT=5432
|
|
- DB_NAME=tobiichiGPT
|
|
- DB_USER=tobiichi3227
|
|
- DB_PASSWORD=${DB_PASSWORD}
|
|
volumes:
|
|
- /mnt/data/External/tobiichiGPT/api_data:/app
|
|
working_dir: /app
|
|
command: >
|
|
sh -c "
|
|
pip install --no-cache-dir -r requirements.txt &&
|
|
python server.py
|
|
"
|
|
networks:
|
|
- tobiichiGPT-network
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
|
|
# Open WebUI - 用戶對話介面
|
|
openwebui:
|
|
image: ghcr.io/open-webui/open-webui:main
|
|
container_name: tobiichiGPT-ui
|
|
restart: unless-stopped
|
|
ports:
|
|
- "10060:8080"
|
|
environment:
|
|
- DATABASE_URL=postgresql://tobiichi3227:${DB_PASSWORD}@postgres:5432/tobiichiGPT
|
|
- WEBUI_AUTH=True
|
|
volumes:
|
|
- /mnt/data/External/tobiichiGPT/ui_data:/app/backend/data
|
|
networks:
|
|
- tobiichiGPT-network
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
|
|
# Redis - Chatwoot 依賴
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: tobiichiGPT-redis
|
|
restart: unless-stopped
|
|
volumes:
|
|
- redis-data:/data
|
|
networks:
|
|
- tobiichiGPT-network
|
|
|
|
# Chatwoot - 管理員對話介面
|
|
chatwoot:
|
|
image: chatwoot/chatwoot:latest
|
|
container_name: tobiichiGPT-chatwoot
|
|
restart: unless-stopped
|
|
ports:
|
|
- "13000:3000"
|
|
environment:
|
|
- NODE_ENV=production
|
|
- REDIS_URL=redis://redis:6379
|
|
- POSTGRES_HOST=postgres
|
|
- POSTGRES_PORT=5432
|
|
- POSTGRES_DATABASE=chatwoot
|
|
- POSTGRES_USERNAME=tobiichi3227
|
|
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
|
- SECRET_KEY_BASE=${CHATWOOT_SECRET_KEY}
|
|
- INSTALLATION_NAME=TobiichiGPT
|
|
- FORCE_SSL=false
|
|
- RAILS_LOG_TO_STDOUT=true
|
|
volumes:
|
|
- chatwoot-data:/app/storage
|
|
networks:
|
|
- tobiichiGPT-network
|
|
depends_on:
|
|
- postgres
|
|
- redis
|
|
command: >
|
|
sh -c "
|
|
bundle exec rails db:chatwoot_prepare &&
|
|
bundle exec rails s -b 0.0.0.0 -p 3000
|
|
"
|
|
|
|
networks:
|
|
tobiichiGPT-network:
|
|
driver: bridge
|
|
name: tobiichiGPT-network # 固定網路名稱,讓 proxy stack 可以連接
|
|
|
|
volumes:
|
|
redis-data:
|
|
chatwoot-data:
|