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

SEA-298 Extend protocol to update sw (with grisp_updater) #37

Merged
merged 19 commits into from
Oct 10, 2024

Conversation

IciaCarroBarallobre
Copy link
Member

@IciaCarroBarallobre IciaCarroBarallobre commented Sep 11, 2024

Tasks

  • Start_update request from seawater to the board
  • Notify the update progress to seawater from the board
  • Get partition state (of the board) endpoint

Get partition state local test

%% NO UPDATE
(robot@grisp-001255)4> (robot@grisp-001255)4>  {ID, Encoded} = grisp_connect_api:request(<<"get">>, <<"partition_state">>, #{}).
{<<"-134217295">>,
 <<"{\"id\":\"-134217295\",\"params\":{\"type\":\"partition_state\"},\"method\":\"get\",\"jsonrpc\":\"2.0\"}">>}
 
(robot@grisp-001255)5> grisp_connect_api:handle_msg(Encoded).
[{send_response,<<"{\"id\":\"-134217295\",\"result\":{\"message\":\"No update pending, running old partition\",\"state\":\"old_no_update"...>>}]```

%% Update pending

Update done
 {ID55, Encoded55} = grisp_connect_api:request(<<"get">>, <<"partition_state">>, #{}).
{<<"-134216271">>,
 <<"{\"id\":\"-134216271\",\"params\":{\"type\":\"partition_state\"},\"method\":\"get\",\"jsonrpc\":\"2.0\"}">>}
(robot@grisp-001255)7> grisp_connect_api:handle_msg(Encoded55).
[{send_response,<<"{\"id\":\"-134216271\",\"result\":{\"message\":\"Reboot required to load new partition\",\"state\":\"old\",\"action_req"...>>}]

%% Remove SD & reboot

[{send_response,<<"{\"id\":\"-134217327\",\"result\":{\"message\":\"New partition booted, validation required\",\"state\":\"new\",\"action"...>>}]
(robot@grisp-001255)3> 

%% Validate :) 

{ID552, Encoded552} = grisp_connect_api:request(<<"post">>, <<"validate">>, #{}).
(robot@grisp-001255)4> grisp_connect_api:handle_msg(Encoded552).
[{send_response,<<"{\"id\":\"-134217311\",\"result\":\"ok\",\"jsonrpc\":\"2.0\"}">>}]

%% Check state
(robot@grisp-001255)5> {ID555, Encoded555} = grisp_connect_api:request(<<"get">>, <<"partition_state">>, #{}).
{<<"-134217295">>,
 <<"{\"id\":\"-134217295\",\"params\":{\"type\":\"partition_state\"},\"method\":\"get\",\"jsonrpc\":\"2.0\"}">>}

(robot@grisp-001255)6> grisp_connect_api:handle_msg(Encoded555).
[{send_response,<<"{\"id\":\"-134217295\",\"result\":{\"message\":\"No update pending, running old partition\",\"state\":\"old_no_update"...>>}]

Improvement and other ideas

Here are some insights and suggestions I encountered while developing:

  • In seawater config highlight the different names of the cert (CA.pem & .pem files).

  • When rebar3 grisp pack - When packing a release, a green test instruction is displayed for non-rebar3 grisp-io plugin users. It could potentially distract users who don’t intend to perform the pack manually. Maybe we can write a warning.

  • Integrating all docu related to setup local dev, maybe in confluence:
    -> 1) Ask for sys.config seawater env vars (api_key & password)
    -> 2) Seawater create an account and add a subscription
    --> 2,1) Explain subscription for testing in Seawater (and that you could use any token for subscription)
    -> 3) Set up locally grisp_connect under grisp_project/_checkout/ with seawater
    --> 3,1) Specify in 0 step where, like create a grisp project, and under _checkouts of grisp board project clone the necessary repos (like grisp_connect, rebar3_grisp, rebar3_grisp_io, grisp_updater_grisp2, etc).

  • Clarify persistent updates: Updates are stored persistently in memory, meaning users need to remove the SD card to boot from the partition. To avoid users restarting using removable.

  • Future idea) rebar3 configure --exisiting_project=<folder> just for things like integrate network a posteriori or Wi-Fi.

@ziopio
Copy link
Member

ziopio commented Sep 23, 2024

Check #40

@ziopio ziopio force-pushed the SEA-298/extend-protocol-to-update-sw branch from 3d4aad7 to a9a2364 Compare September 24, 2024 13:57
src/grisp_connect_api.erl Outdated Show resolved Hide resolved
@ziopio ziopio force-pushed the main branch 3 times, most recently from 80cfc5d to 499da87 Compare September 26, 2024 07:38
@IciaCarroBarallobre IciaCarroBarallobre force-pushed the SEA-298/extend-protocol-to-update-sw branch from 3b02a9b to 52eaf21 Compare September 27, 2024 14:55
README.md Outdated Show resolved Hide resolved
docs/grisp_connect_api.md Outdated Show resolved Hide resolved
src/grisp_connect_api.erl Outdated Show resolved Hide resolved
@IciaCarroBarallobre IciaCarroBarallobre marked this pull request as ready for review October 4, 2024 00:11
src/grisp_connect_updater_progress.erl Outdated Show resolved Hide resolved
docs/grisp_connect_api.md Outdated Show resolved Hide resolved
ziopio and others added 6 commits October 4, 2024 14:31
* Do not loop on sync calls to WS while waiting for a connection

This allows to instantly detect a connection

* Support sending of jsonrpc notifications

* Use new notification to report download progress
* Handle boot_system_not_validated

* Add validate method
Copy link
Member

@ziopio ziopio 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! just check comment

src/grisp_connect_api.erl Outdated Show resolved Hide resolved
@sylane sylane merged commit 7521fec into main Oct 10, 2024
1 check passed
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.

4 participants