-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
199 lines (167 loc) · 4.91 KB
/
docker-compose.yml
File metadata and controls
199 lines (167 loc) · 4.91 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
189
190
191
192
193
194
195
196
197
198
199
version: '3.8'
services:
labpipanel:
build:
context: .
dockerfile: Dockerfile
container_name: labpipanel
hostname: labpipanel
restart: unless-stopped
# Puertos
ports:
- "5000:5000" # API Flask
- "3000:3000" # Frontend Next.js
# Variables de entorno
environment:
FLASK_HOST: 0.0.0.0
FLASK_PORT: 5000
FLASK_DEBUG: "False"
XLN_HOST: "192.168.1.100"
XLN_PORT: "5024"
XLN_TIMEOUT: "10"
DAQ_TIMEOUT: "10"
LOG_LEVEL: "INFO"
TIMEZONE: "America/Bogota"
PYTHONUNBUFFERED: "1"
# Volúmenes
volumes:
# Hardware (Raspberry Pi solo)
- /dev/bus/usb:/dev/bus/usb:rw # DAQ USB
- /sys/class/gpio:/sys/class/gpio:rw # GPIO relés
# Datos persistentes
- ./logs:/app/logs
- ./results:/app/results
# (Opcional) Configuración externa
- ./.env:/app/.env:ro
# Dispositivos
devices:
- /dev/mem:/dev/mem # GPIO (Raspberry Pi)
- /dev/gpiomem:/dev/gpiomem # GPIO memory (Raspberry Pi)
# Permisos
privileged: true # Necesario para GPIO/USB en Raspberry Pi
# Health check
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5000/api/status"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Logging
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Networks
networks:
- labpipanel_network
# Labels
labels:
com.example.description: "LabPiPanel - Thermal Laboratory Control System"
# ============================================================
# NGINX Reverse Proxy (Opcional, para producción)
# ============================================================
nginx:
image: nginx:latest
container_name: labpipanel_nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./ssl:/etc/nginx/ssl:ro # Certificados SSL
depends_on:
- labpipanel
networks:
- labpipanel_network
# Descomenta solo si necesitas reverse proxy
# profiles:
# - production
# ============================================================
# PROMETHEUS Metrics (Opcional)
# ============================================================
prometheus:
image: prom/prometheus:latest
container_name: labpipanel_prometheus
restart: unless-stopped
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
networks:
- labpipanel_network
# Descomenta solo si usas Prometheus
# profiles:
# - monitoring
# ============================================================
# GRAFANA Dashboards (Opcional)
# ============================================================
grafana:
image: grafana/grafana:latest
container_name: labpipanel_grafana
restart: unless-stopped
ports:
- "3001:3000"
environment:
GF_SECURITY_ADMIN_PASSWORD: "admin"
GF_INSTALL_PLUGINS: "grafana-piechart-panel"
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning:ro
depends_on:
- prometheus
networks:
- labpipanel_network
# Descomenta solo si usas Grafana
# profiles:
# - monitoring
# ============================================================
# VOLUMES
# ============================================================
volumes:
prometheus_data:
driver: local
grafana_data:
driver: local
# ============================================================
# NETWORKS
# ============================================================
networks:
labpipanel_network:
driver: bridge
ipam:
config:
- subnet: 172.25.0.0/16
# ============================================================
# NOTES
# ============================================================
#
# Ejecución básica (sin monitoring):
# docker-compose up -d
#
# Ejecución con monitoring (Prometheus + Grafana):
# docker-compose --profile monitoring up -d
#
# Ejecución con everything (incluyendo Nginx):
# docker-compose --profile production --profile monitoring up -d
#
# Ver logs:
# docker-compose logs -f labpipanel
# docker-compose logs -f [service_name]
#
# Detener servicios:
# docker-compose down
#
# Detener y eliminar volúmenes:
# docker-compose down -v
#
# Configuración Raspberry Pi:
# - Ejecutar con --privileged para acceso a GPIO/USB
# - Verificar permisos de usuario: sudo usermod -aG docker $USER
# - En Raspberry Pi OS, puede ser necesario: sudo apt-get install docker.io docker-compose
#