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

Rust authority bootstrap #205

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nbuffon
Copy link
Member

@nbuffon nbuffon commented Nov 12, 2024

What's new

New function to create a Configuration from bootstrap sequence
The bootstrap sequence provide services' URL and credentials, any of these information already present in the configuration file
All the other fields that are unrelated to services connection are still read from the configuration file and set in the Configuration object

closes #185
closes #161

How to test

  1. Edit examples/config.ini and
    1. Fill the [bootstrap] section with the proper endpoint and credentials
    2. Remove the [mqtt] section
    3. Remove the ``telemetry]` section
  2. Apply the joined patch to make the copycat example using the bootstrap sequence
    cd rust
    wget https://github.com/user-attachments/files/17728759/copycat_bootstrap.txt
    mv copycat_bootstrap.txt copycat_bootstrap.patch
    git apply copycat_bootstrap.patch
    
  3. Start the copycat example
    cargo run --example copycat --features geo_routing --features telemetry
    
    => The example runs and receives messages

@nbuffon nbuffon added the Rust Rust code label Nov 12, 2024
@nbuffon nbuffon self-assigned this Nov 12, 2024
@nbuffon nbuffon force-pushed the rust_authority_bootstrap branch 2 times, most recently from 20cb68b to 0b56377 Compare November 12, 2024 16:51
@Hugues360
Copy link
Collaborator

Why not include the example of copycat with bootstrap to the current PR (with another name to keep existing copycat)? As bootstrap is now a feature of the lib.

#host="mydomain.com"
#port="8080"
#path="/bootstrap"
#role="external-app"
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no line for station_id in the example bootstrap section?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is present in the [station] section with the id
I agree that it might not be very intuitive at first sight, but this is a field that was already present and used so I thought I would be more relevant to use it instead of duplicating it in the [bootstrap] section

Copy link
Collaborator

Choose a reason for hiding this comment

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

But in your code there is in bootstrap_configuration.rs
station_id: get_mandatory_field::("station_id", section)?,

And so for bootstrapping, it is the station_id field in the [bootstrap] section that is taken (and that is mandatory) and not the id field of the [station] section, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, my bad, it takes is from the [bootstrap] section, as indicated in the configuration example docstring
I remember having an issue about it, I'll fix it and push a new version

@nbuffon
Copy link
Member Author

nbuffon commented Nov 18, 2024

Why not include the example of copycat with bootstrap to the current PR (with another name to keep existing copycat)? As bootstrap is now a feature of the lib.

Problem is that it requires a running bootstrap server and for now the code is private and the platform is not deployed as publicly usable
So I did patch the example to test the bootstrap, if you prefer I can add a dedicated example but it is not possible for external users to run it
In comparison the telemetry example already requires to edit the config.ini file to fit the OTLP collector instance (which is not very example friendly as an example should be able to run without any modification) but you can easily run your own collector using official Docker images
This is not yet possible for the bootstrap so I decided not to provide an example yet, the idea is to provide a public instance of the platform which is still work in progress

Copy link
Collaborator

@Hugues360 Hugues360 left a comment

Choose a reason for hiding this comment

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

See answer in the thread for station_id field in [bootstrap] section

Signed-off-by: Nicolas Buffon <nicolas.buffon@orange.com>
Signed-off-by: Nicolas Buffon <nicolas.buffon@orange.com>
Signed-off-by: Nicolas Buffon <nicolas.buffon@orange.com>
@nbuffon
Copy link
Member Author

nbuffon commented Nov 19, 2024

Changes are pushed, station_id now correctly comes from the [station] section

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust Rust code
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Use bootstrap information to connect to services Get connection information through bootstrap sequence
2 participants