Building the SOTA Client
The simplest way to build the client is via Docker, which is used for compiling and running the client. You’ll find a Makefile in the client repo that offers targets using Docker to build and run everything.
Alternatively, you can compile locally with Rust and Cargo. (You’ll need to go this route if you’re not building x86_64.) We recommend installing both via Rustup.
Building with Docker and make
Run make help
to see the full list of targets, which are:
Target | Description |
---|---|
run |
Run the client inside a Docker container. |
clean |
Remove all compiled libraries, builds and temporary files. |
test |
Run all cargo tests. |
doc |
Generate documentation for the sota crate. |
clippy |
Run clippy lint checks using the nightly compiler. |
client |
Compile a new release build of the client. |
image |
Build a Docker image for running the client. |
deb |
Create an installable DEB package of the client. |
rpm |
Create an installable RPM package of the client. |
version |
Print the version that will be used for building packages. |
Configuration
You can configure how the client starts with make run
by setting the following environment variables:
Variable | Default value | Description |
---|---|---|
|
|
Set to true to authenticate on startup. |
|
|
Set to true to generate a config file then quit. |
|
The Auth server for client authentication. |
|
|
The Core server for client communication. |
|
|
The server used for registering new devices. |
|
|
|
Path to write the newly generated config. |
|
|
Path to the template for new config files. |
|
(generated) |
Use this VIN rather than generating a new one. |
|
(generated) |
Use this UUID rather than generating a new one. |
|
(from registry server) |
Use this client ID for authentication. |
|
(from registry server) |
Use this client secret for authentication. |
For example, running CONFIG_ONLY=true make run
will output a newly generated sota.toml
to stdout then quit.
Further customization
Every value in the generated sota.toml
config file can be overwritten in the run/sota.toml.env
file.
In addition, each config value is available as a command line flag when starting the client. Command line flags take precedence over the values set in the config file. Run sota_client --help
to see a full list.
Building locally
As long as you’re on a platform that Rust supports, you should be able to build the client. The general steps are:
-
Install rust with rustup
-
Make sure you have the necessary dependencies installed, particularly
libdbus-dev
andlibssl-dev
-
Clone the client repo (preferably the stable branch)
-
Compile using
cargo build --release
That’s really it! At the moment, there is one extra step: we need to pin a particular version of hyper, a Rust HTTP library, due to some ssl fixes that are not yet in the release branches. There’s a Makefile target for that, though; just run make rust-openssl
before you build.
apt-get update && apt-get install -y autoconf git libdbus-1-dev libtool openssl \ libssl-dev lshw jq curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y export PATH=/root/.cargo/bin:$PATH git clone https://github.com/advancedtelematic/rvi_sota_client.git -b stable cd rvi_sota_client make rust-openssl cargo build --release cp run/sota_certificates /etc/ cp run/system_info.sh /usr/bin/
Once you have the client built, you’ll probably want to take a close look at the configuration guide and perhaps the commands and events reference.