-
Notifications
You must be signed in to change notification settings - Fork 28
/
docker-compose.yaml
129 lines (120 loc) · 4.44 KB
/
docker-compose.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
version: "3.5"
x-logging: &default-logging
options:
max-size: "100m"
max-file: "1"
driver: json-file
services:
feapder_front:
container_name: feapder_front
image: ${FRONT_IMAGE}
restart: always
environment:
- BACKEND_URL=http://feapder_backend:${BACKEND_PORT}
- FRONT_PORT=${FRONT_PORT}
ports:
- ${FRONT_PORT}:${FRONT_PORT} # 前端端口 (自定义端口:80)
depends_on:
- feapder_backend
logging: *default-logging
feapder_backend:
container_name: feapder_backend
image: ${BACKEND_IMAGE}
restart: always
command: /wait-for-it.sh mysql:3306 -t 60 --strict -- uvicorn main:app --host 0.0.0.0 --workers ${BACKEND_WORKER} --port ${BACKEND_PORT} # workers 为后端服务的个数,爬虫多可改大点
ports:
- ${BACKEND_PORT}:${BACKEND_PORT} # 后端端口 (自定义端口:8000)
environment:
- VERIFY_HOST=https://plat.feapder.com
- FEAPDER_BACKEND_URL=http://${BACKEND_HOST}:${BACKEND_PORT}
- AUTHORIZATION_CODE=${AUTHORIZATION_CODE} # 授权码
- DB_URL=mysql+pymysql://root:root123@mysql:3306/feapder_platform?charset=utf8mb4 # 后端数据库配置
- REDIS_DB_URL=redis://:feapderYYDS@redis:6379/0 # redis数据库连接配置 redis://[[username]:[password]]@[host]:[port]/[db]
- ACCESS_TOKEN_EXPIRE_MINUTES=1440 # 管理系统账号cookie过期时间 单位分钟
- SPIDER_IMAGE=${SPIDER_IMAGE} # 爬虫镜像
- SPIDER_AUTO_PULL_IMAGE=1 # 是否自动拉取镜像 否则需要在爬虫节点手动 docker pull 爬虫镜像,为了加快启动速度,可以设置0
- SPIDER_ENV={} # 爬虫环境变量 值为json类型
# 爬虫容器启动参数,支持的参数使用 docker service create --help 查看
- SPIDER_RUN_ARGS=["--network feaplat", "--log-opt max-size=20m", "--log-opt max-file=1"]
# git ssh 私有密钥,不填则使用默认的
- GIT_SSH_PRIVATE_KEY=${GIT_SSH_PRIVATE_KEY}
# 监控配置
- INFLUXDB_HOST=${INFLUXDB_HOST}
- INFLUXDB_DB=${INFLUXDB_DB}
- INFLUXDB_ADMIN_USER=${INFLUXDB_ADMIN_USER}
- INFLUXDB_ADMIN_PASSWORD=${INFLUXDB_ADMIN_PASSWORD}
- INFLUXDB_PORT_TCP=8086
- INFLUXDB_PORT_UDP=8089
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "~/data/feapder/projects:/projects" # 上传的项目挂载, 本地目录:容器路径
depends_on:
- mysql
- redis
- influxdb
logging: *default-logging
feapder:
container_name: feapder_worker
image: ${SPIDER_IMAGE}
mysql:
container_name: feapder_backend_mysql
command: mysqld --character-set-server=utf8mb4
restart: always
image: registry.cn-hangzhou.aliyuncs.com/feapderd/mysql:5.7.29
ports:
- ${MYSQL_PORT}:3306
environment:
- "MYSQL_USER=root"
- "MYSQL_ROOT_PASSWORD=root123"
- "MYSQL_DATABASE=feapder_platform"
- "MYSQL_PASSWORD=root123"
volumes:
- "~/data/feapder/feapder_backend_mysql:/var/lib/mysql" # mysql 挂载, 本地目录:容器路径
logging: *default-logging
redis:
container_name: feapder_backend_redis
command: redis-server --appendonly yes --requirepass feapderYYDS
restart: always
image: registry.cn-hangzhou.aliyuncs.com/feapderd/redis:6.0.10
# ports:
# - ${REDIS_PORT}:6379
volumes:
- "~/data/feapder/feapder_backend_redis:/data" # redis 挂载, 本地目录:容器路径
logging: *default-logging
# # 监控
# grafana:
# user: root
# restart: always
# image: grafana/grafana
# container_name: feapder_grafana
# volumes:
# - ~/data/feapder/grafana:/var/lib/grafana
# environment:
# - GF_SECURITY_ADMIN_USER=admin
# - GF_SECURITY_ADMIN_PASSWORD=admin
# ports:
# - ${GRAFANA_PORT}:3000
# depends_on:
# - influxdb
influxdb:
restart: always
image: registry.cn-hangzhou.aliyuncs.com/feapderd/influxdb:1.8.6
container_name: feapder_influxdb
volumes:
- ~/data/feapder/influxdb:/var/lib/influxdb
- ./conf/influxdb.conf:/etc/influxdb/influxdb.conf
environment:
- INFLUXDB_DB=${INFLUXDB_DB}
- INFLUXDB_ADMIN_USER=${INFLUXDB_ADMIN_USER}
- INFLUXDB_ADMIN_PASSWORD=${INFLUXDB_ADMIN_PASSWORD}
- INFLUXDB_USER=influx
- INFLUXDB_USER_PASSWORD=influx
ports:
- ${INFLUXDB_PORT_TCP}:8086
- ${INFLUXDB_PORT_UDP}:8089/udp
logging: *default-logging
networks:
default:
name: feaplat
driver: overlay
attachable: true