Files
CFDivePlatform/docker-compose.yml
a620906209 03f8caf3e9 feat:實作通知系統 — 站內通知、Email 通知、Polling 機制
後端
- 新增 6 個 Notification class(預約建立/確認/拒絕/取消/完成、收到評價),database + mail 雙 channel
- 新增 NotificationController(list / unread-count / markRead / markAllRead / destroy)
- 整合通知觸發至 MemberBookingController、ProviderBookingController、CompleteFinishedBookings、ReviewController
- 新增 notifications / jobs / failed_jobs migration
- Docker Compose 加入 queue-worker、mailpit service
- DivingOffer 補上 provider() 關聯

前端
- 新增 notificationStore(Polling 30s/60s 自適應 + Page Visibility API)
- 新增 NotificationBell(未讀 Badge)、NotificationDrawer(側邊通知中心)
- main.js:auth store init 前置於 router.use(),修正 beforeEach guard 時序問題
- notificationAxios:依路徑動態選擇 member/coach token
- NotificationDrawer:改用 new URL().pathname 提取 action_url 路徑

OpenSpec
- 歸檔 notification-system change
- 同步 notification-core / notification-email / notification-triggers specs 至主規格
- 更新 booking-lifecycle / review-lifecycle spec(補充通知觸發 requirement)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-05-17 22:26:14 +08:00

177 lines
4.3 KiB
YAML

# Docker Compose 版本
version: '3.8'
# 定義所有服務
services:
# PHP-FPM 服務
app:
# 構建配置
build:
context: . # 使用當前目錄作為構建上下文
dockerfile: Dockerfile # 指定 Dockerfile 路徑
image: cfdive-platform # 構建的鏡像名稱
container_name: cfdive-app # 容器名稱
restart: unless-stopped # 自動重啟策略:除非手動停止,否則自動重啟
working_dir: /var/www/ # 工作目錄
# 卷掛載:將本地代碼掛載到容器中
volumes:
- ./:/var/www # 本地代碼目錄掛載到容器中的 /var/www
# 環境變數:設置 Laravel 數據庫連接
environment:
- DB_CONNECTION=mysql # 數據庫類型
- DB_HOST=db # 數據庫主機名
- DB_PORT=3306 # 數據庫端口
- DB_DATABASE=CFDivePlatform # 數據庫名稱
- DB_USERNAME=cfdiveuser # 數據庫用戶名
- DB_PASSWORD=cfdivepass # 數據庫密碼
# 網絡配置
networks:
- cfdive-network # 連接到自定義網絡
# 依賴關係:確保 db 和 redis 服務先啟動
depends_on:
db: # 依賴 db 服務
condition: service_healthy # 等待數據庫健康檢查通過
redis: # 依賴 redis 服務
condition: service_started # 等待服務啟動
# 健康檢查配置
healthcheck:
test: ["CMD", "php", "-v"] # 檢查 PHP 版本確認服務正常
interval: 30s # 每30秒檢查一次
timeout: 10s # 超時時間10秒
retries: 3 # 重試3次
start_period: 40s # 容器啟動後40秒開始檢查
nginx:
image: nginx:alpine
container_name: cfdive-nginx
restart: unless-stopped
ports:
- 8080:80
volumes:
- ./:/var/www
- ./docker/nginx/conf.d/:/etc/nginx/conf.d/
networks:
- cfdive-network
depends_on:
app:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/"]
interval: 30s
timeout: 10s
retries: 3
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
VITE_API_URL: http://localhost:8080
image: cfdive-frontend
container_name: cfdive-frontend
restart: unless-stopped
ports:
- "5173:80"
networks:
- cfdive-network
db:
image: mysql:8.0
container_name: cfdive-db
restart: unless-stopped
environment:
MYSQL_DATABASE: CFDivePlatform
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: cfdiveuser
MYSQL_PASSWORD: cfdivepass
SERVICE_TAGS: dev
SERVICE_NAME: mysql
volumes:
- mysql-data:/var/lib/mysql
ports:
- "3306:3306"
networks:
- cfdive-network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "cfdiveuser", "-pcfdivepass"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: cfdive-phpmyadmin
restart: unless-stopped
ports:
- "8081:80"
environment:
PMA_HOST: db
PMA_PORT: 3306
PMA_USER: cfdiveuser
PMA_PASSWORD: cfdivepass
MYSQL_ROOT_PASSWORD: root
networks:
- cfdive-network
depends_on:
db:
condition: service_healthy
queue-worker:
image: cfdive-platform
container_name: cfdive-queue
restart: unless-stopped
working_dir: /var/www/
command: php artisan queue:work --sleep=3 --tries=3 --timeout=60
volumes:
- ./:/var/www
environment:
- DB_CONNECTION=mysql
- DB_HOST=db
- DB_PORT=3306
- DB_DATABASE=CFDivePlatform
- DB_USERNAME=cfdiveuser
- DB_PASSWORD=cfdivepass
networks:
- cfdive-network
depends_on:
app:
condition: service_healthy
mailpit:
image: axllent/mailpit
container_name: cfdive-mailpit
restart: unless-stopped
ports:
- "8025:8025"
- "1025:1025"
networks:
- cfdive-network
redis:
image: redis:alpine
container_name: cfdive-redis
restart: unless-stopped
ports:
- "6379:6379"
networks:
- cfdive-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
networks:
cfdive-network:
driver: bridge
volumes:
mysql-data:
driver: local