Following our article on the presentation of the Thingsboard IoT platform, we will now see how to install Thingsboard CE on a server via Docker
Thingsboard CE via Docker
Here are the instructions for installing Thingsboard via Docker. If you are interested in this method, but you do not yet have a Docker server, you can refer to our tutorial: Docker installation tutorial
Please note, this method uses the Docker Compose extension . If you don't have it installed, you can follow these instructions.
Different types of Docker images for Thingsboard
Depending on the database used, there are three types of ThingsBoard single-instance Docker images:
-
Thingsboard/tb-postgres - Single instance of ThingsBoard with PostgreSQL database.
Recommended option for small servers with at least 1 GB of RAM and minimal load (a few messages per second). 2 to 4 GB is recommended.
-
Thingsboard/tb-cassandra - Single instance of ThingsBoard with Cassandra database.
The best performing and recommended option, but requires at least 4 GB of RAM. 8 GB is recommended.
-
Thingsboard/tb - Single ThingsBoard instance with embedded HSQLDB database.
Note : Not recommended for any evaluation or production use and is used for development and automated testing purposes only.
Choose the ThingsBoard Queue Service
ThingsBoard is capable of using various queuing systems to store messages and communication between ThingsBoard services.
There are several queuing services, which you can view here
In this tutorial, we will use the Kafka queue service with a Postgres database
Docker Compose YML file
In order to create Docker containers in a Stack to run Thingsboard, you must edit a docker-compose.yml file in which we will indicate the installation characteristics.
To create this file, use your favorite Linux editor, Vim or Nano for example
nano docker-compose.yml
In the editor, you can paste the code below, adapting it to your needs:
https://pastecode.io/s/ckuy6wnr
Options to modify according to your needs (optional, Thingsboard will work with the default options if the mentioned ports are available on your infrastructure):
8080:9090 - connect local port 8080 to exposed internal HTTP port 9090
1883:1883 - connect local port 1883 to exposed internal MQTT port 1883
7070:7070 - connect local port 7070 to exposed internal RPC Edge port 7070
5683-5688:5683-5688/udp - connect local UDP ports 5683-5688 to exposed internal COAP and LwM2M ports
~/.mytb-data:/data - mounts the host directory ~/.mytb-data into the ThingsBoard DataBase data directory
~/.mytb-logs:/var/log/thingsboard - mounts the host directory ~/.mytb-logs to the ThingsBoard logs directory
mytb - friendly local name of this machine
reboot: Always - automatically starts ThingsBoard on system reboot and restarts on failure.
image : Thingsboard/tb-postgres - docker image, can also be Thingsboard/tb-cassandra or Thingsboard/tb
Save the .yml file and it will be time to create the folders mentioned in the file (you must therefore adapt the commands below if you have indicated custom paths in the file).
Create Thingsboard directories
mkdir -p ~/.mytb-data && sudo chown -R 799:799 ~/.mytb-data
mkdir -p ~/.mytb-logs && sudo chown -R 799:799 ~/.mytb-logs
NOTE: Replace the ~/.mytb-data and ~/.mytb-logs directories with the directories you plan to use in docker-compose.yml.
Once that's done, it's time to deploy the stack.
Launch Thingsboard
Here are the commands to launch Thingsboard.
docker-compose pull
docker-compose up
After running this command, you can open http://{your-host-ip}:8080 in your browser (e.g. http://localhost:8080). You should see the 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 the account profile page.
Unpin, restart and stop
You can detach from the session terminal with Ctrl-p Ctrl-q - the container will continue to run in the background.
If something goes wrong, you can review the service logs for errors. For example, to view logs from ThingsBoard nodes, run the following command:
docker-compose logs -f mytb
To start :
docker-compose stop
To stop the container:
docker-compose start
Update and more
To update the container and to carry out other actions, you can refer to the official instructions.
Do you need a machine to create a server?
We provide ruggedized mini PCs which, thanks to their characteristics, can be suitable for this type of use.
View the products listed in our shop by clicking below:
Our pre-sales team is available to answer your questions and guide you through your projects.
You can contact us directly, we can define a tailor-made solution and equipment with you thanks to our network of partners.
Contact form
sales@sparwan.com
02 51 99 13 03