summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2022-09-19Make "bugreport" optionalpost-merge/tedge-bugreportMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-09-13Add tedge subcommand "bugreport"Matthias Beyer
For printing a quick markdown summary that can be used to be pasted into a bugreport at some code forge. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-30Merge branch 'feature/add_tedge_api_impl' into integrate-feature-apiintegrate-feature-apiMatthias Beyer
This merge now introduces the "core" library, a CLI implementation, a helper library for simplifying some plugin implementation as well as a number of example plugins. The following message can help you understanding the ideas and concepts that are introduced with this merge as well as help to answer some questions that might arise when reviewing the changeset. In the previous merge we introduced the API. This API does _only_ define an interface how thin-edge.io plugins can be written in a way so they can be used within the thin-edge.io ecosystem. For more information, have a look at the merge commit where the API was introduced. This merge now introduces a list of crates of different importance. I will quickly introduce them here, with only some short notes. More is written in the `README.md` file of the respective crate. * `tedge_core` - The implementation of the part of thin-edge.io, that runs the plugins which implement the `tedge_api` * Ensures composability via configuration with fail-early mechanisms if configuration is faulty * Runs plugins concurrently on multiple cores without spending much time itself * Implements high-performance asynchronous and typed message passing without serialization/deserialization overhead * Ensures plugin lifecycle with panic-catching in all phases of the lifecycle of a plugin * Features fine-grained `tracing` output to be able to make use of the excellent `tracing` ecosystem and enabling detailed performance analytics * Ensures proper plugin shutdown in case of application shutdown * If a plugin does not shutdown after a certain configurable timeout, the plugin will be killed * High testability! The core is tested for several things, for example: * whether a plugin does panic in any phase of it's lifecycle, so that the core does not crash if it happens * whether a plugin does shutdown cleanly * whether application startup is aborted properly if plugins are wired up that are not compatible (`Plugin A` wants to send `Message M` to `Plugin B`, but `Plugin B` only supports `Message X`) * `tedge-cli` - one possible implementation of the CLI for starting a thin-edge.io process. This implementation is not really big, which is definitively intended * Implements easy to use CLI interface * Setup of stdout/chrome/Tracy tracing output * Ties together the core and the plugins * `tedge_lib` - A helper library for helping plugin authors with some recurring aspects/patterns in a plugin implementation * Mainloop abstraction helper for "ticking" mainloop * Mainloop abstraction for stateful `loop{}`-style mainloops * Defines common message types, e.g.: * `Measurement` (just a mockup for now, details have to discussed later) * `Notification` (just a mockup for now, details have to discussed later) * Defines config helper types for more typing in the configuration * Defines address helper types for more convenience over the basics of message passing * A list of example plugin implementations of different complexity * `plugin_avg` - A plugin that calculates an average value from a stream of measurements sent to it. This is a good example plugin for learning how a plugin implementation could look like * `plugin_log` - A plugin that logs all messages sent to it. This is intentionally minimal and does not serve a real purpose * `plugin_httpstop` - A plugin that tells thin-edge.io to stop if a web request was made to a certain endpoint. In short: `curl localhost:8080` to shutdown thin-edge.io. This would also be a good example for reviewing how a basic plugin implementation would look like * `plugin_inotify` - A plugin that watches some files with inotify and sends notification messages if inotify raises an event. This is a good example of a bit more involved plugin * `plugin_measurement_filter` - A plugin to filter `Measurement` messages by a user-defined predicate. Think "Ignore all measurements below value `12`" * `plugin_mqtt` - A way for connecting thin-edge.io with an MQTT broker. This plugin does not parse MQTT payloads, which is done by another plugin, depending on the usecase that one wants to cover. Instead it only contains the MQTT handling, so that other plugins do not have to care about the transport mechanisms their payloads are sent/received with * `plugin_mqtt_measurement_bridge` - A plugin that receives `Measurement` objects, serializes them to JSON and sends them to an MQTT Plugin. This is another building block in an MQTT setup and makes the serialization method decoupled from the business logic that emits `Measurement` objects. * `plugin_sysstat` - A plugin that uses the `sysinfo` crate to get system statistics and sends them as `Measurement` messages. This is a really involved plugin (code-size wise) and might require some more effort to understand. We did not yet introduce plugins for things like collectd, systemd, apt, and so on in this work, as these are clearly _usecases_ and we want to keep the plugin implementations we provide in this PR in the "this is an example" space. The work merged with this commit does not claim to provide the end-result of anything! This is code, it can and most certainly will be changed after this is merged to the `main` branch. The most stable part of this PR is the `tedge_core` crate. The plugins are only examples! There are also some types defined for representing a `Measurement` for example. This is not final by any means and its purpose is to be able to implement example plugins! Of course we have to iterate on how a Measurement (e.g.) should and can look like! The existing types for representing a `Measurement` were not used in this PR because of development-workflow reasons. All changes that are merged with this commit are made under the DCO and _not_ under any CLA. DCO: Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. Signed-off-by: Marcel Müller <m.mueller@ifm.com> Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-30Merge 'feature/add_tedge_api_only' into integrate-feature-apiMatthias Beyer
This merge introduces the thin-edge.io API definition to the codebase. The merge is done to an integration-branch because of the longevity of the `feature/add_tedge_api_only` branch, which branched off of `main` in February 2022. Because of the long development time, `Cargo.lock` has now conflicts. We cannot rebase the feature branch anymore, as it would only be effort that can be prevented by an integration branch such as this. So, here we introduce the API. This API does _only_ define an interface how thin-edge.io plugins can be written in a way so they can be used within the thin-edge.io ecosystem. That means, by using this API, a plugin author gets the following things for free (these are high-level bullet points): * Running their plugin concurrently to other components/plugins of thin-edge.io * Sending messages to other components of thin-edge.io * These messages are typed. This means that they are normal rust objects. A plugin author does not have to concern themselves with serialization and deserialization of messages, as there is none * Message passing is lightweight, no external processes are needed and sending tons (literally thousands) of messages is not a problem * Receiving messages from other components of thin-edge.io * Concurrently * handling them in an asynchronous way * without de/serialization overhead * Safety from crashes. If a plugin crashes, it does not bring down the rest of the application. All other plugins continue to run * Compatibility of components is a compiletime assurance! * A clear shutdown path, if a shutdown was requested for the application Besides these rather technical points, we get the following (very high level) benefits: * Error handling is uniform and streamlined. Providing excellent error messages to the user is a matter of writing down good error messages, not of implementing good error handling * Logging is uniform over all components of the software * Tracing how a message propagated through the software is easily doable, as only one process is involved and the excellent `tracing` ecosystem provides the heavy lifting for us * runtime performance analytics a developer might want to do is easy with `tracing` as well * High performance is ensured via the `tokio` runtime, having tons of tasks running in a concurrent way is handled by the runtime, a developer has not to concern themselves with it All changes that are merged with this commit are made under the DCO and _not_ under any CLA. DCO: Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. Signed-off-by: Marcel Müller <m.mueller@ifm.com> Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-30Fix install array expansion (#1375)Matthias Beyer
* Fix: Use @ to expand array instead of * Fixes: b3f1da8cf607cb1c6668d30ae1121a19305cf9e9 ("Fix: Add missing quotes") Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com> * Fix: Use @ to expand array instead of * Fixes: 12912211adc50d6ea99d4e2d1c4c1bf71a3cb5c0 ("Fix: Add missing quotes") Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com> * Fix: Use @ to expand array instead of * Fixes: c147d91f6aedfcef6574fd105557e6661220ee3d ("Fix: Add missing quotes") Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com> Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-30Merge pull request #1350 from matthiasbeyer/flockfile-misc-refactoringDidier Wenzek
Flockfile misc refactorings
2022-08-30Simplify impl of check_another_instance_is_not_running()Matthias Beyer
This patch refactors the `check_another_instance_is_not_running()` function by introducing a `FlockfileError::path()` helper function to get the path for the error instance and re-implementing the function with that. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-30Replace match with function chainingMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-30Move alarms converter code to a separate file (#1366)PradeepKiruvale
* Move c8y alarms converter code to a separate file Signed-off-by: Pradeep Kumar K J <pradeepkumar.kj@softwareag.com>
2022-08-29Merge pull request #1355 from Bravo555/add-homepage-fieldDidier Wenzek
Add manifest fields to all crates
2022-08-29Merge pull request #1354 from Ruadhri17/scripts-improvementDidier Wenzek
Replace scripts commands for the cross-Unix system compatibility
2022-08-22Replace scripts commands for the cross-Unix system compatibilityKrzysztof Piotrowski
Signed-off-by: Krzysztof Piotrowski <krzysztof.piotrowski@inetum.com>
2022-08-22Add manifest fields to all crates in meta-tedgeMarcel Guzik
Add `homepage` and `manifest` fields in `Cargo.toml`s of crates used in meta-tedge so that cargo-bitbake utility can generate recipe files for them. Signed-off-by: Marcel Guzik <marcel.guzik2@inetum.com>
2022-08-19Merge pull request #1326 from matthiasbeyer/add-shellcheckDidier Wenzek
Add shellcheck action, fix issues
2022-08-19Merge pull request #1348 from thin-edge/create-pull-request/patchAlbin Suresh
Patch version bump
2022-08-19Enhance the tedge_apt_plugin error message to be more verbose (#1341)PradeepKiruvale
* Enhance the error message to be more precise Signed-off-by: Pradeep Kumar K J <pradeepkumar.kj@softwareag.com>
2022-08-19Bump up version in get-thin-edge_io.shAlbin Suresh
2022-08-18Add check whether env vars are setMatthias Beyer
This patch adds a check whether all environment variables expected to be set are actually set. Suggested-by: Didier Wenzek <didier.wenzek@free.fr> Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Merge pull request #1297 from matthiasbeyer/update-rustcDidier Wenzek
Update rustc: 1.58.1 -> 1.63.0
2022-08-18Fix clippy: Remove unneccessary lazy evalMatthias Beyer
This patch fixes clippy::unnecessary_lazy_evaluations Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Remove escape sequencesMatthias Beyer
This patch remoces escape sequences from the script, so that we can use /bin/sh as interpreter. Suggested-by: Didier Wenzek <didier.wenzek@free.fr> Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Update rustc: 1.62.1 -> 1.63.0Matthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Update rustc: 1.58.1 -> 1.62.1Matthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Merge pull request #1349 from matthiasbeyer/clippy-fixesDidier Wenzek
Clippy fixes
2022-08-18Merge pull request #1339 from ↵Didier Wenzek
matthiasbeyer/gh-actions/check-cargolock-up-to-date Add check whether lockfile is up to date
2022-08-18Merge pull request #1279 from matthiasbeyer/remove-let-unitDidier Wenzek
Clippy: Remove let unit
2022-08-18Merge pull request #1338 from ↵initard
initard/feature/1070/tedge-agent-log-directory-path-configurable make log directory configurable during init
2022-08-18Fix clippy: logged_command: Do not use format!() to append to StringMatthias Beyer
This fixes clippy::format_push_string. The error returned from write!() is ignored in this case. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: tests: Do not use format!() to append to StringMatthias Beyer
This fixes clippy::format_push_string. The error returned from write!() is ignored in this case. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: Remove unnecessary .to_string()Matthias Beyer
This fixes clippy::unnecessary_to_owned Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: c8y_configuration_plugin: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: thin_edge_json: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: tedge_mapper: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: tedge_agent: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: tedge: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: c8y_translator: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: c8y_smartrest: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: c8y_api: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: agent_interface: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: download: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Refactor for readabilityMatthias Beyer
This patch refactors `check_another_instance_is_not_running()` for readability. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: Remove needless return keywordMatthias Beyer
This fixes clippy::needless_return Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: Remove unnecessary bindingMatthias Beyer
This fixes clippy::let_and_return. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18make log directory configurable during initinitard
* the log directory configured in tedge config set logs.path is now used in --init Signed-off-by: initard <alex.solomes@softwareag.com>
2022-08-18Fix clippy in tedge_apt_plugin: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy in c8y_log_plugin: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy in c8y_configuration_plugin: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy in tedge_test_utils: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy in thin_edge_json: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy in tedge_mapper: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>