Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/user-guide/contribution/rule-node-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,11 @@ sudo service thingsboard restart

### UI configuration

The UI for the ThingsBoard rule nodes was configured with the help of the project that is also hosted on the official [github repo](https://github.com/thingsboard/rule-node-examples-ui). Please, refer to the following [link](https://github.com/thingsboard/rule-node-examples-ui#rule-node-examples-ui) to view how to build the project.
The ThingsBoard rule nodes UI is configured with another project in the official [github repo](https://github.com/thingsboard/rule-node-examples-ui). Please, refer to the following [link](https://github.com/thingsboard/thingsboard-rule-config-ui#thingsboard-rule-config-ui) to see build instructions.

#### Running Rule Node UI container in hot redeploy mode

To running Rule Node UI container in hot redeploy mode:
To run Rule Node UI container in hot redeploy mode:

- first you need to change constant **ruleNodeUiforwardPort** from **8080** to **5000** in file **server.js** that should be here:

Expand Down
272 changes: 272 additions & 0 deletions docs/user-guide/install/aws-marketplace-pe-upgrade-haproxy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
---
layout: docwithnav
title: Upgrading HAProxy Load Balancer for ThingsBoard PE from AWS Marketplace
description: Upgrading HAProxy Load Balancer for ThingsBoard PE from AWS Marketplace
hidetoc: "true"
---

This guide describes how to remove dockerized version of HAProxy Load Balancer and install HAProxy with Let's Encrypt
as ubuntu service for ThingsBoard Professional Edition from AWS Marketplace.

* TOC
{:toc}

#### Connect to your ThingsBoard PE AWS instance over SSH

Below is example command as a reference:

```bash
$ ssh -i <PRIVATE-KEY> ubuntu@<PUBLIC_DNS_NAME>
```

or goto EC2 instances and locate your ThingsBoard PE instance.
Then select **Actions -> Connect** and follow instructions provided in **Connect To Your Instance** dialog.

#### Remove dockerized version of HAProxy Load Balancer

Execute the following commands to remove HAProxy docker containers and docker services:

```bash
$ cd /usr/share/tb-haproxy && docker-compose down -v && cd ~
$ sudo apt-get purge -y docker-engine docker docker.io docker-ce
$ sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce
$ sudo rm -rf /var/lib/docker && sudo groupdel docker && sudo rm -rf /var/run/docker.sock
```

#### Install HAProxy Load Balancer package

Execute the following commands to install HAProxy package:

```bash
$ sudo add-apt-repository ppa:vbernat/haproxy-1.7
$ sudo apt-get update
$ sudo apt-get install haproxy openssl
```

#### Install Certbot package

Execute the following commands to install Certbot package:

```bash
$ sudo apt-get install ca-certificates certbot
```

#### Install default self-signed certificate

Execute the following commands to install default self-signed certificate:

```bash
$ cat <<EOT | sudo tee /usr/bin/haproxy-default-cert
#!/bin/sh

set -e

HA_PROXY_DIR=/usr/share/tb-haproxy
CERTS_D_DIR=\${HA_PROXY_DIR}/certs.d
TEMP_DIR=/tmp

PASSWORD=\$(openssl rand -base64 32)
SUBJ="/C=US/ST=somewhere/L=someplace/O=haproxy/OU=haproxy/CN=haproxy.selfsigned.invalid"

KEY=\${TEMP_DIR}/haproxy_key.pem
CERT=\${TEMP_DIR}/haproxy_cert.pem
CSR=\${TEMP_DIR}/haproxy.csr
DEFAULT_PEM=\${HA_PROXY_DIR}/default.pem

if [ ! -e \${HA_PROXY_DIR} ]; then
mkdir -p \${HA_PROXY_DIR}
fi

if [ ! -e \${CERTS_D_DIR} ]; then
mkdir -p \${CERTS_D_DIR}
fi


# Check if default.pem has been created
if [ ! -e \${DEFAULT_PEM} ]; then
openssl genrsa -des3 -passout pass:\${PASSWORD} -out \${KEY} 2048 &> /dev/null
sleep 1
openssl req -new -key \${KEY} -passin pass:\${PASSWORD} -out \${CSR} -subj \${SUBJ} &> /dev/null
sleep 1
cp \${KEY} \${KEY}.org &> /dev/null
openssl rsa -in \${KEY}.org -passin pass:\${PASSWORD} -out \${KEY} &> /dev/null
sleep 1
openssl x509 -req -days 3650 -in \${CSR} -signkey \${KEY} -out \${CERT} &> /dev/null
sleep 1
cat \${CERT} \${KEY} > \${DEFAULT_PEM}
echo \${PASSWORD} > \${HA_PROXY_DIR}/password.txt
fi
EOT
```

```bash
$ sudo chmod +x /usr/bin/haproxy-default-cert
$ sudo haproxy-default-cert
```

#### Configure HAProxy Load Balancer

Execute the following command to create HAProxy Load Balancer configuration file:

```bash
$ cat <<EOT | sudo tee /etc/haproxy/haproxy.cfg
#HA Proxy Config
global
ulimit-n 500000
maxconn 99999
maxpipes 99999
tune.maxaccept 500

log 127.0.0.1 local0
log 127.0.0.1 local1 notice

ca-base /etc/ssl/certs
crt-base /etc/ssl/private

ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
ssl-default-bind-options no-sslv3

defaults

log global

mode http

timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
timeout tunnel 1h # timeout to use with WebSocket and CONNECT

default-server init-addr none

listen stats
bind *:9999
stats enable
stats hide-version
stats uri /stats
stats auth admin:admin@123

frontend http-in
bind *:80

option forwardfor

reqadd X-Forwarded-Proto:\ http

acl letsencrypt_http_acl path_beg /.well-known/acme-challenge/

redirect scheme https if !letsencrypt_http_acl { env(FORCE_HTTPS_REDIRECT) -m str true }

use_backend letsencrypt_http if letsencrypt_http_acl

default_backend tb-backend

frontend https_in
bind *:443 ssl crt /usr/share/tb-haproxy/default.pem crt /usr/share/tb-haproxy/certs.d/ ciphers ECDHE-RSA-AES256-SHA:RC4-SHA:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM

option forwardfor

reqadd X-Forwarded-Proto:\ https

default_backend tb-backend

backend letsencrypt_http
server letsencrypt_http_srv 127.0.0.1:8090

backend tb-backend
balance leastconn
option tcp-check
option log-health-checks
server tb1 127.0.0.1:8080 check inter 5s
http-request set-header X-Forwarded-Port %[dst_port]
EOT
```

#### Configure Certbot with Let’s Encrypt

Execute the following commands to create Certbot with Let’s Encrypt configuration and helper files:

```bash
$ sudo mkdir -p /usr/local/etc/letsencrypt \
&& sudo mkdir -p /usr/share/tb-haproxy/letsencrypt \
&& sudo rm -rf /etc/letsencrypt \
&& sudo ln -s /usr/share/tb-haproxy/letsencrypt /etc/letsencrypt
```

```bash
$ cat <<EOT | sudo tee /usr/local/etc/letsencrypt/cli.ini
authenticator = standalone
agree-tos = True
http-01-port = 8090
tls-sni-01-port = 8443
non-interactive = True
preferred-challenges = http-01
EOT
```

```bash
$ cat <<EOT | sudo tee /usr/bin/haproxy-refresh
#!/bin/sh

HA_PROXY_DIR=/usr/share/tb-haproxy
LE_DIR=/usr/share/tb-haproxy/letsencrypt/live
DOMAINS=\$(ls \${LE_DIR})

# update certs for HA Proxy
for DOMAIN in \${DOMAINS}
do
cat \${LE_DIR}/\${DOMAIN}/fullchain.pem \${LE_DIR}/\${DOMAIN}/privkey.pem > \${HA_PROXY_DIR}/certs.d/\${DOMAIN}.pem
done

# restart haproxy
exec service haproxy restart
EOT
```

```bash
$ cat <<EOT | sudo tee /usr/bin/certbot-certonly
#!/bin/sh

/usr/bin/certbot certonly -c /usr/local/etc/letsencrypt/cli.ini "\$@"
EOT
```

```bash
$ cat <<EOT | sudo tee /usr/bin/certbot-renew
#!/bin/sh

/usr/bin/certbot -c /usr/local/etc/letsencrypt/cli.ini renew "\$@"
EOT
```

```bash
$ sudo chmod +x /usr/bin/haproxy-refresh /usr/bin/certbot-certonly /usr/bin/certbot-renew
```

#### Install certificates auto renewal cron job

Execute the following command to create certificates auto renewal cron job:

```bash
$ cat <<EOT | sudo tee /etc/cron.d/certbot
# /etc/cron.d/certbot: crontab entries for the certbot package
#
# Upstream recommends attempting renewal twice a day
#
# Eventually, this will be an opportunity to validate certificates
# haven't been revoked, etc. Renewal will only occur if expiration
# is within 30 days.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

0 */12 * * * root test -x /usr/bin/certbot && perl -e 'sleep int(rand(3600))' && certbot -c /usr/local/etc/letsencrypt/cli.ini -q renew && haproxy-refresh
EOT
```

#### Restart HAProxy Load Balancer

Finally restart HAProxy Load Balancer service in order changes take effect:

```bash
$ sudo service haproxy restart
```
18 changes: 11 additions & 7 deletions docs/user-guide/install/linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,20 @@ To run ThingsBoard and third-party components on a single machine you will need
#### Java

ThingsBoard service is running on Java 8.
Although you are able to start the service using [OpenJDK](http://openjdk.java.net/),
the solution is actively tested on [Oracle JDK](http://www.oracle.com/technetwork/java/javase/overview/index.html).
The solution is actively tested on both [OpenJDK](http://openjdk.java.net/) and [Oracle JDK](http://www.oracle.com/technetwork/java/javase/overview/index.html).

Follow this instructions to install Oracle JDK 8:
Follow this instructions to install OpenJDK 8:

- [Ubuntu 16.04](https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04#installing-the-oracle-jdk)
- [CentOS 7](https://www.digitalocean.com/community/tutorials/how-to-install-java-on-centos-and-fedora#install-oracle-java-8)
{% capture tabspec %}java-installation
A,Ubuntu,shell,resources/java-ubuntu-installation.sh,/docs/user-guide/install/resources/java-ubuntu-installation.sh
B,CentOS,shell,resources/java-centos-installation.sh,/docs/user-guide/install/resources/java-centos-installation.sh{% endcapture %}
{% include tabs.html %}

Please don't forget to configure your operating system to use OpenJDK 8 by default.
See corresponding instructions:

Please don't forget to configure your operating system to use Oracle JDK 8 by default.
Corresponding instructions are in the same articles listed above.
- [Ubuntu](https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04#managing-java)
- [CentOS](https://www.digitalocean.com/community/tutorials/how-to-install-java-on-centos-and-fedora#set-default-java)


#### External database installation
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sudo yum install java-1.8.0-openjdk
2 changes: 2 additions & 0 deletions docs/user-guide/install/resources/java-ubuntu-installation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sudo apt update
sudo apt install openjdk-8-jdk
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Let’s assume the following use case:
<tbody>
<tr>
<td>
<p>Turning the Rotating System to the left or to the right is based on which way is better and faster so that the difference between the direction of the wind and the wind turbine has to be not more than 5 degrees.</p>
<p>Turning the Rotating System to the left or to the right is based on which way is better and faster so that the angle between the direction of the wind and the wind turbine has to be no more than 5 degrees.</p>
</td>
</tr>
</tbody>
Expand Down
Binary file added images/customers/bertil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/customers/iioote.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions industries/smart-city.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,32 @@ description:
</div>
</div>
</div>

<div class="customer-block">
<a href="https://www.iioote.com/">
<div class="customer-logo">
<img width="" src="/images/customers/iioote.png" alt="iiOOTE AB">
</div>
</a>
<div class="customer-content">
<h3 id="iioote">
iiOOTE AB
</h3>
<h4>
iiOOTE is an independent systems integrator with deep knowledge and broad international network in the IoT LPWAN ecosystem.
</h4>
<p>
During our evaluation of several different IoT platforms we decided using ThingsBoard Community Edition to quickly get started with testing of our concept solutions. Since it offers an easy way to get access to data from all our sensors and supports building dashboards for visualization.
</p>
<p>
However, we soon discovered that ThingsBoard also fulfilled our need to build commercial services. With increasing number of sensors, customers and requirements we have migrated to ThingsBoard Professional Edition with a lot more functionality for larger deployments and multiple customers. And we will add additional servers as our customers grow.
</p>
<div class="person-logo-container">
<img class="person-logo" src="/images/customers/bertil.png"/>
<div class="person-title">
Bertil Moberg <br/>
Co-Founder & Head of IoT Solutions
</div>
</div>
</div>
</div>
16 changes: 8 additions & 8 deletions products/thingsboard-pe/aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ description:
Step 2. Assign valid domain name system (DNS) record to your external IP address for first step.<br/>
Step 3. Connect to your instance using SSH or PuTTY using instructions from the previous questions above.<br/>
Step 4. Execute the following commands:<br/><br/>
&nbsp;&nbsp;&nbsp;&nbsp;docker exec haproxy-certbot certbot-certonly --domain <b>smth.yourcompany.com</b> --email <b>support@yourcompany.com</b><br/>
&nbsp;&nbsp;&nbsp;&nbsp;docker exec haproxy-certbot haproxy-refresh<br/><br/>
&nbsp;&nbsp;&nbsp;&nbsp;sudo certbot-certonly --domain <b>smth.yourcompany.com</b> --email <b>support@yourcompany.com</b><br/>
&nbsp;&nbsp;&nbsp;&nbsp;sudo haproxy-refresh<br/><br/>
where <b>smth.yourcompany.com</b> is your DNS name from the second step<br/>
and <b>support@yourcompany.com</b> is your email to get notifications from <a href="https://certbot.eff.org/">certbot</a>.
</p>
Expand Down Expand Up @@ -268,14 +268,14 @@ description:
<p>
Let's assume your number of devices is constantly growing and you decide to upgrade to new instance type.
It is relatively easy to upgrade while you plan to use the same database type. Just execute the following steps:<br/><br/>
&nbsp;&nbsp;&nbsp;&nbsp;1) stop your isntance and backup your database<br/>
&nbsp;&nbsp;&nbsp;&nbsp;2) start new subscription with new instance type<br/>
&nbsp;&nbsp;&nbsp;&nbsp;3) restore the databacse backup on the instance with new subscription<br/>
&nbsp;&nbsp;&nbsp;&nbsp;1) stop your instance and backup your database<br/>
&nbsp;&nbsp;&nbsp;&nbsp;2) start a new subscription with a new instance type<br/>
&nbsp;&nbsp;&nbsp;&nbsp;3) restore the database backup on the instance with a new subscription<br/>
&nbsp;&nbsp;&nbsp;&nbsp;4) ensure everything is working as expected<br/>
&nbsp;&nbsp;&nbsp;&nbsp;5) cancel old subscription if needed<br/><br/>
However, if you plan to upgrade from PostgreSQL to Cassandra this may become a chellange.
ThingsBoard team is planning to have a tool for this purpose but the release is schedule for the end of 2019.
So, we recommend to maintain the same database type or consider hybrid database approach.
However, if you plan to upgrade from PostgreSQL to Cassandra this may become a challenge.
ThingsBoard team is planning to have a tool for this purpose but the release is scheduled for the end of 2019.
So, we recommend to maintain the same database type or consider a hybrid database approach.
</p>
</div>
</div>
Expand Down