You can run the services with
docker compose -f docker-compose.local.yaml up --build
--build
to build the images locally- Make sure you've create the Thingsboard volumes first:
docker volume create mytb-data && docker volume create mytb-logs
. - Hint: add
-V
to renew volumes if you update node packages (e.g., infrontend
,stapi-backend
, orstrapi-backend/src/plugins/thingsboard-plugin
). - Hint: manage env variables in the
.local.env
;.env
files in e.g.strapi-backend/.env
will override the docker variables.
To use images from GiHub's container registry (ghcr.io), run docker login with the proper access token. You'll need a Classic Token with at least read:packages
.
export CR_PAT=YOUR_TOKEN
echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin
Default addresses for local development:
- Portal: http://localhost:3000
- Strapi: http://localhost:1337
- Platform (Thingsboard): http://localhost:9090
- Swagger UI: http://localhost:9090/swagger-ui/
Strapi includes the Strapi CMS UI, plugins (strapi-backend/src/plugins/thingsboard-plugin
), and, in our case, comes with a dedicated Postgres. The platform comes with default users user:password [email protected]:sysadmin
for the default admin with admin UI access and [email protected]:tenant
for the default tenant.
- Make sure to set all roles and permissions for
Authenticated
andPublic
users under http://localhost:1337/admin/settings/users-permissions/roles. This can include allfind
andfindOne
permissions across all routes and all permissions for theThingsboard-plugin
route. - When adding plugin routes, as for the
Thingsboard-plugin
, ensure that each custom controller action (e.g.,exportTelemetry
, etc.) is explicitly allowed for the relevant user roles — otherwise, Strapi will return a 403 Forbidden silently even if the route and token are valid.
- New users can register by clicking
Jetzt registrieren
on the login page. Or directly navigate to http://localhost:3000/signup/. - Each newly registered user receives a
Tenant
account in the Thingsboard platform. - Portal users are able to test, i.e. deploy,
Anwendungsfälle
. Deployed Anwendungsfälle (use cases) then list, i.e. display, all connected Thingsboard dashboards and devices in the user's portal.
- Create and publish a Use Case in the Strapi Admin Dashboard. You need to be logged in as admin.
- Select a
Device Profile
of the (Thingsboard) Tenant which should be the Use-Case owner. By default, you can use the tenant namedTenant
. All Thingsboard assets in a use case must be owned by the same Thingboard Tenant. - Fill out the mandatory fields.
- Add a
Device Profile
and all linked assets to this Device Profile -- for the chosen Use Case owner Tenant. That is, this can include aRule Chain
. If linked assets are missing, the deployment of the Use Case will fail for users. - Under
setupSteps
, add thesetupInstruction
. Underthingsboard_profile
, you must add the very sameDevice Profile
which was selected earlier.
- A Use Case is deployed if a user fulfills all
Anwendungsfall einrichten
steps in the Portal. Use Cases are deployed by creating a copy of all Use Case assets into the user's Thingsboard tenant account.
Thingsboard uses a Postgres internally. To connect to it on localhost, run:
docker exec -it mytb bash -c "echo \"listen_addresses = '*'\" >> /data/db/postgresql.conf"
docker exec -it mytb bash -c "echo \"host all all 0.0.0.0/0 md5\" >> /data/db/pg_hba.conf"
docker exec mytb psql -U thingsboard -c "ALTER USER thingsboard WITH PASSWORD 'postgres';"
Where thingsboard:postgres
is the default user:password
(for some reason, it has to be re-applied manually).