-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
188 lines (181 loc) · 4.5 KB
/
Copy pathdocker-compose.yml
File metadata and controls
188 lines (181 loc) · 4.5 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
services:
# PostgreSQL Database with TimescaleDB extension
postgres:
image: timescale/timescaledb:latest-pg15
container_name: meshtastic-postgres
environment:
POSTGRES_DB: meshtastic_mapper
POSTGRES_USER: meshtastic
POSTGRES_PASSWORD: meshtastic_password
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./config/postgres:/docker-entrypoint-initdb.d
networks:
- meshtastic-network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U meshtastic -d meshtastic_mapper"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 2G
cpus: '1.0'
reservations:
memory: 1G
cpus: '0.5'
# Redis for caching and session storage
redis:
image: redis:7-alpine
container_name: meshtastic-redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
- ./config/redis/redis.conf:/usr/local/etc/redis/redis.conf
networks:
- meshtastic-network
restart: unless-stopped
command: redis-server /usr/local/etc/redis/redis.conf
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
reservations:
memory: 256M
cpus: '0.25'
# Mosquitto MQTT Broker
mosquitto:
image: eclipse-mosquitto:2.0
container_name: meshtastic-mosquitto
ports:
- "1883:1883"
- "9001:9001"
volumes:
- ./config/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf
- ./config/mosquitto/passwd:/mosquitto/config/passwd
- ./config/mosquitto/mosquitto.acl:/mosquitto/config/mosquitto.acl
- mosquitto_data:/mosquitto/data
- ./logs/mosquitto:/mosquitto/log
networks:
- meshtastic-network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "mosquitto_pub -h localhost -t test -m 'health check' || exit 1"]
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
reservations:
memory: 256M
cpus: '0.25'
# Backend API Service
backend:
build:
context: ./backend
dockerfile: Dockerfile.dev
container_name: meshtastic-backend
environment:
NODE_ENV: development
DATABASE_URL: postgresql://meshtastic:meshtastic_password@postgres:5432/meshtastic_mapper
REDIS_URL: redis://redis:6379
MQTT_BROKER_URL: mqtt://mosquitto:1883
JWT_SECRET: your-jwt-secret-change-in-production
API_PORT: 3001
ports:
- "3001:3001"
volumes:
- ./backend:/app
- /app/node_modules
- ./logs/backend:/app/logs
- ./config:/app/config
networks:
- meshtastic-network
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
mosquitto:
condition: service_healthy
restart: unless-stopped
command: npm run dev
deploy:
resources:
limits:
memory: 1G
cpus: '1.0'
reservations:
memory: 512M
cpus: '0.5'
# Frontend Web Application
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: meshtastic-frontend
environment:
NODE_ENV: development
REACT_APP_API_URL: http://backend:3001/api
REACT_APP_WS_URL: ws://backend:3001
ports:
- "3000:3000"
volumes:
- ./frontend:/app
- /app/node_modules
- ./config:/app/config
networks:
- meshtastic-network
depends_on:
- backend
restart: unless-stopped
command: npm start
deploy:
resources:
limits:
memory: 2G
cpus: '1.0'
reservations:
memory: 512M
cpus: '0.5'
# Nginx Reverse Proxy (for production)
nginx:
image: nginx:alpine
container_name: meshtastic-nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./config/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./config/nginx/ssl:/etc/nginx/ssl
- ./logs/nginx:/var/log/nginx
networks:
- meshtastic-network
depends_on:
- frontend
- backend
restart: unless-stopped
profiles:
- production
volumes:
postgres_data:
redis_data:
mosquitto_data:
networks:
meshtastic-network:
driver: bridge