version: "3.8" services: # MongoDB: 資料庫 (負責儲存使用者帳號、頻道結構、訊息歷史等核心資料) database: image: docker.io/mongo:latest container_name: revolt-database restart: always volumes: - ./data/db:/data/db healthcheck: test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet interval: 10s timeout: 10s retries: 5 start_period: 10s networks: - stoat_network # Redis: 高速快取與狀態暫存 (負責存放連線會話、上線狀態等即時性資料) redis: image: docker.io/eqalpha/keydb container_name: revolt-redis restart: always networks: - stoat_network # RabbitMQ: 內部事件通訊與任務佇列 (新版效能核心,負責跨微服務的訊息排隊與分發) rabbit: image: docker.io/rabbitmq:4 container_name: revolt-rabbit restart: always environment: RABBITMQ_DEFAULT_USER: rabbituser RABBITMQ_DEFAULT_PASS: rabbitpass volumes: - ./data/rabbit:/var/lib/rabbitmq healthcheck: test: rabbitmq-diagnostics -q ping interval: 10s timeout: 10s retries: 3 start_period: 20s networks: - stoat_network # MinIO: 私有物件儲存伺服器 (取代 AWS S3,用來存放圖片、附件、頭像等實體檔案) minio: image: docker.io/minio/minio container_name: revolt-minio command: server /data volumes: - ./data/minio:/data environment: MINIO_ROOT_USER: minioautumn MINIO_ROOT_PASSWORD: minioautumn MINIO_DOMAIN: minio networks: stoat_network: aliases: - revolt-uploads.minio - attachments.minio - avatars.minio - backgrounds.minio - icons.minio - banners.minio - emojis.minio restart: always # -- 以下為 Stoat (Revolt) 官方新版微服務群 -- # API: 核心後端 API 伺服器 (處理註冊登入、建立頻道、發送訊息等一般 HTTP 請求) api: image: ghcr.io/stoatchat/api:v0.12.0 container_name: revolt-api env_file: .env # 測試用:(API 預設為 8000) 若 NPM 無法內網連通,可取消註解對外曝露 # ports: # - "10081:8000" networks: - stoat_network - npm_network depends_on: database: condition: service_healthy redis: condition: service_started rabbit: condition: service_healthy volumes: - type: bind source: ./Revolt.toml target: /Revolt.toml restart: always # Events: WebSocket 即時通訊伺服器 (負責保持客戶端長連線,推送無延遲的即時新訊息) events: image: ghcr.io/stoatchat/events:v0.12.0 container_name: revolt-events env_file: .env # 測試用:(WebSocket Events 預設為 9000) # ports: # - "10082:9000" networks: - stoat_network - npm_network depends_on: database: condition: service_healthy redis: condition: service_started volumes: - type: bind source: ./Revolt.toml target: /Revolt.toml restart: always # Autumn: 檔案處理伺服器 (作為前端與 MinIO 之間的橋樑,負責處理圖片上傳與下載) autumn: image: ghcr.io/stoatchat/file-server:v0.12.0 container_name: revolt-autumn env_file: .env # 測試用:(Autumn 儲存服務預設為 3000) # ports: # - "10083:3000" networks: - stoat_network - npm_network depends_on: database: condition: service_healthy # 注意:因安全與架構考量,createbuckets 已被抽離至 stoat-init.yml # 請在佈署 Stoat主從集之前,先到 `stoat-init` stack 執行一次初始化,否則上傳檔案會失敗 minio: condition: service_started volumes: - type: bind source: ./Revolt.toml target: /Revolt.toml restart: always # January: 嵌入中繼資料代理爬蟲 (抓取 YouTube/Twitter 等連結的縮圖和標題顯示在聊天室) january: image: ghcr.io/stoatchat/proxy:v0.12.0 container_name: revolt-january env_file: .env networks: - stoat_network volumes: - type: bind source: ./Revolt.toml target: /Revolt.toml restart: always # Gifbox: Tenor GIF 代理伺服器 (讓使用者能在聊天室中搜尋並發送 GIF 動圖) gifbox: image: ghcr.io/stoatchat/gifbox:v0.12.0 container_name: revolt-gifbox env_file: .env networks: - stoat_network volumes: - type: bind source: ./Revolt.toml target: /Revolt.toml restart: always # Crond: 定期排程背景任務 (自動清理過期資料或進行系統維護作業) crond: image: ghcr.io/stoatchat/crond:v0.12.0 container_name: revolt-crond env_file: .env networks: - stoat_network depends_on: database: condition: service_healthy minio: condition: service_started volumes: - type: bind source: ./Revolt.toml target: /Revolt.toml restart: always # Pushd: 系統推播通知伺服器 (負責向手機 App 或瀏覽器發送離線 Push Notification) pushd: image: ghcr.io/stoatchat/pushd:v0.12.0 container_name: revolt-pushd env_file: .env networks: - stoat_network depends_on: database: condition: service_healthy redis: condition: service_started rabbit: condition: service_healthy volumes: - type: bind source: ./Revolt.toml target: /Revolt.toml restart: always # Voice Ingress: 語音通訊邏輯入口 (與前端溝通並協調 LiveKit 開啟語音頻道的控制服務) voice-ingress: image: ghcr.io/stoatchat/voice-ingress:v0.12.0 container_name: revolt-voice-ingress env_file: .env restart: always networks: - stoat_network depends_on: database: condition: service_healthy rabbit: condition: service_healthy volumes: - type: bind source: ./Revolt.toml target: /Revolt.toml # LiveKit: 開源 WebRTC 串流伺服器 (負責真正處理多人語音通話與螢幕畫面分享的封包傳遞) livekit: image: ghcr.io/stoatchat/livekit-server:v1.9.13 container_name: revolt-livekit depends_on: redis: condition: service_started networks: - stoat_network command: --config /etc/livekit.yml ports: # 語音 UDP 穿透必備 - "7881:7881" - "50000-50100:50000-50100/udp" restart: always volumes: - type: bind source: ./livekit.yml target: /etc/livekit.yml # Web: Stoat 前端網頁用戶端 (使用者在瀏覽器看到並操作的 Discord-like 介面) web: image: ghcr.io/stoatchat/for-web:3a83b8c container_name: revolt-web restart: always env_file: .env # 測試用:(Web 前端介面預設為 5000) # ports: # - "10080:5000" networks: - stoat_network - npm_network networks: stoat_network: driver: bridge npm_network: external: true name: npm_network # 修改為你 NPM 實際使用的 Docker 網路名稱