-
Notifications
You must be signed in to change notification settings - Fork 42
/
docker-compose-elastic-cloud.yml
133 lines (127 loc) · 3.7 KB
/
docker-compose-elastic-cloud.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
version: "2.1"
services:
opbeans-node:
build: .
image: opbeans/opbeans-node:latest
ports:
- "127.0.0.1:${OPBEANS_NODE_PORT:-8000}:3000"
container_name: opbeans-node
logging:
driver: 'json-file'
options:
max-size: '2m'
max-file: '5'
environment:
- ELASTIC_APM_SERVICE_NAME=${ELASTIC_APM_SERVICE_NAME:-opbeans-node}
- ELASTIC_APM_SERVER_URL=${ELASTIC_APM_SERVER_URL:-http://apm-server:8200}
- ELASTIC_APM_APPLICATION_PACKAGES=co.elastic.apm.opbeans
- ELASTIC_APM_JS_SERVER_URL=${ELASTIC_APM_JS_SERVER_URL:-http://localhost:8200}
- ELASTIC_APM_JS_SERVICE_NAME=${ELASTIC_APM_JS_SERVICE_NAME:-opbeans-react}
- NODE_ENV=test
- OPBEANS_SERVER_PORT=${OPBEANS_SERVER_PORT:-3000}
- PGHOST=postgres
- PGUSER=postgres
- PGPASSWORD=hunter2
- PGDATABASE=opbeans
- REDIS_URL=redis://redis:6379
depends_on:
apm-server:
condition: service_healthy
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "--write-out", "'HTTP %{http_code}'", "--silent", "--output", "/dev/null", "http://opbeans-node:3000/"]
interval: 10s
retries: 10
apm-server:
image: docker.elastic.co/apm/apm-server:${STACK_VERSION:-7.3.0}
ports:
- "127.0.0.1:${APM_SERVER_PORT:-8200}:8200"
- "127.0.0.1:${APM_SERVER_MONITOR_PORT:-6060}:6060"
command: >
apm-server -e
-E apm-server.frontend.enabled=true
-E apm-server.frontend.rate_limit=100000
-E apm-server.host=0.0.0.0:8200
-E apm-server.read_timeout=1m
-E apm-server.shutdown_timeout=2m
-E apm-server.write_timeout=1m
-E apm-server.rum.enabled=true
-E setup.kibana.host=kibana:5601
-E setup.template.settings.index.number_of_replicas=0
-E xpack.monitoring.elasticsearch=true
-E cloud.id=${ELASTIC_CLOUD_ID}
-E cloud.auth=${ELASTIC_CLOUD_CREDENTIALS}
-E output.elasticsearch.enabled=${APM_SERVER_ELASTICSEARCH_OUTPUT_ENABLED:-true}
cap_drop:
- ALL
cap_add:
- CHOWN
- DAC_OVERRIDE
- SETGID
- SETUID
logging:
driver: 'json-file'
options:
max-size: '2m'
max-file: '5'
healthcheck:
test: ["CMD", "curl", "--write-out", "'HTTP %{http_code}'", "--silent", "--output", "/dev/null", "http://apm-server:8200/"]
retries: 10
interval: 10s
postgres:
image: postgres:latest
environment:
- POSTGRES_PASSWORD=hunter2
- POSTGRES_DB=opbeans
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "127.0.0.1:5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
retries: 10
interval: 10s
redis:
image: redis:4
ports:
- 6379:6379
logging:
driver: 'json-file'
options:
max-size: '2m'
max-file: '5'
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
wait:
image: busybox
depends_on:
opbeans-node:
condition: service_healthy
loadPgData:
image: node:20-bullseye
environment:
- PGHOST=postgres
- PGUSER=postgres
- PGPASSWORD=hunter2
- PGDATABASE=opbeans
logging:
driver: 'json-file'
options:
max-size: '2m'
max-file: '5'
command: ["/bin/bash","-c","apt-get update && apt-get install -qq -y postgresql-client && npm install && npm run db-setup && node db/generate_orders.js 1000"]
working_dir: /app
volumes:
- .:/app
depends_on:
postgres:
condition: service_healthy
volumes:
esdata:
driver: local
pgdata:
driver: local