version: '3.3'
services:
  master: 
    image: crawlabteam/crawlab
    container_name: crawlab-master
    restart: always
    ports:
      - "8080:8080" # frontend port mapping 前端端口映射
    depends_on:
      - crawlab-mongo
    volumes:
      - "./master:/data"
    environment:
      CRAWLAB_NODE_MASTER: "Y"  # Y: 主节点
      CRAWLAB_MONGO_HOST: "crawlab-mongo"  # mongo host address. 在 Docker-Compose 网络中，直接引用 service 名称
      CRAWLAB_MONGO_PORT: "27017"  # mongo port 
      CRAWLAB_MONGO_DB: "crawlab"  # mongo database 
      CRAWLAB_MONGO_USERNAME: "username"  # mongo username
      CRAWLAB_MONGO_PASSWORD: "password"  # mongo password 
      CRAWLAB_MONGO_AUTHSOURCE: "admin"  # mongo auth source 
  crawlab-mongo:
    image: mongo:4.2
    container_name: crawlab-mongo
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: "username"  # mongo username
      MONGO_INITDB_ROOT_PASSWORD: "password"  # mongo password
    volumes:
      - "./mongo/data/db:/data/db"  # 持久化 mongo 数据
    # ports:
    #   - "27017:27017"  # 开放 mongo 端口到宿主机
