Skip to content

Daemon mode (GRPC) + pluggable discovery #217

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

Merged
merged 169 commits into from
Jun 3, 2019
Merged

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented May 28, 2019

This (quite big) PR adds a "daemonized" mode to arduino-cli. When the cli is launched with the command arduino-cli daemon it starts to listen to the TCP port :50051 waiting for gRPC commands.

  • First of all we encoded all the exising arduino-cli commands into a protobuffer gRPC API, the definition can be found inside the rpc/*.proto files.
  • All the existing arduino-cli commands (inside commands folder) have been ported to use the gRPC request/response structures (generated from the .proto files) as input/output.
  • The command line parsing has been extracted from commands and isolated into cli folder.
  • The RPC server implementation has been done in the daemon folder. The gRPC server can now just directly forward the incoming rpc calls toward the cli commands implementation in the commands folder.
  • There is an RPC client example inside daemon/client folder.
  • The "classic" JSON output still works, it's simply implemented by JSON-serializing the gRPC responses.
  • The pluggable discovery has been merged here and it's used for the serial discovery on linux64 only (MDNS discovery and all the OS variants will be added later)
  • The gRPC API is 95% done, but it may be subject to last minute change.

cmaglie and others added 30 commits January 30, 2019 00:22
All the arduino-cli commands implementation has been moved from package
`command` to package `cli`.

The `board details` command has been choosen as a 'tracing bullet' to
reimplement all the cli command using grpc/protoc to generate
Request/Response (input/output) structures.

We should probably abandon the idea to use a generic `formatter` module
since it seems that it doesn't help to reduce boilerplate code (for
example in the `board details` command there is no need for the
`formatter` module nor it's clear how it can improve things).

The `output` module now has only functions for pretty-printing data.
Normal errors are automatically wrapped into GRPC errors with code
equals to "Unknown".
With this patch we correctly forward output messages (to the CLI
terminal or to the GRPC client).
@cmaglie cmaglie added the type: enhancement Proposed improvement label May 28, 2019
@cmaglie cmaglie added this to the next alpha milestone May 28, 2019
@CLAassistant
Copy link

CLAassistant commented May 28, 2019

CLA assistant check
All committers have signed the CLA.

@arduino arduino deleted a comment from ArduinoBot May 28, 2019
@per1234
Copy link
Contributor

per1234 commented Jun 1, 2019

@cmaglie all the test build URLs are giving 404 errors. That's no problem for me because it's easy enough for me to build from source, but if this indicates a problem with the build system it would be nice to get it fixed to make it easy for anyone to do beta testing.

@facchinm
Copy link
Member

facchinm commented Jun 3, 2019

Hi @per1234 ,
the links should be ok now, there was a misconfiguration of the URL we were uploading to.

@cmaglie cmaglie merged commit 15bf593 into arduino:master Jun 3, 2019
@cmaglie cmaglie deleted the daemon branch June 3, 2019 22:45
@ArduinoBot
Copy link
Contributor

✅ Build completed.

⬇️ Linux 64: https://downloads.arduino.cc/PR/arduino-cli/arduino-cli-51-PR217-linux64.tar.bz2

⬇️ Linux 32: https://downloads.arduino.cc/PR/arduino-cli/arduino-cli-51-PR217-linux32.tar.bz2

⬇️ Linux ARM: https://downloads.arduino.cc/PR/arduino-cli/arduino-cli-51-PR217-linuxarm.tar.bz2

⬇️ Windows: https://downloads.arduino.cc/PR/arduino-cli/arduino-cli-51-PR217-windows.zip

⬇️ OSX: https://downloads.arduino.cc/PR/arduino-cli/arduino-cli-51-PR217-osx.zip

ℹ️ To test this build:

  1. Just replace arduino-cli binary with the provided one

@arduino arduino deleted a comment from ArduinoBot Jun 4, 2019
mastrolinux pushed a commit that referenced this pull request Jul 16, 2019
Daemon mode (GRPC) + pluggable discovery
per1234 added a commit that referenced this pull request Aug 9, 2021
Sync installation assets from template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants