IoT PaaS Demo We recommend to use ThingsBoard Professional Edition Live Demo for the seamless experience and the newest features from the latest source code! Save time on the installation and configuration with several pre-provisioned devices, dashboards available in the cloud and pre-integrated email server to create new customer accounts and users. |
This guide will help you to install and start ThingsBoard using Docker on Windows.
Depending on the database used there are three type of ThingsBoard single instance docker images:
thingsboard/tb-postgres - single instance of ThingsBoard with PostgreSQL database.
Recommended option for small servers with at least 1GB of RAM and minimum load (few messages per second). 2-4GB is recommended.
thingsboard/tb-cassandra - single instance of ThingsBoard with Cassandra database.
The most performant and recommended option but requires at least 6GB of RAM. 8GB is recommended.
thingsboard/tb - single instance of ThingsBoard with embedded HSQLDB database.
Note: Not recommended for any evaluation or production usage and is used only for development purposes and automatic tests.
In this instruction thingsboard/tb-postgres
image will be used. You can choose any other images with different databases (see above).
Windows users should use docker managed volume for ThingsBoard DataBase.
Create docker volume (for ex. mytb-data
) before executing docker run command:
Open “Docker Quickstart Terminal”. Execute the following command to create docker volume:
docker volume create mytb-data
docker volume create mytb-logs
ThingsBoard is able to use various messaging systems/brokers for storing the messages and communication between ThingsBoard services. How to choose the right queue implementation?
In Memory queue implementation is built-in and default. It is useful for development(PoC) environments and is not suitable for production deployments or any sort of cluster deployments.
Kafka is recommended for production deployments. This queue is used on the most of ThingsBoard production environments now. It is useful for both on-prem and private cloud deployments. It is also useful if you like to stay independent from your cloud provider. However, some providers also have managed services for Kafka. See AWS MSK for example.
RabbitMQ is recommended if you don’t have much load and you already have experience with this messaging system.
AWS SQS is a fully managed message queuing service from AWS. Useful if you plan to deploy ThingsBoard on AWS.
Google Pub/Sub is a fully managed message queuing service from Google. Useful if you plan to deploy ThingsBoard on Google Cloud.
Azure Service Bus is a fully managed message queuing service from Azure. Useful if you plan to deploy ThingsBoard on Azure.
See corresponding architecture page and rule engine page for more details.
ThingsBoard includes In Memory Queue service and use it by default without extra settings. Create docker compose file for ThingsBoard queue service:
Add the following line to the yml file:
|
Kafka InstallationApache Kafka is an open-source stream-processing software platform. Create docker compose file for ThingsBoard queue service:
Add the following line to the yml file.
|
AWS SQS ConfigurationTo access AWS SQS service, you first need to create an AWS account. To work with AWS SQS service you will need to create your next credentials using this instruction:
Create docker compose file for ThingsBoard queue service:
Add the following line to the yml file. Don’t forget to replace “YOUR_KEY”, “YOUR_SECRET” with your real AWS SQS IAM user credentials and “YOUR_REGION” with your real AWS SQS account region:
|
Google Pub/Sub ConfigurationTo access Pub/Sub service, you first need to create an Google cloud account. To work with Pub/Sub service you will need to create a project using this instruction. Create service account credentials with the role “Editor” or “Admin” using this instruction, and save json file with your service account credentials step 9 here. Create docker compose file for ThingsBoard queue service:
Add the following line to the yml file. Don’t forget to replace “YOUR_PROJECT_ID”, “YOUR_SERVICE_ACCOUNT” with your real Pub/Sub project id, and service account (it is whole data from json file):
|
Azure Service Bus ConfigurationTo access Azure Service Bus, you first need to create an Azure account. To work with Service Bus service you will need to create a Service Bus Namespace using this instruction. Create Shared Access Signature using this instruction. Create docker compose file for ThingsBoard queue service:
Add the following line to the yml file. Don’t forget to replace “YOUR_NAMESPACE_NAME” with your real Service Bus namespace name, and “YOUR_SAS_KEY_NAME”, “YOUR_SAS_KEY” with your real Service Bus credentials. Note: “YOUR_SAS_KEY_NAME” it is “SAS Policy”, “YOUR_SAS_KEY” it is “SAS Policy Primary Key”:
|
RabbitMQ InstallationFor installing RabbitMQ use this instruction. Create docker compose file for ThingsBoard queue service:
Add the following line to the yml file. Don’t forget to replace “YOUR_USERNAME” and “YOUR_PASSWORD” with your real user credentials, “localhost” and “5672” with your real RabbitMQ host and port:
|
Where:
8080:9090
- connect local port 8080 to exposed internal HTTP port 90901883:1883
- connect local port 1883 to exposed internal MQTT port 18835683:5683
- connect local port 5683 to exposed internal COAP port 5683~/.mytb-data:/data
- mounts the host’s dir ~/.mytb-data
to ThingsBoard DataBase data directory~/.mytb-logs:/var/log/thingsboard
- mounts the host’s dir ~/.mytb-logs
to ThingsBoard logs directorymytb
- friendly local name of this machinerestart: always
- automatically start ThingsBoard in case of system reboot and restart in case of failure.image: thingsboard/tb-postgres
- docker image, can be also thingsboard/tb-cassandra
or thingsboard/tb
Execute the following command to up this docker compose directly:
NOTE: For running docker compose commands you have to be in a directory with docker-compose.yml file.
docker-compose pull
docker-compose up
In order to get access to necessary resources from external IP/Host on Windows machine, please execute the following commands:
VBoxManage controlvm "default" natpf1 "tcp-port8080,tcp,,8080,,9090"
VBoxManage controlvm "default" natpf1 "tcp-port1883,tcp,,1883,,1883"
VBoxManage controlvm "default" natpf1 "tcp-port5683,tcp,,5683,,5683"
After executing this command you can open http://{your-host-ip}:9090
in you browser (for ex. http://localhost:8080
). You should see ThingsBoard login page.
Use the following default credentials:
You can always change passwords for each account in account profile page.
You can detach from session terminal with Ctrl-p
Ctrl-q
- the container will keep running in the background.
In case of any issues you can examine service logs for errors. For example to see ThingsBoard node logs execute the following command:
docker-compose logs -f mytbpe
To stop the container:
docker-compose stop
To start the container:
docker-compose start
In order to update to the latest image, open “Docker Quickstart Terminal” and execute the following commands:
$ docker pull thingsboard/tb-postgres
$ docker-compose stop
$ docker run -it -v mytb-data:/data --rm thingsboard/tb-postgres upgrade-tb.sh
$ docker rm mytb
$ docker-compose up
NOTE: if you use different database change image name in all commands from thingsboard/tb-postgres
to thingsboard/tb-cassandra
or thingsboard/tb
correspondingly.
NOTE: replace volume mytb-data
with volume used during container creation.
Note If you observe errors related to DNS issues, for example
127.0.1.1:53: cannot unmarshal DNS message
You may configure your system to use Google public DNS servers
Getting started guides - These guides provide quick overview of main ThingsBoard features. Designed to be completed in 15-30 minutes.
Connect your device - Learn how to connect devices based on your connectivity technology or solution.
Data visualization - These guides contain instructions how to configure complex ThingsBoard dashboards.
Data processing & actions - Learn how to use ThingsBoard Rule Engine.
IoT Data analytics - Learn how to use rule engine to perform basic analytics tasks.
Hardware samples - Learn how to connect various hardware platforms to ThingsBoard.
Advanced features - Learn about advanced ThingsBoard features.
Contribution and Development - Learn about contribution and development in ThingsBoard.