- Prerequisites
- Running
- Choose ThingsBoard queue service
- Detaching, stop and start commands
- Upgrading
- Troubleshooting
- Next steps
This guide will help you to install and start ThingsBoard using Docker on Linux or Mac OS.
Prerequisites
Install Docker:
Running
In this instruction thingsboard/tb-postgres image will be used. It contains a single instance of ThingsBoard with PostgreSQL database.
Running this image requires a server with at least 4GB of RAM (8GB is recommended) and minimum load (few messages per second).
Choose ThingsBoard queue service
ThingsBoard platform currently supports two type of messaging brokers for storing the messages and communication between ThingsBoard services: In-memory and Kafka-based brokers.
-
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.
-
Confluent Cloud is a fully managed streaming platform based on Kafka. Useful for a cloud agnostic deployments.
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 lines to the yml file:
|
Apache Kafka is an open-source stream-processing software platform. Create docker compose file for ThingsBoard queue service:
Add the following lines to the yml file.
|
Confluent Cloud ConfigurationTo access Confluent Cloud you should first create an account, then create a Kafka cluster and get your API Key. Create docker compose file for ThingsBoard queue service:
Add the following line to the yml file. Don’t forget to replace “CLUSTER_API_KEY”, “CLUSTER_API_SECRET” and “localhost:9092” with your real Confluent Cloud bootstrap servers:
You can update default Rule Engine queues configuration using UI. More about ThingsBoard Rule Engine queues see in documentation. |
Where:
8080:9090
- connect local port 8080 to exposed internal HTTP port 90901883:1883
- connect local port 1883 to exposed internal MQTT port 18837070:7070
- connect local port 7070 to exposed internal Edge RPC port 70705683-5688:5683-5688/udp
- connect local UDP ports 5683-5688 to exposed internal COAP and LwM2M ports~/.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 alsothingsboard/tb-cassandra
orthingsboard/tb
Before starting your Docker containers, execute the following commands to create directories for data storage and logs. These commands will also change the ownership of the newly created directories to the Docker container user.
The chown command is used to change the owner of the directories, and it requires sudo permissions. You may be prompted to enter a password to grant sudo access:
1
2
mkdir -p ~/.mytb-data && sudo chown -R 799:799 ~/.mytb-data
mkdir -p ~/.mytb-logs && sudo chown -R 799:799 ~/.mytb-logs
NOTE: Replace directory ~/.mytb-data
and ~/.mytb-logs
with directories you’re planning to use in docker-compose.yml
.
Set the terminal in the directory which contains the docker-compose.yml
file and execute the following commands to up this docker compose directly:
1
docker compose up -d && docker compose logs -f mytb
After executing this command you can open http://{your-host-ip}:8080
in your browser (for ex. http://localhost:8080
).
You should see ThingsBoard login page. Use the following default credentials:
- System Administrator: sysadmin@thingsboard.org / sysadmin
- Tenant Administrator: tenant@thingsboard.org / tenant
- Customer User: customer@thingsboard.org / customer
You can always change passwords for each account in account profile page.
Detaching, stop and start commands
You can detach from session terminal using Ctrl-p
Ctrl-q
key sequence - 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 container logs execute the following command:
1
docker compose logs -f mytb
To stop the container:
1
docker compose stop mytb
To start the container:
1
docker compose start mytb
Upgrading
In order to update to the latest image, execute the following commands:
1
2
3
4
5
docker pull thingsboard/tb-postgres
docker compose stop
docker run -it -v ~/.mytb-data:/data --rm thingsboard/tb-postgres upgrade-tb.sh
docker compose 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 host’s directory ~/.mytb-data
with directory used during container creation.
NOTE: if you have used one database and want to try another one, then remove the current docker container using docker-compose rm
command and use different directory for ~/.mytb-data
in docker-compose.yml
.
Troubleshooting
DNS issues
NOTE If you observe errors related to DNS issues, for example
1
127.0.1.1:53: cannot unmarshal DNS message
You may configure your system to use Google public DNS servers. See corresponding Linux and Mac OS instructions.
Next steps
-
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 on 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.