-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
123 lines (116 loc) · 3.13 KB
/
docker-compose.yml
File metadata and controls
123 lines (116 loc) · 3.13 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
x-logging: &default-logging
driver: json-file
options:
max-size: "10m"
max-file: "5"
services:
# Main did application
did:
build:
context: .
target: development
ports:
- "9001:9001"
environment:
- NODE_ENV=development
- PORT=9001
- MONGO_DB_CONNECTION_STRING=mongodb://mongodb:27017
- MONGO_DB_DB_NAME=main
- REDIS_CACHE_HOSTNAME=redis
- REDIS_CACHE_PORT=6379
- DEBUG=environment*,graphql*
- LAUNCH_BROWSER=0
volumes:
- .:/app
- /app/node_modules
depends_on:
mongodb:
condition: service_healthy
redis:
condition: service_healthy
# Note: healthcheck intentionally omitted for faster inner-loop; production compose defines it.
networks:
- did-network
restart: unless-stopped
logging: *default-logging
# MongoDB database
mongodb:
image: mongo:7.0-jammy
ports:
- "27017:27017"
environment:
- MONGO_INITDB_DATABASE=main
volumes:
- mongodb_data:/data/db
- ./docker/import-data.sh:/docker-entrypoint-initdb.d/02-import-data.sh:ro
- ./docker/data:/docker-entrypoint-initdb.d/data:ro
networks:
- did-network
restart: unless-stopped
logging: *default-logging
# Healthcheck required because other services use condition: service_healthy
# mongosh is included in official mongo images (v5+). We ping the admin DB.
healthcheck:
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
# Redis cache
redis:
image: redis:7.2-alpine
ports:
- "6379:6379" # Exposed for local dev only; do not expose in production
volumes:
- redis_data:/data
networks:
- did-network
restart: unless-stopped
command: redis-server --appendonly yes
logging: *default-logging
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# MongoDB Express for database administration (optional)
mongo-express:
image: mongo-express:1.0-20-alpine3.18
ports:
- "8081:8081"
environment:
- ME_CONFIG_MONGODB_SERVER=mongodb
- ME_CONFIG_MONGODB_PORT=27017
- ME_CONFIG_BASICAUTH_USERNAME=${ME_BASICAUTH_USERNAME:-admin}
- ME_CONFIG_BASICAUTH_PASSWORD=${ME_BASICAUTH_PASSWORD:-admin123}
depends_on:
- mongodb
networks:
- did-network
restart: unless-stopped
logging: *default-logging
profiles:
- tools
# Redis Commander for Redis administration (optional)
redis-commander:
image: rediscommander/redis-commander@sha256:19cd0c49f418779fa2822a0496c5e6516d0c792effc39ed20089e6268477e40a
ports:
- "8082:8081"
environment:
- REDIS_HOSTS=local:redis:6379
- HTTP_USER=${REDIS_COMMANDER_USER:-admin}
- HTTP_PASSWORD=${REDIS_COMMANDER_PASSWORD:-admin123}
depends_on:
- redis
networks:
- did-network
restart: unless-stopped
logging: *default-logging
profiles:
- tools
volumes:
mongodb_data:
redis_data:
networks:
did-network:
driver: bridge