Detailing some thoughts here from a conversation with @notplants :
Having multiple JSON-RPC microservices is great for modularity and interoperability but not so great for simplicity and minimising resource use.
One option is to group all JSON-RPC servers into one and allow selecting feature sets through configuration variables. For example, configuring the server to only expose RPCs for networking and stats while disabling the OLED features. This would mean we have a single binary running as a single process running on a single port; much easier in terms of devops, versioning, updating and system deployment.
An additional change would be to make the JSON-RPC server completely optional by separating the business logic of each microservice and placing it in a common library. Crate organisation might then look like this:
# contains core logic, such as wpasupplicant commands for networking
peach-lib
# wraps functionality from peach-lib and exposes it via RPC
peach-jsonrpc-server
# provides client methods for making RPC calls against the server
peach-jsonrpc-client
This would allow a single binary to bundle the entirety of the functionality currently exposed through the PeachCloud web interface (not including configuration, static assests etc.). One of the major advantages of this approach is optimising for minimal resource use.
A follow-on refactor would be to bundle peach-menu, peach-buttons and peach-oled into a single binary for the physical menu system.
Detailing some thoughts here from a conversation with @notplants :
Having multiple JSON-RPC microservices is great for modularity and interoperability but not so great for simplicity and minimising resource use.
One option is to group all JSON-RPC servers into one and allow selecting feature sets through configuration variables. For example, configuring the server to only expose RPCs for networking and stats while disabling the OLED features. This would mean we have a single binary running as a single process running on a single port; much easier in terms of devops, versioning, updating and system deployment.
An additional change would be to make the JSON-RPC server completely optional by separating the business logic of each microservice and placing it in a common library. Crate organisation might then look like this:
```bash
# contains core logic, such as wpasupplicant commands for networking
peach-lib
# wraps functionality from peach-lib and exposes it via RPC
peach-jsonrpc-server
# provides client methods for making RPC calls against the server
peach-jsonrpc-client
```
This would allow a single binary to bundle the entirety of the functionality currently exposed through the PeachCloud web interface (not including configuration, static assests etc.). One of the major advantages of this approach is optimising for minimal resource use.
A follow-on refactor would be to bundle `peach-menu`, `peach-buttons` and `peach-oled` into a single binary for the physical menu system.
I may have just created peach-jsonrpc-client (Saturday-evening desire to program).
It only has four dependencies and provides RPC client functions for peach-network, peach-oled and peach-stats. I've replaced snafu with a custom error implementation and serde with miniserde.
The RPC client code for calling the dyndns-server still needs to be extracted from peach-lib.
Just figured I'd mention this here so we know it's in the bag if / when we wish to do this refactor.
I may have just created `peach-jsonrpc-client` (Saturday-evening desire to program).
It only has four dependencies and provides RPC client functions for `peach-network`, `peach-oled` and `peach-stats`. I've replaced `snafu` with a custom error implementation and `serde` with `miniserde`.
```yaml
log = "0.4"
jsonrpc-client-core = "0.5"
jsonrpc-client-http = "0.5"
miniserde = "0.1.15"
```
The RPC client code for calling the dyndns-server still needs to be extracted from `peach-lib`.
Just figured I'd mention this here so we know it's in the bag if / when we wish to do this refactor.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Detailing some thoughts here from a conversation with @notplants :
Having multiple JSON-RPC microservices is great for modularity and interoperability but not so great for simplicity and minimising resource use.
One option is to group all JSON-RPC servers into one and allow selecting feature sets through configuration variables. For example, configuring the server to only expose RPCs for networking and stats while disabling the OLED features. This would mean we have a single binary running as a single process running on a single port; much easier in terms of devops, versioning, updating and system deployment.
An additional change would be to make the JSON-RPC server completely optional by separating the business logic of each microservice and placing it in a common library. Crate organisation might then look like this:
This would allow a single binary to bundle the entirety of the functionality currently exposed through the PeachCloud web interface (not including configuration, static assests etc.). One of the major advantages of this approach is optimising for minimal resource use.
A follow-on refactor would be to bundle
peach-menu,peach-buttonsandpeach-oledinto a single binary for the physical menu system.I may have just created
peach-jsonrpc-client(Saturday-evening desire to program).It only has four dependencies and provides RPC client functions for
peach-network,peach-oledandpeach-stats. I've replacedsnafuwith a custom error implementation andserdewithminiserde.The RPC client code for calling the dyndns-server still needs to be extracted from
peach-lib.Just figured I'd mention this here so we know it's in the bag if / when we wish to do this refactor.