ThingsBoard IoT Platform
Open-source IoT platform for device management, data collection, and visualization.
Overview
ThingsBoard is an open-source IoT platform developed to simplify the collection, processing, and visualization of telemetry data from connected devices. Originally created in 2016 by the ThingsBoard team, it has evolved into a comprehensive solution that handles device management, data collection, rule processing, and dashboard creation for IoT deployments ranging from small prototypes to enterprise-scale implementations. The platform supports multiple communication protocols including MQTT, CoAP, HTTP, and LWM2M, making it versatile for diverse IoT ecosystems. This stack combines ThingsBoard with PostgreSQL as the primary database for storing device data and metadata, Redis for caching and session management to improve response times, and Eclipse Mosquitto as an external MQTT broker for device communication. PostgreSQL provides the robust data integrity and complex querying capabilities needed for time-series telemetry data and device relationships, while Redis accelerates frequent operations like dashboard loading and real-time data access. The inclusion of Mosquitto as a separate MQTT broker allows for more granular control over device connectivity and can handle high-frequency telemetry ingestion independently of the main ThingsBoard container. This configuration is ideal for IoT developers, system integrators, and organizations looking to deploy a complete device management platform without the complexity of cloud vendor lock-in. The stack provides everything needed to onboard devices, create data visualization dashboards, set up alerting rules, and manage device firmware updates, making it particularly valuable for industrial IoT applications, smart building management, and environmental monitoring systems where data sovereignty and customization are priorities.
Key Features
- Multi-protocol device connectivity supporting MQTT, CoAP, HTTP, and LWM2M for diverse IoT device ecosystems
- Advanced rule engine with visual flow-based programming for processing telemetry data and triggering actions
- Time-series data storage in PostgreSQL optimized for high-frequency sensor data ingestion and historical analysis
- Real-time dashboard builder with customizable widgets for gauges, charts, maps, and device controls
- Device provisioning and management with support for device profiles, credentials, and over-the-air updates
- Redis-accelerated data access for sub-second dashboard loading and real-time telemetry visualization
- Built-in alarm system with configurable thresholds, severity levels, and notification channels
- Multi-tenancy support with customer hierarchy, user roles, and resource isolation for managed IoT services
Common Use Cases
- 1Industrial IoT monitoring for manufacturing equipment with predictive maintenance alerts and production dashboards
- 2Smart building automation managing HVAC, lighting, and security sensors with centralized control interfaces
- 3Environmental monitoring networks collecting air quality, weather, and pollution data across multiple locations
- 4Fleet management systems tracking vehicle telemetry, GPS coordinates, and maintenance schedules
- 5Agricultural IoT deployments monitoring soil moisture, temperature, and irrigation systems for precision farming
- 6Energy management platforms collecting data from smart meters, solar panels, and battery storage systems
- 7Home automation labs integrating various smart devices with custom dashboards and automation rules
Prerequisites
- Minimum 4GB RAM recommended for ThingsBoard with PostgreSQL time-series data and concurrent device connections
- Available ports 8080 (web interface), 1883/1884 (MQTT), 7070 (RPC), and 5683-5688 (CoAP/UDP)
- Basic understanding of MQTT protocol and IoT device communication patterns
- Familiarity with time-series data concepts and PostgreSQL for advanced rule engine configuration
- Knowledge of JSON message formats for device telemetry and attribute payloads
- Understanding of SSL/TLS certificates if planning to secure MQTT and web interface communications
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 thingsboard: 3 image: thingsboard/tb-postgres:latest4 ports: 5 - "8080:9090"6 - "1883:1883"7 - "7070:7070"8 - "5683-5688:5683-5688/udp"9 environment: 10 TB_QUEUE_TYPE: in-memory11 volumes: 12 - thingsboard_data:/data13 - thingsboard_logs:/var/log/thingsboard14 networks: 15 - tb-net16 restart: unless-stopped1718 postgres: 19 image: postgres:16-alpine20 environment: 21 POSTGRES_USER: ${POSTGRES_USER}22 POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}23 POSTGRES_DB: thingsboard24 volumes: 25 - postgres_data:/var/lib/postgresql/data26 networks: 27 - tb-net28 restart: unless-stopped2930 redis: 31 image: redis:7-alpine32 volumes: 33 - redis_data:/data34 networks: 35 - tb-net36 restart: unless-stopped3738 mosquitto: 39 image: eclipse-mosquitto:latest40 ports: 41 - "1884:1883"42 - "9001:9001"43 volumes: 44 - ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro45 - mosquitto_data:/mosquitto/data46 - mosquitto_log:/mosquitto/log47 networks: 48 - tb-net49 restart: unless-stopped5051volumes: 52 thingsboard_data: 53 thingsboard_logs: 54 postgres_data: 55 redis_data: 56 mosquitto_data: 57 mosquitto_log: 5859networks: 60 tb-net: 61 driver: bridge.env Template
.env
1# PostgreSQL2POSTGRES_USER=thingsboard3POSTGRES_PASSWORD=secure_postgres_passwordUsage Notes
- 1ThingsBoard at http://localhost:8080
- 2Default login: tenant@thingsboard.org / tenant
- 3MQTT broker at localhost:1883
- 4CoAP at localhost:5683
Individual Services(4 services)
Copy individual services to mix and match with your existing compose files.
thingsboard
thingsboard:
image: thingsboard/tb-postgres:latest
ports:
- "8080:9090"
- "1883:1883"
- "7070:7070"
- 5683-5688:5683-5688/udp
environment:
TB_QUEUE_TYPE: in-memory
volumes:
- thingsboard_data:/data
- thingsboard_logs:/var/log/thingsboard
networks:
- tb-net
restart: unless-stopped
postgres
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: thingsboard
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- tb-net
restart: unless-stopped
redis
redis:
image: redis:7-alpine
volumes:
- redis_data:/data
networks:
- tb-net
restart: unless-stopped
mosquitto
mosquitto:
image: eclipse-mosquitto:latest
ports:
- "1884:1883"
- "9001:9001"
volumes:
- ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
- mosquitto_data:/mosquitto/data
- mosquitto_log:/mosquitto/log
networks:
- tb-net
restart: unless-stopped
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 thingsboard:5 image: thingsboard/tb-postgres:latest6 ports:7 - "8080:9090"8 - "1883:1883"9 - "7070:7070"10 - "5683-5688:5683-5688/udp"11 environment:12 TB_QUEUE_TYPE: in-memory13 volumes:14 - thingsboard_data:/data15 - thingsboard_logs:/var/log/thingsboard16 networks:17 - tb-net18 restart: unless-stopped1920 postgres:21 image: postgres:16-alpine22 environment:23 POSTGRES_USER: ${POSTGRES_USER}24 POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}25 POSTGRES_DB: thingsboard26 volumes:27 - postgres_data:/var/lib/postgresql/data28 networks:29 - tb-net30 restart: unless-stopped3132 redis:33 image: redis:7-alpine34 volumes:35 - redis_data:/data36 networks:37 - tb-net38 restart: unless-stopped3940 mosquitto:41 image: eclipse-mosquitto:latest42 ports:43 - "1884:1883"44 - "9001:9001"45 volumes:46 - ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro47 - mosquitto_data:/mosquitto/data48 - mosquitto_log:/mosquitto/log49 networks:50 - tb-net51 restart: unless-stopped5253volumes:54 thingsboard_data:55 thingsboard_logs:56 postgres_data:57 redis_data:58 mosquitto_data:59 mosquitto_log:6061networks:62 tb-net:63 driver: bridge64EOF6566# 2. Create the .env file67cat > .env << 'EOF'68# PostgreSQL69POSTGRES_USER=thingsboard70POSTGRES_PASSWORD=secure_postgres_password71EOF7273# 3. Start the services74docker compose up -d7576# 4. View logs77docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/thingsboard-iot/run | bashTroubleshooting
- ThingsBoard fails to start with database connection errors: Ensure PostgreSQL container is fully initialized before ThingsBoard starts, add depends_on with health checks
- Devices cannot connect via MQTT with authentication failures: Verify device credentials in ThingsBoard device management and check MQTT broker logs for connection attempts
- Dashboard widgets show 'No data' despite device connectivity: Check device telemetry keys match widget data key configuration and verify time range settings
- High memory usage and slow dashboard loading: Increase Redis memory allocation and enable ThingsBoard caching configuration in environment variables
- Rule engine chains not triggering properly: Verify rule node connections and check ThingsBoard logs for rule processing errors and message flow debugging
- CoAP devices timing out during communication: Ensure UDP port range 5683-5688 is properly exposed and check firewall settings for UDP traffic
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
thingsboardpostgresqlredismqtt
Tags
#thingsboard#iot#mqtt#device-management#telemetry
Category
Home Lab & Self-HostingAd Space
Shortcuts: C CopyF FavoriteD Download