Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
142 lines (139 loc) · 3.81 KB
/
Copy pathdocker-compose.yml
File metadata and controls
142 lines (139 loc) · 3.81 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
version: '3'
services:
web:
image: kinduff/dogapi.dog:latest
restart: unless-stopped
# Bucket credentials and Umami keys, see .env.example. The file has to
# exist next to this one or compose refuses to start.
env_file:
- .env
environment:
- REDIS_URL=redis://redis
- DATABASE_URL=postgres://postgres:postgres@postgres
- RAILS_SERVE_STATIC_FILES=true
- PROMETHEUS_EXPORTER_HOST=metrics
healthcheck:
test:
[
"CMD",
"ruby",
"-e",
"require 'net/http'; exit(Net::HTTP.get_response(URI('http://127.0.0.1:3000/up')).code == '200' ? 0 : 1)",
]
interval: 30s
timeout: 5s
retries: 3
start_period: 30s
depends_on:
- postgres
- redis
networks:
- web
- internal
links:
- postgres:postgres
- redis:redis
labels:
- traefik.http.routers.dogapidog.rule=Host(`dogapi.dog`)
- traefik.http.routers.dogapidog.tls=true
- traefik.http.routers.dogapidog.tls.certresolver=lets-encrypt
- traefik.port=80
- com.centurylinklabs.watchtower.enable=true
- com.centurylinklabs.watchtower.lifecycle.post-update=bin/after_deploy
# Two workers rather than one: what limits an import is Wikimedia's patience,
# what limits a review is the model's rate limit, and the two numbers are
# nothing alike. Neither is behind Traefik — they take no requests.
worker-images:
image: kinduff/dogapi.dog:latest
restart: unless-stopped
command: bundle exec sidekiq -q images -c 2
env_file:
- .env
environment:
- REDIS_URL=redis://redis
- DATABASE_URL=postgres://postgres:postgres@postgres
- PROMETHEUS_EXPORTER_HOST=metrics
depends_on:
- postgres
- redis
networks:
- internal
links:
- postgres:postgres
- redis:redis
labels:
- com.centurylinklabs.watchtower.enable=true
worker-reviews:
image: kinduff/dogapi.dog:latest
restart: unless-stopped
command: bundle exec sidekiq -q reviews -q default -c 8
env_file:
- .env
environment:
- REDIS_URL=redis://redis
- DATABASE_URL=postgres://postgres:postgres@postgres
- PROMETHEUS_EXPORTER_HOST=metrics
depends_on:
- postgres
- redis
networks:
- internal
links:
- postgres:postgres
- redis:redis
labels:
- com.centurylinklabs.watchtower.enable=true
# prometheus_exporter collector. Puma and Sidekiq push here, Alloy scrapes it
# by the prometheus.* labels. Internal network only, no public route.
metrics:
image: kinduff/dogapi.dog:latest
restart: unless-stopped
command: bundle exec prometheus_exporter -b 0.0.0.0 -p 9394
networks:
- internal
labels:
- com.centurylinklabs.watchtower.enable=true
- prometheus.scrape=true
- prometheus.port=9394
postgres:
image: postgres:13
restart: unless-stopped
environment:
- POSTGRES_PASSWORD=postgres
volumes:
- pg_data:/var/lib/postgresql/data
networks:
- internal
redis:
image: redis
volumes:
- redis_data:/data
networks:
- internal
watchtower:
container_name: watchtower
image: containrrr/watchtower
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /home/kinduff/.docker/config.json:/config.json
environment:
- TZ=Europe/Madrid
- WATCHTOWER_LABEL_ENABLE=true
- WATCHTOWER_POLL_INTERVAL=60
- WATCHTOWER_DEBUG=true
- WATCHTOWER_CLEANUP=true
- WATCHTOWER_LIFECYCLE_HOOKS=true
- WATCHTOWER_ROLLING_RESTART=true
labels:
- com.centurylinklabs.watchtower.enable=true
networks:
- internal
volumes:
pg_data:
redis_data:
networks:
web:
external: true
internal:
external: false