FlotillasGPS - Sistema completo de monitoreo de flotillas GPS
Sistema completo para monitoreo y gestion de flotas de vehiculos con: - Backend FastAPI con PostgreSQL/TimescaleDB - Frontend React con TypeScript y TailwindCSS - App movil React Native con Expo - Soporte para dispositivos GPS, Meshtastic y celulares - Video streaming en vivo con MediaMTX - Geocercas, alertas, viajes y reportes - Autenticacion JWT y WebSockets en tiempo real Documentacion completa y guias de usuario incluidas.
This commit is contained in:
43
deploy/services/cloudflared.service
Normal file
43
deploy/services/cloudflared.service
Normal file
@@ -0,0 +1,43 @@
|
||||
[Unit]
|
||||
Description=Cloudflare Tunnel - Sistema de Flotillas
|
||||
Documentation=https://developers.cloudflare.com/cloudflare-one/connections/connect-apps
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=exec
|
||||
User=root
|
||||
Group=root
|
||||
|
||||
# Directorio de configuracion
|
||||
WorkingDirectory=/etc/cloudflared
|
||||
|
||||
# Comando de inicio
|
||||
# Opcion 1: Usando token (recomendado)
|
||||
ExecStart=/usr/local/bin/cloudflared tunnel --no-autoupdate run --token ${CLOUDFLARE_TUNNEL_TOKEN}
|
||||
|
||||
# Opcion 2: Usando archivo de configuracion
|
||||
# ExecStart=/usr/local/bin/cloudflared tunnel --config /etc/cloudflared/config.yml run
|
||||
|
||||
# Cargar variables de entorno
|
||||
EnvironmentFile=/opt/flotillas/.env
|
||||
|
||||
# Reinicio automatico
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
# Timeouts
|
||||
TimeoutStartSec=60
|
||||
TimeoutStopSec=30
|
||||
|
||||
# Logging
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=cloudflared
|
||||
|
||||
# Seguridad
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
58
deploy/services/flotillas-api.service
Normal file
58
deploy/services/flotillas-api.service
Normal file
@@ -0,0 +1,58 @@
|
||||
[Unit]
|
||||
Description=Sistema de Flotillas - API Backend
|
||||
Documentation=https://github.com/tuorganizacion/flotillas
|
||||
After=network.target postgresql.service redis.service
|
||||
Wants=postgresql.service redis.service
|
||||
|
||||
[Service]
|
||||
Type=exec
|
||||
User=root
|
||||
Group=root
|
||||
WorkingDirectory=/opt/flotillas/backend
|
||||
|
||||
# Cargar variables de entorno
|
||||
EnvironmentFile=/opt/flotillas/.env
|
||||
|
||||
# Comando de inicio
|
||||
# Uvicorn con multiples workers para produccion
|
||||
ExecStart=/opt/flotillas/backend/venv/bin/uvicorn \
|
||||
app.main:app \
|
||||
--host 0.0.0.0 \
|
||||
--port 8000 \
|
||||
--workers 4 \
|
||||
--loop uvloop \
|
||||
--http httptools \
|
||||
--proxy-headers \
|
||||
--forwarded-allow-ips='*' \
|
||||
--access-log \
|
||||
--log-level info
|
||||
|
||||
# Reinicio automatico
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
# Timeouts
|
||||
TimeoutStartSec=30
|
||||
TimeoutStopSec=30
|
||||
|
||||
# Limites de recursos
|
||||
LimitNOFILE=65535
|
||||
LimitNPROC=4096
|
||||
|
||||
# Seguridad
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ReadWritePaths=/opt/flotillas /var/log/flotillas /tmp
|
||||
|
||||
# Logging
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=flotillas-api
|
||||
|
||||
# Health check (systemd 253+)
|
||||
# WatchdogSec=30
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
58
deploy/services/flotillas-web.service
Normal file
58
deploy/services/flotillas-web.service
Normal file
@@ -0,0 +1,58 @@
|
||||
[Unit]
|
||||
Description=Sistema de Flotillas - Frontend Web
|
||||
Documentation=https://github.com/tuorganizacion/flotillas
|
||||
After=network.target flotillas-api.service
|
||||
Wants=flotillas-api.service
|
||||
|
||||
[Service]
|
||||
Type=exec
|
||||
User=root
|
||||
Group=root
|
||||
WorkingDirectory=/opt/flotillas/frontend
|
||||
|
||||
# Cargar variables de entorno
|
||||
EnvironmentFile=/opt/flotillas/.env
|
||||
|
||||
# Comando de inicio usando 'serve' para servir archivos estaticos
|
||||
# Opcion 1: Usando serve (recomendado para SPA React/Vue)
|
||||
ExecStart=/usr/bin/serve \
|
||||
-s dist \
|
||||
-l 3000 \
|
||||
--no-clipboard \
|
||||
--single
|
||||
|
||||
# Opcion 2: Si usas Next.js en modo standalone
|
||||
# ExecStart=/usr/bin/node /opt/flotillas/frontend/.next/standalone/server.js
|
||||
|
||||
# Opcion 3: Si prefieres usar Node directamente
|
||||
# ExecStart=/usr/bin/npx serve -s dist -l 3000
|
||||
|
||||
# Reinicio automatico
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
# Timeouts
|
||||
TimeoutStartSec=30
|
||||
TimeoutStopSec=30
|
||||
|
||||
# Variables de entorno adicionales
|
||||
Environment=NODE_ENV=production
|
||||
Environment=PORT=3000
|
||||
|
||||
# Limites
|
||||
LimitNOFILE=65535
|
||||
|
||||
# Seguridad
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ReadWritePaths=/opt/flotillas
|
||||
|
||||
# Logging
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=flotillas-web
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
41
deploy/services/mediamtx.service
Normal file
41
deploy/services/mediamtx.service
Normal file
@@ -0,0 +1,41 @@
|
||||
[Unit]
|
||||
Description=MediaMTX - Real-Time Media Server
|
||||
Documentation=https://github.com/bluenviron/mediamtx
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=exec
|
||||
User=root
|
||||
Group=root
|
||||
WorkingDirectory=/opt/mediamtx
|
||||
|
||||
# Comando de inicio
|
||||
ExecStart=/opt/mediamtx/mediamtx /opt/mediamtx/mediamtx.yml
|
||||
|
||||
# Reinicio automatico
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
# Timeouts
|
||||
TimeoutStartSec=30
|
||||
TimeoutStopSec=30
|
||||
|
||||
# Limites de recursos
|
||||
LimitNOFILE=65535
|
||||
LimitNPROC=4096
|
||||
|
||||
# Ajustes de red para streaming
|
||||
# Permitir puertos privilegiados si es necesario
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
|
||||
# Seguridad
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
|
||||
# Logging
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=mediamtx
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user