Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT - Replace shell script by javascript functions #1668

Merged

Conversation

atrovato
Copy link
Contributor

Pull Request check-list

To ensure your Pull Request can be accepted as fast as possible, make sure to review and check all of these items:

  • If your changes affects code, did your write the tests?
  • Are tests passing? (npm test on both front/server)
  • Is the linter passing? (npm run eslint on both front/server)
  • Did you run prettier? (npm run prettier on both front/server)
  • If you are adding a new features/services, did you run integration comparator? (npm run compare-translations on front)
  • Did you test this pull request in real life? With real devices? If this development is a big feature or a new service, we recommend that you provide a Docker image to the community for testing before merging.
  • If your changes modify the API (REST or Node.js), did you modify the API documentation? (Documentation is based on comments in code)
  • If you are adding a new features/services which needs explanation, did you modify the user documentation? See the GitHub repo and the website.
  • Did you add fake requests data for the demo mode (front/src/config/demo.js) so that the demo website is working without a backend? (if needed) See https://demo.gladysassistant.com.

NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.

Description of change

Please provide a description of the change here. It's always best with screenshots, so don't hesitate to add some!

@atrovato atrovato changed the title Replace shell script by javascript functions MQTT - Replace shell script by javascript functions Dec 11, 2022
@codecov
Copy link

codecov bot commented Dec 11, 2022

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (f1f4887) 97.55% compared to head (dd8ef1a) 97.56%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1668   +/-   ##
=======================================
  Coverage   97.55%   97.56%           
=======================================
  Files         652      653    +1     
  Lines        9909     9932   +23     
=======================================
+ Hits         9667     9690   +23     
  Misses        242      242           
Impacted Files Coverage Δ
server/services/mqtt/lib/constants.js 100.00% <ø> (ø)
server/services/mqtt/lib/saveConfiguration.js 100.00% <ø> (ø)
server/services/mqtt/lib/configureContainer.js 100.00% <100.00%> (ø)
server/services/mqtt/lib/index.js 100.00% <100.00%> (ø)
server/services/mqtt/lib/installContainer.js 97.05% <100.00%> (-0.17%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@Pierre-Gilles Pierre-Gilles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So good !! Thanks for this PR 🙏

Good for me, can you provide a Docker build to test this in real life?

@atrovato
Copy link
Contributor Author

There it is atrovato/gladys:mqtt.

Copy link
Contributor

@Pierre-Gilles Pierre-Gilles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so I tried it but it seems it doesn't work

Screenshot 2022-12-12 at 14 18 26

Gladys:

2022-12-12T08:18:07+0100 <info> installContainer.js:18 (MqttHandler.installContainer) MQTT broker is being installed as Docker container...
2022-12-12T08:18:07+0100 <info> installContainer.js:22 (MqttHandler.installContainer) Check Gladys network...
2022-12-12T08:18:07+0100 <info> installContainer.js:28 (MqttHandler.installContainer) Pulling eclipse-mosquitto:2 image...
2022-12-12T08:18:08+0100 <info> installContainer.js:32 (MqttHandler.installContainer) Preparing broker environment...
2022-12-12T08:18:08+0100 <info> configureContainer.js:25 (MqttHandler.configureContainer) MQTT broker Docker container is being configured...
2022-12-12T08:18:08+0100 <info> configureContainer.js:42 (MqttHandler.configureContainer) Writting default eclipse-mosquitto configuration...
2022-12-12T08:18:08+0100 <info> installContainer.js:35 (MqttHandler.installContainer) Creating container...
2022-12-12T08:18:08+0100 <info> installContainer.js:43 (MqttHandler.installContainer) MQTT broker successfully installed as Docker container

Logs from Mosquitto containers:

1670829515: mosquitto version 2.0.15 starting
1670829515: Config loaded from /mosquitto/config/mosquitto.conf.
1670829515: Error: Unable to open pwfile "/mosquitto/config/mosquitto.passwd".
1670829515: Error opening password file "/mosquitto/config/mosquitto.passwd".

Gladys assistant folder:

/var/lib/gladysassistant/mosquitto# ls -lh
total 4.0K
-rw-r--r-- 1 1883 1883 110 Dec 12 08:18 mosquitto.conf

@atrovato atrovato force-pushed the remove-mqtt-bash-script branch 3 times, most recently from 282e555 to 155ead8 Compare January 4, 2023 09:25
@atrovato
Copy link
Contributor Author

atrovato commented Jan 4, 2023

The password has to be created at init phase, I was missing this point.
I fixed it, rebase branch, test it.
Looks fine now, @Pierre-Gilles

EDIT: and publish a new image (atrovato/gladys:mqtt)

@atrovato atrovato requested a review from Pierre-Gilles January 4, 2023 09:43
@atrovato atrovato force-pushed the remove-mqtt-bash-script branch from 155ead8 to 4d32607 Compare January 20, 2023 18:59
@atrovato atrovato force-pushed the remove-mqtt-bash-script branch from 4d32607 to 383d770 Compare March 8, 2023 20:49
@atrovato atrovato force-pushed the remove-mqtt-bash-script branch from 383d770 to dd8ef1a Compare March 20, 2023 18:44
Copy link
Contributor

@Pierre-Gilles Pierre-Gilles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Tested on a server, it works fine!

@Pierre-Gilles Pierre-Gilles merged commit 2ea1ea9 into GladysAssistant:master Mar 24, 2023
@relativeci
Copy link

relativeci bot commented Mar 24, 2023

Job #1163: Bundle Size — 7.21MiB (0%).

2ea1ea9(current) vs 77f69af master#1162(baseline)

⚠️ Bundle contains 5 duplicate packages

Metrics (no changes)
                 Current
Job #1163
     Baseline
Job #1162
Initial JS 4.22MiB 4.22MiB
Initial CSS 300.25KiB 300.25KiB
Cache Invalidation 0% 0%
Chunks 51 51
Assets 149 149
Modules 1300 1300
Duplicate Modules 20 20
Duplicate Code 0.81% 0.81%
Packages 116 116
Duplicate Packages 4 4
Total size by type (no changes)
                 Current
Job #1163
     Baseline
Job #1162
CSS 313.38KiB 313.38KiB
Fonts 93.55KiB 93.55KiB
HTML 13.58KiB 13.58KiB
IMG 1.66MiB 1.66MiB
JS 5.13MiB 5.13MiB
Media 0B 0B
Other 15.74KiB 15.74KiB

View job #1163 reportView master branch activity

@atrovato atrovato deleted the remove-mqtt-bash-script branch March 25, 2023 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants