MSA docker: Configurable HTTP to HTTPS redirect. Update docker instructions.

This commit is contained in:
Igor Kulikov 2018-10-25 12:34:02 +03:00
parent 8287f972ae
commit f4fe6663b9
6 changed files with 60 additions and 9 deletions

View File

@ -13,6 +13,6 @@ TB_VERSION=latest
# Database used by ThingsBoard, can be either local (local HSQLDB), postgres (PostgreSQL), cassandra (Cassandra). # Database used by ThingsBoard, can be either local (local HSQLDB), postgres (PostgreSQL), cassandra (Cassandra).
# In case of postgres or cassandra corresponding docker service will be deployed (see docker-compose.postgres.yml, docker-compose.cassandra.yml for details). # In case of postgres or cassandra corresponding docker service will be deployed (see docker-compose.postgres.yml, docker-compose.cassandra.yml for details).
DATABASE=cassandra DATABASE=local
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" 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"

View File

@ -2,24 +2,63 @@
This folder containing scripts and Docker Compose configurations to run ThingsBoard in Microservices mode. This folder containing scripts and Docker Compose configurations to run ThingsBoard in Microservices mode.
## Prerequisites
ThingsBoard Microservices are running in dockerized environment.
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.
## Installation ## Installation
Execute the following command to run DataBase installation: Before performing initial installation you can configure the type of database to be used with ThinsBoard.
In order to set database type change the value of `DATABASE` variable in `.env` file to one of the following:
- `local` - use local embedded HSQLDB database;
- `postgres` - use PostgreSQL database;
- `cassandra` - use Cassandra database;
**NOTE**: In case of `postgres` or `cassandra` corresponding docker service will be deployed (see `docker-compose.postgres.yml`, `docker-compose.cassandra.yml` for details).
Execute the following command to run installation:
` `
$ ./docker-install-tb.sh --loadDemo $ ./docker-install-tb.sh --loadDemo
` `
- `--loadDemo` - optional argument. Whether to load additional demo data. Where:
- `--loadDemo` - optional argument. Whether to load additional demo data.
## Running ## Running
Execute the following command to run services: Execute the following command to start services:
` `
$ ./docker-start-services.sh $ ./docker-start-services.sh
` `
After a while when all services will be successfully started you can open `http://{yor-host-ip}` in you browser (for ex. `http://localhost`).
You should see ThingsBoard login page.
Use the following default credentials:
- **Systen Administrator**: sysadmin@thingsboard.org / sysadmin
If you installed DataBase with demo data (using `--loadDemo` flag) you can also use the following credentials:
- **Tenant Administrator**: tenant@thingsboard.org / tenant
- **Customer User**: customer@thingsboard.org / customer
In case of any issues you can examine service logs for errors.
For example to see ThingsBoard node logs execute the following command:
`
$ docker-compose logs -f tb
`
Or use `docker-compose ps` to see the state of all the containers.
Use `docker-compose logs --f` to inspect the logs of all running services.
See [docker-compose logs](https://docs.docker.com/compose/reference/logs/) command reference for details.
Execute the following command to stop services: Execute the following command to stop services:
` `
@ -32,12 +71,16 @@ Execute the following command to stop and completely remove deployed docker cont
$ ./docker-remove-services.sh $ ./docker-remove-services.sh
` `
Execute the following command to update particular services (pull newer docker image and rebuild container): Execute the following command to update particular or all services (pull newer docker image and rebuild container):
` `
$ ./docker-update-service.sh [SERVICE...] $ ./docker-update-service.sh [SERVICE...]
` `
Where:
- `[SERVICE...]` - list of services to update (defined in docker-compose configurations). If not specified all services will be updated.
## Upgrading ## Upgrading
In case when database upgrade is needed, execute the following commands: In case when database upgrade is needed, execute the following commands:
@ -48,4 +91,6 @@ $ ./docker-upgrade-tb.sh --fromVersion=[FROM_VERSION]
$ ./docker-start-services.sh $ ./docker-start-services.sh
``` ```
- `FROM_VERSION` - from which version upgrade should be started. Where:
- `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.

View File

@ -171,6 +171,7 @@ services:
HTTP_PORT: 80 HTTP_PORT: 80
HTTPS_PORT: 443 HTTPS_PORT: 443
MQTT_PORT: 1883 MQTT_PORT: 1883
FORCE_HTTPS_REDIRECT: "false"
links: links:
- tb-web-ui1 - tb-web-ui1
- tb-web-ui2 - tb-web-ui2

View File

@ -46,6 +46,8 @@ ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $?
ADDITIONAL_STARTUP_SERVICES=$(additionalStartupServices) || exit $? ADDITIONAL_STARTUP_SERVICES=$(additionalStartupServices) || exit $?
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS pull tb
if [ ! -z "${ADDITIONAL_STARTUP_SERVICES// }" ]; then if [ ! -z "${ADDITIONAL_STARTUP_SERVICES// }" ]; then
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS up -d $ADDITIONAL_STARTUP_SERVICES docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS up -d $ADDITIONAL_STARTUP_SERVICES
fi fi

View File

@ -51,7 +51,7 @@ frontend http-in
acl transport_http_acl path_beg /api/v1/ acl transport_http_acl path_beg /api/v1/
acl letsencrypt_http_acl path_beg /.well-known/acme-challenge/ acl letsencrypt_http_acl path_beg /.well-known/acme-challenge/
redirect scheme https if !letsencrypt_http_acl !transport_http_acl redirect scheme https if !letsencrypt_http_acl !transport_http_acl { env(FORCE_HTTPS_REDIRECT) -m str true }
use_backend letsencrypt_http if letsencrypt_http_acl use_backend letsencrypt_http if letsencrypt_http_acl
use_backend tb-http-backend if transport_http_acl use_backend tb-http-backend if transport_http_acl

View File

@ -8,6 +8,7 @@ This project provides the build for the ThingsBoard single docker images.
## Running ## Running
In this example `thingsboard/tb` image will be used. You can choose any other images with different databases (see above).
Execute the following command to run this docker directly: Execute the following command to run this docker directly:
` `
@ -23,9 +24,9 @@ Where:
- `-p 5683:5683` - connect local port 5683 to exposed internal COAP port 5683 - `-p 5683:5683` - connect local port 5683 to exposed internal COAP port 5683
- `-v ~/.mytb-data:/data` - mounts the host's dir `~/.mytb-data` to ThingsBoard DataBase data directory - `-v ~/.mytb-data:/data` - mounts the host's dir `~/.mytb-data` to ThingsBoard DataBase data directory
- `--name mytb` - friendly local name of this machine - `--name mytb` - friendly local name of this machine
- `thingsboard/tb` - docker image - `thingsboard/tb` - docker image, can be also `thingsboard/tb-postgres` or `thingsboard/tb-cassandra`
After executing this command you can open `http://{yor-host-ip}:9090` in you browser. You should see ThingsBoard login page. 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.
Use the following default credentials: Use the following default credentials:
- **Systen Administrator**: sysadmin@thingsboard.org / sysadmin - **Systen Administrator**: sysadmin@thingsboard.org / sysadmin
@ -65,4 +66,6 @@ $ docker run -it -v ~/.mytb-data:/data --rm thingsboard/tb upgrade-tb.sh
$ docker start mytb $ docker start mytb
``` ```
**NOTE**: if you use different database change image name in all commands from `thingsboard/tb` to `thingsboard/tb-postgres` or `thingsboard/tb-cassandra` correspondingly.
**NOTE**: replace host's directory `~/.mytb-data` with directory used during container creation. **NOTE**: replace host's directory `~/.mytb-data` with directory used during container creation.