-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
158 lines (145 loc) · 5.07 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
version: "3.7"
x-restart-policy:
restart: &default-restart-policy unless-stopped
services:
traefik:
image: traefik:v2.8.3
restart: *default-restart-policy
command:
- --api.insecure=true
- --api.dashboard=true
- --log.level=DEBUG
- --accesslog=true
- --accesslog.format=json
- --accesslog.filepath=/var/log/traefik/access.log.json
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --entrypoints.web.http.redirections.entrypoint.to=websecure
- --entrypoints.web.http.redirections.entrypoint.scheme=https
- --certificatesresolvers.le.acme.tlschallenge=true
- --certificatesresolvers.le.acme.email=${ACL_SERACH_LETS_ENCRYPT_EMAIL}
- --certificatesresolvers.le.acme.dnschallenge=true
- --certificatesresolvers.le.acme.dnschallenge.provider=cloudflare
- --certificatesresolvers.le.acme.storage=/certs/acme.json
# - --certificatesresolvers.le.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
- --entrypoints.websecure.http.tls=true
- --entrypoints.websecure.http.tls.certResolver=le
- --entrypoints.websecure.http.tls.domains[0].main=aclsear.ch
- --entrypoints.websecure.http.tls.domains[0].sans=*.aclsear.ch
labels:
- traefik.enable=true
- traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)
- traefik.http.routers.http-catchall.entrypoints=web
- traefik.http.routers.http-catchall.middlewares=https-redirect
- traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
- traefik.http.middlewares.https-redirect.redirectscheme.permanent=true
environment:
- CF_API_EMAIL=${ACL_SERACH_LETS_ENCRYPT_EMAIL}
- CF_API_KEY=${CLOUDFLARE_API_TOKEN}
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- certs:/certs
frontend:
image: timbmg/acl-search-frontend:${TAG}
build:
context: ./frontend
restart: *default-restart-policy
labels:
- traefik.enable=true
- traefik.http.routers.frontend.priority=1
- traefik.http.routers.frontend.entrypoints=websecure
- traefik.http.routers.frontend.tls=true
- traefik.http.routers.frontend.tls.certresolver=le
- traefik.http.routers.frontend.rule=Host(`aclsear.ch`)
index-worker: &index
image: timbmg/acl-search-index:${TAG}
build:
context: ./index
command: celery -A index.core worker -l DEBUG
restart: *default-restart-policy
environment:
ELASTICSEARCH_HOST: elasticsearch
ELASTICSEARCH_PORT: 9200
RABBITMQ_HOST: rabbitmq
RABBITMQ_PORT: 5672
REDIS_HOST: redis
REDIS_PORT: 6379
env_file:
- .env
- ./rabbitmq/.env
volumes:
- ./index/venues.yaml:/venues.yaml
index-beat:
<<: *index
command: celery -A index.core beat -l DEBUG
search:
image: timbmg/acl-search-search:${TAG}
build:
context: ./search
command: uvicorn search.main:app --host 0.0.0.0 --port 8000 --log-config logging.conf --no-use-colors
restart: *default-restart-policy
environment:
ELASTICSEARCH_HOST: elasticsearch
ELASTICSEARCH_PORT: 9200
CORS_ALLOW_ORIGINS: ${ACL_SEARCH_HOST}
env_file:
- .env
labels:
- traefik.enable=true
- traefik.http.routers.search.entrypoints=websecure
- traefik.http.routers.search.tls=true
- traefik.http.routers.search.tls.certresolver=le
- traefik.http.routers.search.rule=PathPrefix(`/api/search`)
- traefik.http.routers.search.middlewares=search-stripprefix,search-addprefix
- traefik.http.middlewares.search-stripprefix.stripprefix.prefixes=/api/search
- traefik.http.middlewares.search-addprefix.addPrefix.prefix=/api
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.3.3
restart: *default-restart-policy
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- ingest.geoip.downloader.enabled=false
# allow running with low disk space
- cluster.routing.allocation.disk.threshold_enabled=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
healthcheck:
test: [ "CMD-SHELL", "curl -f http://localhost:9200/_cat/health | grep -q green" ]
interval: 30s
timeout: 30s
retries: 3
redis:
image: redis:7.0.4-alpine
restart: *default-restart-policy
command: redis-server --requirepass ${REDIS_PASSWORD}
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 30s
retries: 3
rabbitmq:
image: rabbitmq:3.10.7
restart: *default-restart-policy
env_file:
- ./rabbitmq/.env
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 30s
timeout: 30s
retries: 3
volumes:
certs:
driver: local
elasticsearch_data:
driver: local
redis_data:
driver: local