-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
109 lines (102 loc) · 2.49 KB
/
docker-compose.yml
File metadata and controls
109 lines (102 loc) · 2.49 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
version: '3.8'
services:
# PostgreSQL Database
postgres:
image: postgres:15-alpine
container_name: valtronics-postgres
environment:
POSTGRES_DB: valtronics_db
POSTGRES_USER: valtronics
POSTGRES_PASSWORD: password
volumes:
- postgres_data:/var/lib/postgresql/data
- ./scripts/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U valtronics"]
interval: 10s
timeout: 5s
retries: 5
# Redis Cache
redis:
image: redis:7-alpine
container_name: valtronics-redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# MQTT Broker
mosquitto:
image: eclipse-mosquitto:2.0
container_name: valtronics-mqtt
ports:
- "1883:1883"
- "9001:9001"
volumes:
- ./config/mosquitto.conf:/mosquitto/config/mosquitto.conf
- mosquitto_data:/mosquitto/data
- mosquitto_logs:/mosquitto/log
healthcheck:
test: ["CMD", "sh", "-c", "mosquitto_pub -h localhost -t test -m 'healthcheck' || exit 1"]
interval: 30s
timeout: 10s
retries: 3
# Backend API
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: valtronics-backend
environment:
- DATABASE_URL=postgresql://valtronics:password@postgres:5432/valtronics_db
- REDIS_URL=redis://redis:6379
- MQTT_BROKER_HOST=mosquitto
- MQTT_BROKER_PORT=1883
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
ports:
- "8000:8000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
mosquitto:
condition: service_healthy
volumes:
- ./backend:/app
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/health/ping"]
interval: 30s
timeout: 10s
retries: 3
restart: unless-stopped
# Frontend
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: valtronics-frontend
ports:
- "3000:80"
depends_on:
- backend
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/"]
interval: 30s
timeout: 10s
retries: 3
restart: unless-stopped
volumes:
postgres_data:
redis_data:
mosquitto_data:
mosquitto_logs:
networks:
default:
name: valtronics-network