-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
docker-compose.yml
135 lines (121 loc) · 3.69 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
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
# base ES service definition
x-base-es-service: &base-es-service
image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
restart: ${RESTART_POLICY:-always}
mem_limit: ${MEM_LIMIT}
ulimits:
memlock:
soft: -1
hard: -1
healthcheck:
test:
[
"CMD-SHELL",
"curl -u elastic:elastic -s -f localhost:9200/_cat/health >/dev/null || exit 1",
]
interval: 10s
timeout: 10s
retries: 120
# shared environment for ES
x-base-es-envs: &base-es-envs
cluster.name: ${CLUSTER_NAME}
cluster.initial_master_nodes: es01,es02
bootstrap.memory_lock: "true"
xpack.security.enabled: "false"
xpack.license.self_generated.type: ${LICENSE:-basic}
http.cors.enabled: "true"
http.cors.allow-origin: http://localhost:8080,http://127.0.0.1:8080
http.cors.allow-headers: X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization
http.cors.allow-credentials: "true"
x-api-common: &api-common
image: ghcr.io/openfoodfacts/search-a-licious/search_service_image:${TAG:-dev}
restart: ${RESTART_POLICY:-always}
environment:
- ELASTICSEARCH_URL=${ELASTICSEARCH_URL:-http://es01:9200}
- SENTRY_DNS
- LOG_LEVEL
- REDIS_HOST
- REDIS_PORT
# Directory where we cache downloaded taxonomies files
- TAXONOMY_CACHE_DIR
# Path of the yaml configuration file
- CONFIG_PATH
# URL of the OFF API
- OFF_API_URL
- ALLOWED_ORIGINS
networks:
- default
- common_net
volumes:
- ./data:/opt/search/data
- es_synonyms:/opt/search/synonyms
services:
es01:
<<: *base-es-service
environment:
<<: *base-es-envs
node.name: es01
discovery.seed_hosts: es02
volumes:
- esdata01:/usr/share/elasticsearch/data
- es_synonyms:/usr/share/elasticsearch/config/synonyms
es02:
<<: *base-es-service
environment:
<<: *base-es-envs
node.name: es02
discovery.seed_hosts: es01
depends_on:
- es01
volumes:
- esdata02:/usr/share/elasticsearch/data
- es_synonyms:/usr/share/elasticsearch/config/synonyms
# elasticsearch browser
elasticvue:
image: cars10/elasticvue
restart: ${RESTART_POLICY:-always}
environment:
- NGINX_BASIC_AUTH_USER_PASSWD
ports:
- "${ES_VUE_EXPOSE}:8080"
volumes:
# we add an entrypoint to eventually add basic auth
- ./docker/elasticvue-entrypoint.sh:/bin/elasticvue-entrypoint.sh:ro
entrypoint: ["/bin/elasticvue-entrypoint.sh"]
# because redefining entrypoint, oblige to redefine command…
command: ["nginx", "-g", "daemon off;"]
api:
<<: *api-common
# service listening to redis for updates
updater:
<<: *api-common
command: ["python3", "-m", "app", "run-update-daemon"]
# frontend is nginx serving static files and proxying to API
search_frontend:
# this is the nginx frontend serving react static version or redirecting queries
image: ghcr.io/openfoodfacts/search-a-licious/search_front_image:${TAG:-dev}
restart: ${RESTART_POLICY:-always}
depends_on:
- api
environment:
# enabling prod config and disabling dev one
PROD_UI_SUFFIX: "${PROD_UI_SUFFIX-}"
DEV_UI_SUFFIX: "${DEV_UI_SUFFIX--static}"
volumes:
# Nginx, we use templates dir to be able to use environment vars
- ./confs/nginx.conf:/etc/nginx/templates/default.conf.template
ports:
- ${SEARCH_EXPOSE:-127.0.0.1:8000}:80
build:
context: frontend
args:
USER_UID: ${USER_UID:-1000}
USER_GID: ${USER_GID:-1000}
volumes:
esdata01:
esdata02:
es_synonyms:
networks:
# this is the network shared with product opener
common_net:
name: ${COMMON_NET_NAME}