Provisioning on server side#60
Conversation
|
@jfrohnhofen, @chithams This PR is not really ready for review, but I'm posting it so that we can discuss the HTTP API of the provisioning process. Please have a look at the I have tested the provision process with this simple script that just runs each step in sequence: curl -v -X POST -H "Content-Type: application/json" http://leap.local/provision/network --data @network_config.json
curl -v -X POST http://leap.local/provision/storage/format?name=/dev/sda
curl -v -X POST -H "Content-Type: application/json" http://leap.local/provision/config --data @leap_config.json
curl -v -X POST http://leap.local/provision/finishContents of {
"Wired": {
"ip_config": "Dhcp"
}
}Contents of {
"downloader_config": {
"concurrent_downloads": 2,
"update_interval": "5 min",
"retry_params": {
"initial_backoff": "30 s",
"backoff_factor": 1.0,
"max_backoff": "30 s"
}
},
"s3_config": {
"bucket": "s3://vds-test-bucket",
"access_key_id": "REDACTED",
"secret_access_key": "REDACTED",
"endpoint_url": "REDACTED"
}
}This works fine for CLI usage, but of course, the point is to make it workable for the provisioning frontend. Note that, at this time, networking configuration is not really implemented, but the rest is working. |
|
@jfrohnhofen, @chithams, I went ahead and added the network configuration code as well using the |
|
I haven't started on the UI yet, so more than happy to use your vibe-coded version for now. If there is anything that needs changing, I will base that off of your branch. Let us know once things are ready to be reviewed. |
|
@jfrohnhofen thanks, I think this is really ready now. I know this is a pretty massive PR, let me know if you need me to split it. |
jfrohnhofen
left a comment
There was a problem hiding this comment.
Thanks a lot! Left a few comments, but nothing major.
I also only skimmed the auto-generated code.
| ) -> impl Responder { | ||
| match provision_data.try_lock() { | ||
| Ok(mut lock) => match lock.provision.configure_network(&network_config).await { | ||
| Ok(()) => HttpResponse::Ok().body(""), |
There was a problem hiding this comment.
should this return valid JSON (null?) instead of an empty body? this applies to all handlers of course.
There was a problem hiding this comment.
Do we plan on doing anything with those return values? Or is the 200 http code enough? Note that the only reason I'm calling body() here is because otherwise the return type for the handers cannot be deduced, as branches have different types returned.
|
Thanks for the review @jfrohnhofen ! I addressed the comments :) The autogenerated code is pretty awful IMO, but not worth reviewing, seems to be just fine either way. |
|
Hmm, interestingly cargo deny now fails, and it's related to its latest update. cargo deny EmbarkStudios/cargo-deny@a1728a7 which brings a couple of important fixes: EmbarkStudios/krates#106 So now a license that we were not handling has just been detected! I'll fix it |
Implements the basic provisioning functionality on the server-side. Provisioning is divided in the following steps:
LEAP_DATAlabel, so that systemd can find it and mount it on boot.In order to configure the LEAP device when network settings are not yet configured, LEAP falls back to a LEAP-setup access point (generated by the raspberry pi) that allows users to connect to it. It provides a DHCP server so that clients can obtain an IP address. This connection can then be used to follow the provisioning process via the network. When the connection is wired, the same can be achieved via the wired connection if the wired network has a DHCP server.