docker-compose

  1. version: "3.2"
  2. services:
  3. master:
  4. image: tikazyq/crawlab:0.5.1
  5. container_name: master
  6. environment:
  7. CRAWLAB_SERVER_MASTER: "Y" # whether to be master node 是否为主节点,主节点为 Y,工作节点为 N
  8. CRAWLAB_MONGO_HOST: "mongo" # MongoDB host address MongoDB 的地址,在 docker compose 网络中,直接引用服务名称
  9. CRAWLAB_MONGO_PORT: "27017" # MongoDB port MongoDB 的端口
  10. CRAWLAB_MONGO_DB: "crawlab_test" # MongoDB database MongoDB 的数据库
  11. CRAWLAB_MONGO_USERNAME: "" # MongoDB username MongoDB 的用户名
  12. CRAWLAB_MONGO_PASSWORD: "" # MongoDB password MongoDB 的密码
  13. CRAWLAB_MONGO_AUTHSOURCE: "" # MongoDB auth source MongoDB 的验证源
  14. CRAWLAB_REDIS_ADDRESS: "redis" # Redis host address Redis 的地址,在 docker compose 网络中,直接引用服务名称
  15. CRAWLAB_REDIS_PORT: "6379" # Redis port Redis 的端口
  16. CRAWLAB_SERVER_REGISTER_TYPE: "ip" # node register type 节点注册方式. 默认为 mac 地址,也可设置为 ip(防止 mac 地址冲突)
  17. CRAWLAB_SERVER_REGISTER_IP: "192.168.80.1" # node register ip 节点注册IP. 节点唯一识别号,只有当 CRAWLAB_SERVER_REGISTER_TYPE 为 "ip" 时才生效
  18. ports:
  19. - "9997:9997" # frontend port mapping 前端端口映射
  20. depends_on:
  21. - mongo
  22. - redis
  23. volumes:
  24. - /root/baoqiang/shannon/nginx:/etc/nginx/conf.d
  25. - /root/baoqiang/shannon/frontend/dist:/app/dist
  26. - /root/baoqiang/shannon/backend/conf:/app/backend/conf
  27. - /root/baoqiang/shannon/backend/crawlab:/usr/local/bin/crawlab-server
  28. - /root/baoqiang/shannon/spiders/master:/app/spiders
  29. worker:
  30. image: tikazyq/crawlab:0.5.1
  31. container_name: worker
  32. environment:
  33. CRAWLAB_SERVER_MASTER: "N"
  34. CRAWLAB_MONGO_HOST: "mongo"
  35. CRAWLAB_MONGO_PORT: "27017" # MongoDB port MongoDB 的端口
  36. CRAWLAB_MONGO_DB: "crawlab_test" # MongoDB database MongoDB 的数据库
  37. CRAWLAB_MONGO_USERNAME: "" # MongoDB username MongoDB 的用户名
  38. CRAWLAB_MONGO_PASSWORD: "" # MongoDB password MongoDB 的密码
  39. CRAWLAB_MONGO_AUTHSOURCE: "" # MongoDB auth source MongoDB 的验证源
  40. CRAWLAB_REDIS_ADDRESS: "redis" # Redis host address Redis 的地址,在 docker compose 网络中,直接引用服务名称
  41. CRAWLAB_REDIS_PORT: "6379" # Redis port Redis 的端口
  42. CRAWLAB_SERVER_REGISTER_TYPE: "ip"
  43. CRAWLAB_SERVER_REGISTER_IP: "192.168.80.2"
  44. depends_on:
  45. - mongo
  46. - redis
  47. mongo:
  48. image: mongo:latest
  49. restart: always
  50. ports:
  51. - "27017:27017"
  52. redis:
  53. image: redis:latest
  54. restart: always
  55. ports:
  56. - "6379:6379

nginx.conf

  1. server {
  2. listen 9997;
  3. root /app/dist;
  4. index index.html;
  5. location /api/ {
  6. rewrite /api/(.*) /$1 break;
  7. proxy_pass http://localhost:8000/;
  8. }
  9. }

config.yml

  1. api:
  2. address: "localhost:8000"
  3. mongo:
  4. host: localhost
  5. port: 27017
  6. db: crawlab_test
  7. username: ""
  8. password: ""
  9. authSource: ""
  10. redis:
  11. address: localhost
  12. password: ""
  13. database: 1
  14. port: 6379
  15. log:
  16. level: info
  17. path: "/var/logs/crawlab"
  18. isDeletePeriodically: "N"
  19. deleteFrequency: "@hourly"
  20. server:
  21. host: 0.0.0.0
  22. port: 8000
  23. master: "Y"
  24. secret: "crawlab"
  25. register:
  26. # type 填 mac/ip/customName, 如果是ip,则需要手动指定IP, 如果是 customName, 需填写你的 customNodeName
  27. type: "mac"
  28. customNodeName: "" # 自定义节点名称, default node1,只有在type = customName 时生效
  29. ip: ""
  30. lang: # 安装语言环境, Y 为安装,N 为不安装
  31. python: "Y"
  32. node: "N"
  33. java: "N"
  34. dotnet: "N"
  35. php: "N"
  36. # scripts: "/home/wurui/app/backend/scripts"
  37. scripts: "/app/backend/scripts"
  38. spider:
  39. # path: "/home/wurui/app/spiders"
  40. path: "/app/spiders"
  41. task:
  42. workers: 16
  43. other:
  44. tmppath: "/tmp"
  45. version: 0.5.1
  46. setting:
  47. crawlabLogToES: "N" # Send crawlab runtime log to ES, open this option "Y", remember to set esClient
  48. crawlabLogIndex: "crawlab-log"
  49. allowRegister: "N"
  50. enableTutorial: "N"
  51. runOnMaster: "Y"
  52. demoSpiders: "N"
  53. checkScrapy: "Y"
  54. autoInstall: "Y"
  55. esClient: "" # Your ES client, for example, http://192.168.1.1:9200 or http://your-domain.com, if not use es, set empty
  56. spiderLogIndex: "spider-log" # Index pattern for kibana, need to config on kibana
  57. notification:
  58. mail:
  59. server: ""
  60. port: ""
  61. senderEmail: ""
  62. senderIdentity: ""
  63. smtp:
  64. user: ""
  65. password: ""
  66. repo:
  67. apiUrl: "https://center.crawlab.cn/api"
  68. # apiUrl: "http://localhost:8002"
  69. ossUrl: "https://repo.crawlab.cn"
  70. oidc:
  71. tokenUrl: "http://uibe.ketanyun.cn/sso/oauth2/token"
  72. clientId: "xALlmUuvwWAHyHMACL0I"
  73. clientSecret: "A146E95BE3945D1946252C432F929EA8C2CD98168FE6B5D3"