Files
OmniOilPersonal/infrastructure/mosquitto/mosquitto.conf.template
2026-06-25 18:08:56 -05:00

53 lines
1.7 KiB
Plaintext

# =============================================================================
# Eclipse Mosquitto MQTT Broker - OmniOil Production Configuration
# =============================================================================
# Listeners
listener 1883
protocol mqtt
# WebSocket listener (for agents and frontend)
listener 9883
protocol websockets
# Security (Go-Auth Plugin)
auth_plugin /mosquitto/go-auth.so
auth_opt_backends postgres
allow_anonymous false
# PostgreSQL Connection Settings
# Replaced by entrypoint.sh at runtime
auth_opt_pg_host POSTGRES_HOST_PLACEHOLDER
auth_opt_pg_port 5432
auth_opt_pg_user POSTGRES_USER_PLACEHOLDER
auth_opt_pg_password POSTGRES_PASSWORD_PLACEHOLDER
auth_opt_pg_dbname POSTGRES_DB_PLACEHOLDER
# Auth Queries
# Verify user and password hash
auth_opt_pg_userquery SELECT password_hash FROM mqtt_users WHERE username = $1
# Superuser Query (Grant total access to admins without checking ACL table)
auth_opt_pg_superquery SELECT count(*) FROM mqtt_users WHERE username = $1 AND is_admin = true
# Standard ACL Query (For regular non-admin users/agents)
auth_opt_pg_aclquery SELECT topic FROM mqtt_acls WHERE username = $1 AND rw >= $2
# General Plugin Options
auth_opt_pg_sslmode disable
auth_opt_check_interval 10
auth_opt_hasher bcrypt
auth_opt_log_level info
# Persistence
persistence true
persistence_location /mosquitto/data
# Límite de tamaño de paquetes MQTT
# 2MB: suficiente para ProjectConfig sin comprimir durante deploys locales/grandes
# y payloads de telemetría de simulador con cientos de variables por dispositivo.
# Mosquitto 2.x anuncia `max_packet_size` a clientes MQTT v5; mantener ambos
# evita que clientes rumqttc sigan viendo el límite default de 256KB.
max_packet_size 2097152
message_size_limit 2097152