thingsboard / tbmq

Open-source, scalable, and fault-tolerant MQTT broker able to handle 4M+ concurrent client connections, supporting at least 3M messages per second throughput per single cluster node with low latency delivery. The cluster mode supports more than 100M concurrently connected clients.
https://thingsboard.io/products/mqtt-broker/
Apache License 2.0
570 stars 46 forks source link

[Bug] Docker upgrade script fails to parse FROM_VERSION #115

Closed fjpanag closed 4 months ago

fjpanag commented 4 months ago

Describe the bug While trying to update from v1.2.1 to v1.3.0 I get the following error:

Starting TBMQ upgrade ...
FROM_VERSION variable is invalid or unspecified!

As it seems, in the previous versions, the data path was ~/.tb-mqtt-broker-data/data, but the new script assumes tbmq-data.

Your Server Environment

To Reproduce Steps to reproduce the behavior:

  1. Install v1.2.0 according to the official documentation.
  2. Upgrade according to the documentation.

The upgrade script fails.

Expected behavior I expected the upgrade to not fail, or at least be aware of the change in the documentation, or provide an alternative means of configuring FROM_VERSION like for example an environment variable or a script argument.

Or better yet, get rid of this FROM_VERSION thing, and store the database information in... the database itself.

fjpanag commented 4 months ago

It is also possible that due to this my previous upgrade from v1.2.0 to v1.2.1 produced the same error, that went unnoticed...

Is there any way to manually repair the DB?
Do I have to run this manually?
Is there anything else needed to be done?

dmytro-landiak commented 4 months ago

Hi @fjpanag,

Sorry to hear about the issue you faced. I believe you are correct in the assumption that the reason for this issue is the changed deployment (this was changed from 1.2 -> 1.2.1 version) from bind mounts to docker volume. The file .upgradeversion that is stored in the /data folder is used to determine the value for the FROM_VERSION variable.

The mentioned ticket brings a good suggestion that will be reviewed by the tbmq team as well.

As far as I see based on the #116 ticket, you have resolved the upgrading process. Am I able to help you with anything else?

fjpanag commented 4 months ago

I rolled-back the server to the previous version, and then I made sure that all steps of the upgrade were executed correctly. So I do not need any further support on this.

But please consider to at least update the upgrade instructions, for others.

Getting rid of the update scripts, and having the application automatically update the DB schema is also very crucial in simplifying the process and enabling automatic deployments of the app.

(Issue #116 is unaffected by this.)

dmytro-landiak commented 4 months ago

@fjpanag, Thank you for your update! I appreciate your insights and agree with your assessments.

I wanted to mention that we previously documented the changes in the deployment scenario, specifically the shift from bind mounts to volumes. However, this information was unnecessarily removed in our latest release notes. We apologize for any confusion this may have caused and will update the documentation accordingly.

Best regards!