- 下载安装 docker on mac
https://docs.docker.com/desktop/mac/install/
安装好后新建配置文件
vi docker-compose.yml
输入以下内容保存
version: '2.2'
services:
mytb:
restart: always
image: "thingsboard/tb-postgres"
ports:
- "9090:9090"
- "1883:1883"
- "7070:7070"
- "5683-5688:5683-5688/udp"
environment:
TB_QUEUE_TYPE: in-memory
volumes:
- ~/.mytb-data:/data
- ~/.mytb-logs:/var/log/thingsboard
2.docker运行前先执行命令:
mkdir -p ~/.mytb-data && sudo chown -R 799:799 ~/.mytb-data
mkdir -p ~/.mytb-logs && sudo chown -R 799:799 ~/.mytb-logs
#按照官方文档报错,无法创建数据库,执行一下两条命令后解决
chmod -R 777 ~/.mytb-data
chmod -R 777 ~/.mytb-logs
docker-compose pull
docker-compose up
3.或者不使用配置文件使用以下命令构建docker方式运行thingsboard/tb-postgres – 带有 PostgreSQL 数据库的 ThingsBoard 的单个实例。
docker run -it -p 9090:9090 -p 1883:1883 -p 7070:7070 -p 5683-5688:5683-5688/udp -v ~/.mytb-data:/data -v ~/.mytb-logs:/var/log/thingsboard --name mytb --restart always thingsboard/tb-postgres
4.打开
http://localhost:9090
5.登录账号
- Systen Administrator: sysadmin@thingsboard.org / sysadmin
- Tenant Administrator: tenant@thingsboard.org / tenant
- Customer User: customer@thingsboard.org / customer
6.docker命令
To reattach to the terminal (to see ThingsBoard logs) run:
docker attach mytb
To stop the container:
docker stop mytb
To start the container:
docker start mytb
7.升级
docker pull thingsboard/tb-postgres
docker stop mytb
docker run -it -v ~/.mytb-data:/data --rm thingsboard/tb-postgres upgrade-tb.sh
docker rm mytb
docker run -it -p 9090:9090 -p 1883:1883 -p 7070:7070 -p 5683-5688:5683-5688/udp -v ~/.mytb-data:/data -v ~/.mytb-logs:/var/log/thingsboard --name mytb --restart always thingsboard/tb-postgres
8.二进制文件强制升级安装
rpm -ivh --replacefiles --force --nodeps thingsboard.rpm