-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-stack.yml
76 lines (70 loc) · 1.72 KB
/
docker-stack.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
version: '3.1'
services:
scraptt-db:
image: cockroachdb/cockroach:v2.0.4
ports:
- 54321:26257
- 18080:8080
command: >
shell -c '
echo "Asia/Taipei" > /etc/timezone
&& rm /etc/localtime
&& dpkg-reconfigure -f noninteractive tzdata
&& /cockroach/cockroach start --insecure'
volumes:
- scraptt-db:/cockroach/cockroach-data
networks:
- scraptt-network
scraptt-db-N:
image: cockroachdb/cockroach:v2.0.4
command: >
shell -c '
echo "Asia/Taipei" > /etc/timezone
&& rm /etc/localtime
&& dpkg-reconfigure -f noninteractive tzdata
&& /cockroach/cockroach start --insecure --join=scraptt-db'
depends_on:
- scraptt-db
deploy:
replicas: 3
networks:
- scraptt-network
scraptt:
image: scraptt
volumes:
- scraptt:/var/log
command: >
sh -c '
for i in `seq 1 15`; do wget --spider -q scrapyd:6800 && break; sleep 1; done
&& scrapyd-deploy scraptt -p scraptt
&& python -c "from cockroach.db import init_db; init_db()"
&& tail -f /dev/null
'
depends_on:
- scraptt-db
- scrapyd
networks:
- scraptt-network
scrapyd:
image: amigcamel/alpine-scrapy-psycopg2:latest # TODO: -- can be even smaller
volumes:
- ./scrapyd.cfg:/etc/scrapyd/scrapyd.conf
- ./requirements.txt:/tmp/requirements.txt
ports:
- 16800:6800
environment:
- "TZ=Asia/Taipei"
command: >
sh -c '
apk add --update tzdata git
&& pip install scrapyd
&& pip install -r /tmp/requirements.txt
&& scrapyd
'
networks:
- scraptt-network
volumes:
scraptt:
scraptt-db:
networks:
scraptt-network: