Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop/2.0' into develop/2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
deaflynx committed Oct 24, 2024
2 parents d1b502f + ed91458 commit 376798c
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private void updateSchema(String oldVersionStr, int oldVersion, String newVersio
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) {
log.info("Updating schema ...");
if (isOldSchema(conn, oldVersion)) {
Path schemaUpdateFile = Paths.get(installScripts.getDataDir(), "upgrade", oldVersionStr, SCHEMA_UPDATE_SQL);
Path schemaUpdateFile = Paths.get(installScripts.getUpgradeDataDir(), "upgrade", oldVersionStr, SCHEMA_UPDATE_SQL);
if (Files.exists(schemaUpdateFile)) {
loadSql(schemaUpdateFile, conn);
}
Expand Down
1 change: 0 additions & 1 deletion docker/cache-redis-cluster.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
CACHE_TYPE=redis
REDIS_CONNECTION_TYPE=cluster
REDIS_NODES=redis-node-0:6379,redis-node-1:6379,redis-node-2:6379,redis-node-3:6379,redis-node-4:6379,redis-node-5:6379
REDIS_CLUSTER_USE_DEFAULT_POOL_CONFIG=false
Expand Down
1 change: 0 additions & 1 deletion docker/cache-redis-sentinel.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
CACHE_TYPE=redis
REDIS_CONNECTION_TYPE=sentinel
REDIS_MASTER=mymaster
REDIS_SENTINELS=redis-sentinel:26379
Expand Down
1 change: 0 additions & 1 deletion docker/cache-redis.env
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
CACHE_TYPE=redis
REDIS_HOST=redis
6 changes: 2 additions & 4 deletions k8s/aws/tb-broker-cache-configmap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@ data:
CACHE_STATS_INTERVAL_SEC: "60"

# Make sure that the REDIS_HOST value does not contain the port (:6379).
# Uncomment the following lines to enable Redis cache.

#CACHE_TYPE: "redis"
#REDIS_HOST: "YOUR_REDIS_ENDPOINT_URL_WITHOUT_PORT"
REDIS_HOST: "YOUR_REDIS_ENDPOINT_URL_WITHOUT_PORT"
#REDIS_PASSWORD: "YOUR_REDIS_PASSWORD"
5 changes: 1 addition & 4 deletions k8s/azure/tb-broker-cache-configmap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,5 @@ data:
CACHE_STATS_INTERVAL_SEC: "60"

# Make sure that the REDIS_HOST value does not contain the port (:6379).
# Uncomment the following lines to enable Redis cache.

#CACHE_TYPE: "redis"
#REDIS_HOST: "YOUR_REDIS_ENDPOINT_URL_WITHOUT_PORT"
REDIS_HOST: "YOUR_REDIS_ENDPOINT_URL_WITHOUT_PORT"
#REDIS_PASSWORD: "YOUR_REDIS_PASSWORD"
2 changes: 0 additions & 2 deletions k8s/minikube/tb-broker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ spec:
value: "true"
- name: TB_APP_PERSISTED_MSG_PACK_PROCESSING_TIMEOUT
value: "15000"
- name: CACHE_TYPE
value: "redis"
- name: REDIS_HOST
value: "tb-redis"
envFrom:
Expand Down
3 changes: 3 additions & 0 deletions msa/tbmq/configs/tbmq-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ new_image="image: \"thingsboard/tbmq:$new_version\""
db_url="jdbc:postgresql://postgres:5432/thingsboard_mqtt_broker"
db_username="postgres"
db_password="postgres"
redis_url="redis"

COMPOSE_VERSION=$(compose_version) || exit $?
echo "Docker Compose version is: $COMPOSE_VERSION"
Expand Down Expand Up @@ -98,6 +99,7 @@ V2)
-e SPRING_DATASOURCE_URL=$db_url \
-e SPRING_DATASOURCE_USERNAME=$db_username \
-e SPRING_DATASOURCE_PASSWORD=$db_password \
-e REDIS_HOST=$redis_url \
-v tbmq-data:/data \
--rm \
thingsboard/tbmq:$new_version upgrade-tbmq.sh
Expand All @@ -117,6 +119,7 @@ V1)
-e SPRING_DATASOURCE_URL=$db_url \
-e SPRING_DATASOURCE_USERNAME=$db_username \
-e SPRING_DATASOURCE_PASSWORD=$db_password \
-e REDIS_HOST=$redis_url \
-v tbmq-data:/data \
--rm \
thingsboard/tbmq:$new_version upgrade-tbmq.sh
Expand Down
3 changes: 3 additions & 0 deletions msa/tbmq/configs/windows/tbmq-upgrade.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ try {
$db_url = "jdbc:postgresql://postgres:5432/thingsboard_mqtt_broker"
$db_username = "postgres"
$db_password = "postgres"
$redis_url = "redis"

# Pull the new TBMQ image
docker pull "thingsboard/tbmq:$new_version"
Expand Down Expand Up @@ -83,6 +84,7 @@ try {
-e SPRING_DATASOURCE_URL=$db_url `
-e SPRING_DATASOURCE_USERNAME=$db_username `
-e SPRING_DATASOURCE_PASSWORD=$db_password `
-e REDIS_HOST=$redis_url `
-v tbmq-data:/data `
--rm `
"thingsboard/tbmq:$new_version" upgrade-tbmq.sh
Expand All @@ -102,6 +104,7 @@ try {
-e SPRING_DATASOURCE_URL=$db_url `
-e SPRING_DATASOURCE_USERNAME=$db_username `
-e SPRING_DATASOURCE_PASSWORD=$db_password `
-e REDIS_HOST=$redis_url `
-v tbmq-data:/data `
--rm `
"thingsboard/tbmq:$new_version" upgrade-tbmq.sh
Expand Down
2 changes: 1 addition & 1 deletion msa/tbmq/docker/upgrade-tbmq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ else
fromVersion="${FROM_VERSION// }"
fi

java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.mqtt.broker.ThingsboardMqttBrokerInstallApplication \
exec java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.mqtt.broker.ThingsboardMqttBrokerInstallApplication \
-Dspring.jpa.hibernate.ddl-auto=none \
-Dinstall.upgrade=true \
-Dinstall.upgrade.from_version=${fromVersion} \
Expand Down
2 changes: 1 addition & 1 deletion ui-ngx/src/assets/getting-started/guide-arduino.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const int MQTT_PORT = {:mqttPort};

constexpr uint32_t SERIAL_DEBUG_BAUD = 115200U;
constexpr char TOPIC[] = "tbmq/demo";
constexpr char MESSAGE[] = "Hello World";
constexpr char MESSAGE[] = "Hello, TBMQ!";
constexpr char USERNAME[] = "tbmq_websockets_username";
constexpr char PASSWORD[] = "";
String CLIENT_ID = "tbmq_test_client";
Expand Down
7 changes: 3 additions & 4 deletions ui-ngx/src/assets/getting-started/guide-java-ws.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public class TBMQMain {
// Set listener that is handling the messages received from the broker
IMqttMessageListener[] listeners = {(topic, msg) -> {
System.out.println("Received message for topic: " + topic + " with payload: " + msg);
System.out.println("Disconnecting the client...");
//System.out.println("Disconnecting the client...");

// Disconnect client once the message is received
client.disconnect();
client.close();
//client.disconnect();
//client.close();
}};

System.out.println("Subscribing to topic: " + subscriptions[0].getTopic());
Expand Down Expand Up @@ -92,7 +92,6 @@ Connected successfully
Subscribing to topic: tbmq/demo/+
Publishing message...
Received message for topic: tbmq/demo/topic with payload: Hello, TBMQ!
Disconnecting the client...
```
#### See also
Expand Down
7 changes: 3 additions & 4 deletions ui-ngx/src/assets/getting-started/guide-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ public class TBMQMain {
// Set listener that is handling the messages received from the broker
IMqttMessageListener[] listeners = {(topic, msg) -> {
System.out.println("Received message for topic: " + topic + " with payload: " + msg);
System.out.println("Disconnecting the client...");
//System.out.println("Disconnecting the client...");

// Disconnect client once the message is received
client.disconnect();
client.close();
//client.disconnect();
//client.close();
}};

System.out.println("Subscribing to topic: " + subscriptions[0].getTopic());
Expand Down Expand Up @@ -90,7 +90,6 @@ Connected successfully
Subscribing to topic: tbmq/demo/+
Publishing message...
Received message for topic: tbmq/demo/topic with payload: Hello, TBMQ!
Disconnecting the client...
```
#### See also
Expand Down
7 changes: 3 additions & 4 deletions ui-ngx/src/assets/getting-started/guide-javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const options = {
const client = mqtt.connect(url, options); // create a client

const topic = 'sensors/temperature';
const message = 'Hello World';
const message = 'Hello, TBMQ!';
const qos = 1;

client.on('connect', function () { // connect client
Expand All @@ -67,7 +67,7 @@ client.on('connect', function () { // connect client

client.on('message', (topic, message) => { // handle received messages
console.log(`Received Message: ${message.toString()} \nTopic: '${topic}'`);
client.end(); // end client session
//client.end(); // end client session
});
client.on('disconnect', () => { console.log('Disconnecting...'); });
Expand Down Expand Up @@ -95,9 +95,8 @@ Packet receive cmd: suback
Packet send cmd: publish
Packet receive cmd: puback
Packet receive cmd: publish
Received Message: Hello World
Received Message: Hello, TBMQ!
Topic: 'sensors/temperature'
Packet send cmd: disconnect
Packet send cmd: puback
```
Expand Down
4 changes: 2 additions & 2 deletions ui-ngx/src/assets/getting-started/guide-mosquitto.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mosquitto_sub -d -q 1 -h {:mqttHost} -p {:mqttPort} -t tbmq/demo/+ -i tbmq -u tb
In order to publish a message on topic `tbmq/demo/topic`, open a new terminal tab and paste the following command:

```bash
mosquitto_pub -d -q 1 -h {:mqttHost} -p {:mqttPort} -t tbmq/demo/topic -u tbmq_websockets_username -m 'Hello World'{:copy-code}
mosquitto_pub -d -q 1 -h {:mqttHost} -p {:mqttPort} -t tbmq/demo/topic -u tbmq_websockets_username -m 'Hello, TBMQ!'{:copy-code}
```

<br>
Expand All @@ -44,5 +44,5 @@ Client tbmq received SUBACK
Subscribed (mid: 1): 1
Client tbmq received PUBLISH (d0, q1, r0, m3, 'tbmq/demo/topic', ... (11 bytes))
Client tbmq sending PUBACK (m3, rc0)
tbmq/demo/topic Hello World
tbmq/demo/topic Hello, TBMQ!
```
7 changes: 4 additions & 3 deletions ui-ngx/src/assets/getting-started/guide-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ from paho import mqtt
host = "{:mqttHost}"
port = {:mqttPort}
topic = "sensors/temperature"
payload = "Hello world"
payload = "Hello, TBMQ!"
qos = 1
retain = False
clean_session = True
Expand Down Expand Up @@ -67,7 +67,8 @@ def on_connect(client, userdata, flags, rc, properties=None):

# This is the callback function that is called when a message is received after subscribing to a topic.
def on_message(client, userdata, msg):
print('Received message ' + str(msg.payload) + ' on topic ' + msg.topic)
message_str = msg.payload.decode('utf-8') # Decoding bytes to string
print('Received message \'' + message_str + '\' on topic ' + msg.topic)
# This is the callback function that is called when there is any error during MQTT operations.
def on_error(client, userdata, err):
Expand Down Expand Up @@ -102,7 +103,7 @@ python3 tbmq-python.py
The output from executing the `tbmq-python.py` file:
```bash
Client connected!
Received message 'Hello world' on topic sensors/temperature
Received message 'Hello, TBMQ!' on topic sensors/temperature
```
#### See also
Expand Down

0 comments on commit 376798c

Please sign in to comment.