-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
98 lines (88 loc) · 2.06 KB
/
docker-compose.yml
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
x-common-env: &cenv
DB_DRIVER: mysql
DSN: user:pass@tcp(db:3306)/gion?parseTime=true
REDIS_ADDR: redis:6379
# DB_DRIVER: postgres
# DSN: user=gion password=pass dbname=gion host=127.0.0.1 sslmode=disable
x-common-depends-on: &depends
db:
condition: service_healthy
redis:
condition: service_healthy
services:
ofelia:
image: mcuadros/ofelia:v0.3.6
depends_on:
- app
command: daemon --docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
app:
build:
context: ./
depends_on:
<<: *depends
environment:
<<: *cenv
command: /app/gion
ports:
- 8080:8080
labels:
ofelia.enabled: "true"
ofelia.job-exec.cleanup.schedule: "@every 1h"
ofelia.job-exec.cleanup.command: "/app/queueing --mode cleanup"
ofelia.job-exec.queueing.schedule: "@every 5m"
ofelia.job-exec.queueing.command: "/app/queueing --mode crawler"
init-app:
build:
context: ./
depends_on:
<<: *depends
environment:
<<: *cenv
command: /app/insertuser -u demo -p demodemo
worker:
build:
context: ./
depends_on:
<<: *depends
environment:
<<: *cenv
command: /app/worker
redis:
image: redis:7-alpine3.16
healthcheck:
test: ["CMD", "redis-cli" ,"ping"]
start_period: 5s
interval: 5s
timeout: 5s
retries: 10
db:
image: mysql:8
volumes:
- mysql:/var/lib/mysql
- "./sql/mysql:/docker-entrypoint-initdb.d"
environment:
- MYSQL_DATABASE=gion
- MYSQL_USER=user
- MYSQL_PASSWORD=pass
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
security_opt:
- seccomp:unconfined
healthcheck:
test: mysqladmin ping -h 127.0.0.1 -u$$MYSQL_USER -p$$MYSQL_PASSWORD
start_period: 5s
interval: 5s
timeout: 5s
retries: 10
# db:
# image: postgres
# volumes:
# - postgres:/var/lib/postgresql/data
# - "./sql/pg:/docker-entrypoint-initdb.d"
# environment:
# - POSTGRES_USER=gion
# - POSTGRES_PASSWORD=pass
volumes:
mysql:
postgres: