Skip to content

Commit 3ef1903

Browse files
stitenkoashvayka
authored andcommitted
Updated Building from source guide
1 parent 7ef90bb commit 3ef1903

1 file changed

Lines changed: 80 additions & 31 deletions

File tree

docs/user-guide/install/building-from-source.md

Lines changed: 80 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,44 +10,61 @@ description: Building ThingsBoard IoT platform from sources
1010
* TOC
1111
{:toc}
1212

13-
This guide will help you to download and build ThingsBoard from sources. Instructions listed below are tested on Ubuntu 24.04 LTS
14-
and CentOS 8/9
13+
This guide will help you to download and build ThingsBoard from source code.
14+
15+
Instructions listed below are tested on Ubuntu 24.04 LTS and CentOS 8/9.
16+
17+
<hr>
1518

1619
## Required tools
1720

1821
This section contains installation instructions for build tools.
1922

20-
### Java
23+
<b><font size="4">Java</font></b>
24+
ThingsBoard is built using **Java 17**.
25+
26+
Install Java 17 using these instructions:
27+
28+
- [Install Java 17 on Ubuntu](/docs/user-guide/install/ubuntu/#step-1-install-java-17-openjdk){:target="_blank"}
2129

22-
ThingsBoard is built using Java 17. You can use [following instructions](/docs/user-guide/install/ubuntu/#step-1-install-java-17-openjdk) to install Java 17.
30+
Verify the installation:
2331

24-
### Maven
32+
```bash
33+
java -version
34+
```
35+
{: .copy-code}
2536

26-
ThingsBoard build requires Maven 3.1.0+.
37+
<b><font size="4">Maven</font></b>
38+
ThingsBoard requires Maven 3.1.0 or newer.
2739

2840
{% capture tabspec %}maven-installation
2941
A,Ubuntu,shell,resources/maven-ubuntu-installation.sh,/docs/user-guide/install/resources/maven-ubuntu-installation.sh
3042
B,CentOS,shell,resources/maven-centos-installation.sh,/docs/user-guide/install/resources/maven-centos-installation.sh{% endcapture %}
3143
{% include tabs.html %}
3244

33-
**Please note** that Maven installation may set Java 7 as a default JVM on certain Linux machines.
34-
Use Java installation [instructions](#java) to fix this.
45+
> Note: On certain Linux machines, Maven installation may set Java 7 as the default JVM. If this happens, reconfigure your system to use Java 17.
46+
47+
<hr>
3548

3649
## Source code
3750

38-
{% capture windows_line_endings %}
39-
**NOTE: Building Docker image on Windows machine**
51+
{% capture difference %}
52+
**Important:** Building Docker images on Windows requires **LF** line endings.
53+
54+
To build Docker image, certain scripts, configuration files and sources that will be a part of the Docker image must have **LF** line endings.
4055

41-
To build Docker image, certain scripts, configuration files and sources that will be a part of the Docker image must have **LF** line endings.
42-
So before cloning the repo set to _input_ the Git [core.autocrlf](https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreautocrlf) configuration option.
56+
So before cloning the repo set to _input_ the Git [core.autocrlf](https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreautocrlf){:target="_blank"} configuration option.
4357

4458
For example, to set *core.autocrlf* globally:
4559

4660
`git config --global core.autocrlf input`{:.language-bash}
61+
62+
Failing to do so may cause runtime errors when running Docker images.
63+
4764
{% endcapture %}
48-
{% include templates/warn-banner.md content=windows_line_endings %}
65+
{% include templates/info-banner.md content=difference %}
4966

50-
You can clone source code of the project from the official [github repo](https://github.com/thingsboard/thingsboard).
67+
Clone the [ThingsBoard repository](https://github.com/thingsboard/thingsboard){:target="_blank"} from GitHub:
5168

5269
```bash
5370
# checkout latest release branch
@@ -56,53 +73,76 @@ cd thingsboard
5673
```
5774
{: .copy-code}
5875

59-
## Build
76+
<hr>
77+
78+
## Build the Project
6079

61-
Run the following command from the ThingsBoard folder to build the project:
80+
From the project root directory, run:
6281

6382
```bash
6483
mvn clean install -DskipTests
6584
```
6685
{: .copy-code}
6786

68-
## Build local Docker images
87+
This command:
88+
- build the project:
89+
- skips unit and integration tests
90+
- produces installation artifacts
91+
92+
## Build local Docker images (Optional)
6993

70-
{% include templates/warn-banner.md content=windows_line_endings %}
94+
{% include templates/info-banner.md content=difference %}
7195

72-
Make sure that [Docker](https://docs.docker.com/engine/install/) is installed.
96+
To build local Docker images for ThingsBoard services, ensure [Docker](https://docs.docker.com/engine/install/){:target="_blank"} is installed.
7397

98+
Then run:
7499
```bash
75100
mvn clean install -DskipTests -Ddockerfile.skip=false
76101
```
77102
{: .copy-code}
78103

104+
Docker images can be listed using:
105+
106+
```bash
107+
docker images
108+
```
109+
{: .copy-code}
110+
79111
## Build artifacts
80112

81-
You can find debian, rpm and windows packages in the target folder:
113+
After a successful build, installation packages are available in:
82114

83115
```bash
84116
application/target
85117
```
86118
{: .copy-code}
87119

88-
## Running tests
120+
This directory contains:
121+
- <span class="code-light">.deb</span> packages for Debian/Ubuntu
122+
- <span class="code-light">.rpm</span> packages for CentOS/RHEL
123+
- Windows installation packages
89124

90-
We are using [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/) to run all kinds of integration and [black-box tests](https://github.com/thingsboard/thingsboard/tree/master/msa/black-box-tests).
125+
## Running tests (Optional)
91126

92-
Please, manage [Docker as a non-root user](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) to run tests properly.
127+
This requires [Docker](https://docs.docker.com/engine/install/){:target="_blank"} and [Docker Compose](https://docs.docker.com/compose/install/){:target="_blank"}. Make sure [Docker is configured to run as a non-root user](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user){:target="_blank"}.
93128

94-
Master and release branches are already tested, so you can skip tests and avoid installing Docker as well.
129+
> **Note:** Master and release branches are already tested, so you can skip tests and avoid installing Docker as well.
95130
96-
Run all unit and integration tests:
131+
<b><font size="4">Unit and integration tests</font></b>
97132

133+
Run all unit and integration tests:
98134
```bash
99135
mvn clean install
100136
```
101137
{: .copy-code}
102138

103-
To run black-box tests, please refer [black-box tests readme](https://github.com/thingsboard/thingsboard/blob/master/msa/black-box-tests/README.md).
139+
<b><font size="4">Black-box tests</font></b>
104140

105-
Estimated time is about 1 hour on AMD Ryzen 5 3600 (6-cores), 32GB DDR4, fancy SSD and shiny weather. Actual time may vary and depends on particular hardware performance.
141+
Black-box tests are located in [https://github.com/thingsboard/thingsboard/tree/master/msa/black-box-tests](https://github.com/thingsboard/thingsboard/tree/master/msa/black-box-tests){:target="_blank"}
142+
143+
Follow the instructions in the corresponding [README](https://github.com/thingsboard/thingsboard/blob/master/msa/black-box-tests/README.md){:target="_blank"} to execute them.
144+
145+
> Estimated runtime is approximately 1 hour, depending on hardware performance.
106146
107147
## Tips and tricks
108148

@@ -134,12 +174,21 @@ Here are some tips and tricks to boost build experience:
134174
```
135175
{: .copy-code}
136176

137-
## Build and runtime errors
177+
## Common build and runtime errors
178+
179+
<b><font size="4">Docker runtime error</font></b>
138180

139-
- If you see such errors when running locally-built Docker image, re-clone the repo with **LF** [file ending](https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreautocrlf) and re-build the image.
140-
To fix this read [Source code](#source-code) section.
181+
If you see the following error when running a locally built Docker image:
141182

142183
```bash
143184
Standard_init_linux.go:175 exec user process caused no such file
144185
```
145-
{: .copy-code}
186+
187+
This usually indicates incorrect [line endings](https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreautocrlf){:target="_blank"}.
188+
189+
<b><font size="3">Solution:</font></b>
190+
- Reconfigure Git to use LF line endings
191+
- Re-clone the repository
192+
- Rebuild the Docker images
193+
194+
Refer to the [Source code](#source-code) section above for details.

0 commit comments

Comments
 (0)