gbbirkisson / rpi

A gRPC server for remote IO operations on the RaspberryPi + cli tool to call it

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rpi

This package helps you to develop software for the RaspberryPi that does IO operations on the RaspberryPi. It enables you to develop your code locally on any type of architecture, by using gRPC to control a Raspberry PI remotely. This is very convenient in conjunction with services like balena.io.

This makes developing applications for the RaspberryPi extremely easy. Once your software is ready, you have the option of continuing to use gRPC calls, or switch over to a local version of the interfaces to compile a binary that runs directly on the RaspberryPi.

If you have any suggestion or comments, please feel free to open an issue on this GitHub page.

Using the library

Read the go docs to to see usage. For more concrete examples see rpi-client code.

Installing

Client / Server

There are 2 ways of installing the binaries:

  • Download the binaries latest release
  • Install from source: go get github.com/gbbirkisson/rpi

Pushing server to balena.io

Take a look at the rpi-balena project to see how to use balena.io

Configuration

Both server and client can be configured with:

  1. Flags
  2. Environment
  3. Configuration file

The presidence is in that order, i.e flags override environment that overrides the configuration file.

Flags

Use -h flag to see available flags for rpi-client and rpi-server.

Configuration files

Configuration files can be in the following formats:

  • json
  • toml
  • yaml
  • hcl

Locations of those files are:

  • Server: /etc/rpi-server/config.[format]
  • Client: ~/.rpi-client.[format]

To generate the default configuration files (yaml in this example) do:

# For server
$ touch /etc/rpi-server/config.yaml
$ rpi-server config write
# For client (linux/mac)
$ touch ~/.rpi-client.yaml
$ rpi-client config write
# For client (windows)
$ type nul > %userprofile%\.rpi-client.yaml
$ rpi-client.exe config write

The resulting client configuration file (~/.rpi-client.yaml) would be something like:

server:
  host: 127.0.0.1
  port: 8000
  timeout: 5000
picam:
  viewer:
  - feh
  - -x
  - '-'

Environmental variables

Environmental variables mirror the configuration files. All variables have the prefix RPI_. So for example if you want to set the client timeout you can set it with the environment variable RPI_SERVER_TIMEOUT=3000

Using another languages

Generate a client for your language of choice with protoc using ./pkg/proto/*.proto files.

About

A gRPC server for remote IO operations on the RaspberryPi + cli tool to call it

License:Apache License 2.0


Languages

Language:Go 96.7%Language:Dockerfile 1.8%Language:Shell 1.1%Language:Makefile 0.4%