Installation from sources
To install ThingsBoard Gateway from sources, you should follow steps below:
1. Install required libraries to the system with apt:
1
sudo apt install python3-dev python3-pip python3-venv libglib2.0-dev git
2. Download repository from GitHub:
1
git clone --recurse-submodules https://github.com/thingsboard/thingsboard-gateway.git --depth 1
3. Move into downloaded directory:
1
cd thingsboard-gateway
4. Create and activate virtual environment:
1
python3 -m venv venv && source venv/bin/activate
5. Install python requirements:
1
pip install -r requirements.txt
6. Install the library:
1
python setup.py install
7. Create “logs” folder:
1
mkdir logs
8. Configure the gateway to work with your instance of the ThingsBoard platform: change the “host” and “accessToken” to your values in a tb_gateway.json configuration file. You can find a description of this file in the IoT Gateway Configuration guide.
The tb_gateway.json file is located in the config folder:
1
thingsboard-gateway/thingsboard_gateway/config
9. Run gateway, to check installation result:
1
python3 ./thingsboard_gateway/tb_gateway.py
Build local docker image
In order to build local docker image, follow the next steps:
1. Copy Dockerfile to root folder, using the following command:
1
cp docker/Dockerfile .
2. From project root folder execute the following command:
1
docker build -t local-gateway .
Hot Reloader
If you are using Gateway for development, you can enable Hot Reloader to restart Gateway every time when you edit any project file.
To run Gateway with Hot Reloader, use the following command:
1
python3 ./thingsboard_gateway/tb_gateway.py true