Commit f4fe6663b928cd1a941504b1bc15bb3147369ccc
1 parent
8287f972
MSA docker: Configurable HTTP to HTTPS redirect. Update docker instructions.
Showing
6 changed files
with
60 additions
and
9 deletions
@@ -13,6 +13,6 @@ TB_VERSION=latest | @@ -13,6 +13,6 @@ TB_VERSION=latest | ||
13 | # Database used by ThingsBoard, can be either local (local HSQLDB), postgres (PostgreSQL), cassandra (Cassandra). | 13 | # Database used by ThingsBoard, can be either local (local HSQLDB), postgres (PostgreSQL), cassandra (Cassandra). |
14 | # In case of postgres or cassandra corresponding docker service will be deployed (see docker-compose.postgres.yml, docker-compose.cassandra.yml for details). | 14 | # In case of postgres or cassandra corresponding docker service will be deployed (see docker-compose.postgres.yml, docker-compose.cassandra.yml for details). |
15 | 15 | ||
16 | -DATABASE=cassandra | 16 | +DATABASE=local |
17 | 17 | ||
18 | KAFKA_TOPICS="js.eval.requests:100:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb.transport.api.requests:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb.rule-engine:30:1" | 18 | KAFKA_TOPICS="js.eval.requests:100:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb.transport.api.requests:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb.rule-engine:30:1" |
@@ -2,24 +2,63 @@ | @@ -2,24 +2,63 @@ | ||
2 | 2 | ||
3 | This folder containing scripts and Docker Compose configurations to run ThingsBoard in Microservices mode. | 3 | This folder containing scripts and Docker Compose configurations to run ThingsBoard in Microservices mode. |
4 | 4 | ||
5 | +## Prerequisites | ||
6 | + | ||
7 | +ThingsBoard Microservices are running in dockerized environment. | ||
8 | +Before starting please make sure [Docker CE](https://docs.docker.com/install/) and [Docker Compose](https://docs.docker.com/compose/install/) are installed in your system. | ||
9 | + | ||
5 | ## Installation | 10 | ## Installation |
6 | 11 | ||
7 | -Execute the following command to run DataBase installation: | 12 | +Before performing initial installation you can configure the type of database to be used with ThinsBoard. |
13 | +In order to set database type change the value of `DATABASE` variable in `.env` file to one of the following: | ||
14 | + | ||
15 | +- `local` - use local embedded HSQLDB database; | ||
16 | +- `postgres` - use PostgreSQL database; | ||
17 | +- `cassandra` - use Cassandra database; | ||
18 | + | ||
19 | +**NOTE**: In case of `postgres` or `cassandra` corresponding docker service will be deployed (see `docker-compose.postgres.yml`, `docker-compose.cassandra.yml` for details). | ||
20 | + | ||
21 | +Execute the following command to run installation: | ||
8 | 22 | ||
9 | ` | 23 | ` |
10 | $ ./docker-install-tb.sh --loadDemo | 24 | $ ./docker-install-tb.sh --loadDemo |
11 | ` | 25 | ` |
12 | 26 | ||
13 | -- `--loadDemo` - optional argument. Whether to load additional demo data. | 27 | +Where: |
28 | + | ||
29 | +- `--loadDemo` - optional argument. Whether to load additional demo data. | ||
14 | 30 | ||
15 | ## Running | 31 | ## Running |
16 | 32 | ||
17 | -Execute the following command to run services: | 33 | +Execute the following command to start services: |
18 | 34 | ||
19 | ` | 35 | ` |
20 | $ ./docker-start-services.sh | 36 | $ ./docker-start-services.sh |
21 | ` | 37 | ` |
22 | 38 | ||
39 | +After a while when all services will be successfully started you can open `http://{yor-host-ip}` in you browser (for ex. `http://localhost`). | ||
40 | +You should see ThingsBoard login page. | ||
41 | + | ||
42 | +Use the following default credentials: | ||
43 | + | ||
44 | +- **Systen Administrator**: sysadmin@thingsboard.org / sysadmin | ||
45 | + | ||
46 | +If you installed DataBase with demo data (using `--loadDemo` flag) you can also use the following credentials: | ||
47 | + | ||
48 | +- **Tenant Administrator**: tenant@thingsboard.org / tenant | ||
49 | +- **Customer User**: customer@thingsboard.org / customer | ||
50 | + | ||
51 | +In case of any issues you can examine service logs for errors. | ||
52 | +For example to see ThingsBoard node logs execute the following command: | ||
53 | + | ||
54 | +` | ||
55 | +$ docker-compose logs -f tb | ||
56 | +` | ||
57 | + | ||
58 | +Or use `docker-compose ps` to see the state of all the containers. | ||
59 | +Use `docker-compose logs --f` to inspect the logs of all running services. | ||
60 | +See [docker-compose logs](https://docs.docker.com/compose/reference/logs/) command reference for details. | ||
61 | + | ||
23 | Execute the following command to stop services: | 62 | Execute the following command to stop services: |
24 | 63 | ||
25 | ` | 64 | ` |
@@ -32,12 +71,16 @@ Execute the following command to stop and completely remove deployed docker cont | @@ -32,12 +71,16 @@ Execute the following command to stop and completely remove deployed docker cont | ||
32 | $ ./docker-remove-services.sh | 71 | $ ./docker-remove-services.sh |
33 | ` | 72 | ` |
34 | 73 | ||
35 | -Execute the following command to update particular services (pull newer docker image and rebuild container): | 74 | +Execute the following command to update particular or all services (pull newer docker image and rebuild container): |
36 | 75 | ||
37 | ` | 76 | ` |
38 | $ ./docker-update-service.sh [SERVICE...] | 77 | $ ./docker-update-service.sh [SERVICE...] |
39 | ` | 78 | ` |
40 | 79 | ||
80 | +Where: | ||
81 | + | ||
82 | +- `[SERVICE...]` - list of services to update (defined in docker-compose configurations). If not specified all services will be updated. | ||
83 | + | ||
41 | ## Upgrading | 84 | ## Upgrading |
42 | 85 | ||
43 | In case when database upgrade is needed, execute the following commands: | 86 | In case when database upgrade is needed, execute the following commands: |
@@ -48,4 +91,6 @@ $ ./docker-upgrade-tb.sh --fromVersion=[FROM_VERSION] | @@ -48,4 +91,6 @@ $ ./docker-upgrade-tb.sh --fromVersion=[FROM_VERSION] | ||
48 | $ ./docker-start-services.sh | 91 | $ ./docker-start-services.sh |
49 | ``` | 92 | ``` |
50 | 93 | ||
51 | -- `FROM_VERSION` - from which version upgrade should be started. | 94 | +Where: |
95 | + | ||
96 | +- `FROM_VERSION` - from which version upgrade should be started. See [Upgrade Instructions](https://thingsboard.io/docs/user-guide/install/upgrade-instructions) for valid `fromVersion` values. |
@@ -171,6 +171,7 @@ services: | @@ -171,6 +171,7 @@ services: | ||
171 | HTTP_PORT: 80 | 171 | HTTP_PORT: 80 |
172 | HTTPS_PORT: 443 | 172 | HTTPS_PORT: 443 |
173 | MQTT_PORT: 1883 | 173 | MQTT_PORT: 1883 |
174 | + FORCE_HTTPS_REDIRECT: "false" | ||
174 | links: | 175 | links: |
175 | - tb-web-ui1 | 176 | - tb-web-ui1 |
176 | - tb-web-ui2 | 177 | - tb-web-ui2 |
@@ -46,6 +46,8 @@ ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $? | @@ -46,6 +46,8 @@ ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $? | ||
46 | 46 | ||
47 | ADDITIONAL_STARTUP_SERVICES=$(additionalStartupServices) || exit $? | 47 | ADDITIONAL_STARTUP_SERVICES=$(additionalStartupServices) || exit $? |
48 | 48 | ||
49 | +docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS pull tb | ||
50 | + | ||
49 | if [ ! -z "${ADDITIONAL_STARTUP_SERVICES// }" ]; then | 51 | if [ ! -z "${ADDITIONAL_STARTUP_SERVICES// }" ]; then |
50 | docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS up -d $ADDITIONAL_STARTUP_SERVICES | 52 | docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS up -d $ADDITIONAL_STARTUP_SERVICES |
51 | fi | 53 | fi |
@@ -51,7 +51,7 @@ frontend http-in | @@ -51,7 +51,7 @@ frontend http-in | ||
51 | 51 | ||
52 | acl transport_http_acl path_beg /api/v1/ | 52 | acl transport_http_acl path_beg /api/v1/ |
53 | acl letsencrypt_http_acl path_beg /.well-known/acme-challenge/ | 53 | acl letsencrypt_http_acl path_beg /.well-known/acme-challenge/ |
54 | - redirect scheme https if !letsencrypt_http_acl !transport_http_acl | 54 | + redirect scheme https if !letsencrypt_http_acl !transport_http_acl { env(FORCE_HTTPS_REDIRECT) -m str true } |
55 | use_backend letsencrypt_http if letsencrypt_http_acl | 55 | use_backend letsencrypt_http if letsencrypt_http_acl |
56 | use_backend tb-http-backend if transport_http_acl | 56 | use_backend tb-http-backend if transport_http_acl |
57 | 57 |
@@ -8,6 +8,7 @@ This project provides the build for the ThingsBoard single docker images. | @@ -8,6 +8,7 @@ This project provides the build for the ThingsBoard single docker images. | ||
8 | 8 | ||
9 | ## Running | 9 | ## Running |
10 | 10 | ||
11 | +In this example `thingsboard/tb` image will be used. You can choose any other images with different databases (see above). | ||
11 | Execute the following command to run this docker directly: | 12 | Execute the following command to run this docker directly: |
12 | 13 | ||
13 | ` | 14 | ` |
@@ -23,9 +24,9 @@ Where: | @@ -23,9 +24,9 @@ Where: | ||
23 | - `-p 5683:5683` - connect local port 5683 to exposed internal COAP port 5683 | 24 | - `-p 5683:5683` - connect local port 5683 to exposed internal COAP port 5683 |
24 | - `-v ~/.mytb-data:/data` - mounts the host's dir `~/.mytb-data` to ThingsBoard DataBase data directory | 25 | - `-v ~/.mytb-data:/data` - mounts the host's dir `~/.mytb-data` to ThingsBoard DataBase data directory |
25 | - `--name mytb` - friendly local name of this machine | 26 | - `--name mytb` - friendly local name of this machine |
26 | -- `thingsboard/tb` - docker image | 27 | +- `thingsboard/tb` - docker image, can be also `thingsboard/tb-postgres` or `thingsboard/tb-cassandra` |
27 | 28 | ||
28 | -After executing this command you can open `http://{yor-host-ip}:9090` in you browser. You should see ThingsBoard login page. | 29 | +After executing this command you can open `http://{yor-host-ip}:9090` in you browser (for ex. `http://localhost:9090`). You should see ThingsBoard login page. |
29 | Use the following default credentials: | 30 | Use the following default credentials: |
30 | 31 | ||
31 | - **Systen Administrator**: sysadmin@thingsboard.org / sysadmin | 32 | - **Systen Administrator**: sysadmin@thingsboard.org / sysadmin |
@@ -65,4 +66,6 @@ $ docker run -it -v ~/.mytb-data:/data --rm thingsboard/tb upgrade-tb.sh | @@ -65,4 +66,6 @@ $ docker run -it -v ~/.mytb-data:/data --rm thingsboard/tb upgrade-tb.sh | ||
65 | $ docker start mytb | 66 | $ docker start mytb |
66 | ``` | 67 | ``` |
67 | 68 | ||
69 | +**NOTE**: if you use different database change image name in all commands from `thingsboard/tb` to `thingsboard/tb-postgres` or `thingsboard/tb-cassandra` correspondingly. | ||
70 | + | ||
68 | **NOTE**: replace host's directory `~/.mytb-data` with directory used during container creation. | 71 | **NOTE**: replace host's directory `~/.mytb-data` with directory used during container creation. |