-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
145 lines (138 loc) · 6.41 KB
/
docker-compose.yml
File metadata and controls
145 lines (138 loc) · 6.41 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
version: '3.8'
services:
# ──────────────────────────────────────────────────────────────────────
# Auth Service (Node.js)
# ──────────────────────────────────────────────────────────────────────
auth-service:
build:
context: .
dockerfile: Dockerfile
container_name: einstrust
restart: unless-stopped
ports:
- "${PORT:-3000}:3000"
environment:
NODE_ENV: ${NODE_ENV:-production}
PORT: 3000
MONGODB_URI: mongodb://mongodb:27017/auth-platform
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET}
JWT_ACCESS_EXPIRATION: ${JWT_ACCESS_EXPIRATION:-15m}
JWT_REFRESH_EXPIRATION: ${JWT_REFRESH_EXPIRATION:-7d}
BCRYPT_ROUNDS: ${BCRYPT_ROUNDS:-12}
MAX_LOGIN_ATTEMPTS: ${MAX_LOGIN_ATTEMPTS:-5}
LOCKOUT_DURATION: ${LOCKOUT_DURATION:-900000}
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID}
GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET}
depends_on:
- mongodb
- redis
networks:
- auth-network
volumes:
- ./logs:/app/logs
healthcheck:
test: ["CMD", "node", "healthcheck.js"]
interval: 30s
timeout: 3s
retries: 3
start_period: 40s
# ──────────────────────────────────────────────────────────────────────
# MongoDB Database
# ──────────────────────────────────────────────────────────────────────
mongodb:
image: mongo:6.0
container_name: auth-mongodb
restart: unless-stopped
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_ROOT_USERNAME:-admin}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD:-changeme}
MONGO_INITDB_DATABASE: auth-platform
volumes:
- mongodb_data:/data/db
- mongodb_config:/data/configdb
networks:
- auth-network
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 5s
retries: 5
# ──────────────────────────────────────────────────────────────────────
# Redis (Token Blacklist & Rate Limiting)
# ──────────────────────────────────────────────────────────────────────
redis:
image: redis:7-alpine
container_name: auth-redis
restart: unless-stopped
ports:
- "6379:6379"
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-changeme}
volumes:
- redis_data:/data
networks:
- auth-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
# ──────────────────────────────────────────────────────────────────────
# Optional: MongoDB Express (Database UI)
# ──────────────────────────────────────────────────────────────────────
mongo-express:
image: mongo-express:latest
container_name: auth-mongo-express
restart: unless-stopped
ports:
- "8081:8081"
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: ${MONGO_ROOT_USERNAME:-admin}
ME_CONFIG_MONGODB_ADMINPASSWORD: ${MONGO_ROOT_PASSWORD:-changeme}
ME_CONFIG_MONGODB_URL: mongodb://${MONGO_ROOT_USERNAME:-admin}:${MONGO_ROOT_PASSWORD:-changeme}@mongodb:27017/
ME_CONFIG_BASICAUTH_USERNAME: ${ME_USERNAME:-admin}
ME_CONFIG_BASICAUTH_PASSWORD: ${ME_PASSWORD:-changeme}
depends_on:
- mongodb
networks:
- auth-network
profiles:
- dev # Only start with --profile dev
# ──────────────────────────────────────────────────────────────────────
# Optional: Redis Commander (Redis UI)
# ──────────────────────────────────────────────────────────────────────
redis-commander:
image: rediscommander/redis-commander:latest
container_name: auth-redis-commander
restart: unless-stopped
ports:
- "8082:8081"
environment:
REDIS_HOSTS: local:redis:6379:0:${REDIS_PASSWORD:-changeme}
depends_on:
- redis
networks:
- auth-network
profiles:
- dev # Only start with --profile dev
# ──────────────────────────────────────────────────────────────────────
# Networks
# ──────────────────────────────────────────────────────────────────────
networks:
auth-network:
driver: bridge
# ──────────────────────────────────────────────────────────────────────
# Volumes (Persistent Data)
# ──────────────────────────────────────────────────────────────────────
volumes:
mongodb_data:
driver: local
mongodb_config:
driver: local
redis_data:
driver: local