-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
65 lines (65 loc) · 2.84 KB
/
docker-compose.yml
File metadata and controls
65 lines (65 loc) · 2.84 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
services:
dk5-app:
build:
context: .
dockerfile: pipelines/build-dk5-image/Dockerfile
ports:
- "3000:3000"
- "3001:3001"
environment:
NODE_ENV: production
PORT: 3000
PRO_PORT: 3001
ELASTIC_HOST: elasticsearch:9200
LOG_LEVEL: error
depends_on:
elasticsearch:
condition: service_healthy
es-init:
condition: service_started
# Use the CMD defined in Dockerfile (node -r @babel/register src/main.js)
volumes:
- ./data:/data
elasticsearch:
#
image: docker.elastic.co/elasticsearch/elasticsearch:8.19.1
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- ES_JAVA_OPTS=-Xms512m -Xmx512m
- ELASTICSEARCH_USERNAME=elastic
- ELASTICSEARCH_PASSWORD=changeme
ports:
- "9200:9200"
- "9300:9300"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata:/usr/share/elasticsearch/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9200/_cluster/health"]
interval: 10s
timeout: 5s
retries: 10
es-init:
build:
context: .
dockerfile: pipelines/build-dk5-image/Dockerfile
# Run once to load data if ISO present; skip if already loaded marker exists
command:
[
"/bin/sh",
"-c",
'if [ -f /data/dk5_total.iso2709 ] && [ ! -f /data/.es_loaded ]; then echo ''Loading DK5 data into Elasticsearch''; node -r @babel/register src/iso2709ToElasticLoad -i /data/dk5_total.iso2709 -o /data/elastic_bulk_load.json && (curl -s -XDELETE elasticsearch:9200/systematic || true) && (curl -s -XDELETE elasticsearch:9200/register || true) && curl -s -XPUT elasticsearch:9200/systematic -H ''Content-Type: application/json'' -d ''{"mappings":{"properties":{"parent":{"enabled":false}}},"settings":{"number_of_shards":1}}'' && curl -s -XPUT elasticsearch:9200/register -H ''Content-Type: application/json'' -d ''{"settings":{"analysis":{"char_filter":{"dk5":{"type":"mapping","mappings":[":=>kolon"]}},"analyzer":{"default":{"type":"custom","char_filter":["dk5"],"tokenizer":"standard","filter":["lowercase"]}}},"number_of_shards":1}}'' && curl -s -XPOST ''elasticsearch:9200/_bulk?refresh=wait_for'' -H ''Content-Type: application/json'' --data-binary @/data/elastic_bulk_load.json && curl -s -XPUT elasticsearch:9200/systematic/_settings -H ''Content-Type: application/json'' -d ''{"index":{"max_result_window":50000}}'' && curl -s -XPUT elasticsearch:9200/register/_settings -H ''Content-Type: application/json'' -d ''{"index":{"max_result_window":50000}}'' && touch /data/.es_loaded; else echo ''Skip data load (missing ISO or already loaded)''; fi',
]
depends_on:
elasticsearch:
condition: service_healthy
volumes:
- ./data:/data
restart: "no"
volumes:
esdata:
driver: local