-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.images.yml
More file actions
154 lines (147 loc) · 4.17 KB
/
docker-compose.images.yml
File metadata and controls
154 lines (147 loc) · 4.17 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
services:
# PostgreSQL Database with TimescaleDB extension
postgres:
image: timescale/timescaledb:latest-pg15
container_name: meshtastic-postgres-prod
environment:
POSTGRES_DB: ${POSTGRES_DB:-meshtastic_mapper}
POSTGRES_USER: ${POSTGRES_USER:-meshtastic}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_HOST_AUTH_METHOD: md5
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./backups:/backups
networks:
- meshtastic-network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-meshtastic} -d ${POSTGRES_DB:-meshtastic_mapper}"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
# Redis for caching and session storage
redis:
image: redis:7-alpine
container_name: meshtastic-redis-prod
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD}
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis_data:/data
networks:
- meshtastic-network
restart: unless-stopped
command: redis-server --requirepass ${REDIS_PASSWORD}
healthcheck:
test: ["CMD", "redis-cli", "--no-auth-warning", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
# Mosquitto MQTT Broker
mosquitto:
image: eclipse-mosquitto:2.0
container_name: meshtastic-mosquitto-prod
ports:
- "${MQTT_PORT:-1883}:1883"
- "${MQTT_WS_PORT:-9001}:9001"
volumes:
- mosquitto_data:/mosquitto/data
- ./logs/mosquitto:/mosquitto/log
networks:
- meshtastic-network
restart: unless-stopped
# Backend API Service
backend:
image: ${DOCKER_REGISTRY:-meshtastic}/node-mapper-backend:${VERSION:-latest}
container_name: meshtastic-backend-prod
environment:
NODE_ENV: production
DATABASE_URL: postgresql://${POSTGRES_USER:-meshtastic}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-meshtastic_mapper}
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379
MQTT_BROKER_URL: mqtt://mosquitto:1883
JWT_SECRET: ${JWT_SECRET}
API_PORT: 3001
FRONTEND_URL: ${FRONTEND_URL:-http://localhost}
LOG_LEVEL: ${LOG_LEVEL:-info}
RATE_LIMIT_WINDOW_MS: ${RATE_LIMIT_WINDOW_MS:-60000}
RATE_LIMIT_MAX_REQUESTS: ${RATE_LIMIT_MAX_REQUESTS:-100}
ports:
- "${API_PORT:-3001}:3001"
volumes:
- ./logs/backend:/app/logs
- ./backups:/app/backups
networks:
- meshtastic-network
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
# Frontend Web Application
frontend:
image: ${DOCKER_REGISTRY:-meshtastic}/node-mapper-frontend:${VERSION:-latest}
container_name: meshtastic-frontend-prod
environment:
NODE_ENV: production
networks:
- meshtastic-network
depends_on:
- backend
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
# Nginx Reverse Proxy and Load Balancer
nginx:
image: nginx:alpine
container_name: meshtastic-nginx-prod
ports:
- "${HTTP_PORT:-80}:80"
- "${HTTPS_PORT:-443}:443"
volumes:
- ./config/nginx/nginx.prod.conf:/etc/nginx/nginx.conf:ro
- ./config/nginx/ssl:/etc/nginx/ssl:ro
- ./logs/nginx:/var/log/nginx
- nginx_cache:/var/cache/nginx
networks:
- meshtastic-network
depends_on:
- frontend
- backend
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
volumes:
postgres_data:
driver: local
redis_data:
driver: local
mosquitto_data:
driver: local
nginx_cache:
driver: local
networks:
meshtastic-network:
driver: bridge
ipam:
config:
- subnet: 172.21.0.0/16