Installation
Simple IoT will run on the following systems:
- ARM/x86/RISC-V Linux
- MacOS
- Windows
The computer you are currently using is a good platform to start with as well as any common embedded Linux platform like the Raspberry PI.
If you needed an industrial class device, consider something from embeddedTS
like the TS-7553-V2.
The Simple IoT application is a self contained binary with no dependencies. Download the latest release for your platform and run the executable. On Linux and MacOS, the download needs to be marked executable first:
chmod +x simpleiot-vX.Y.Z-linux-x86_64
./simpleiot-vX.Y.Z-linux-x86_64
Renaming it to siot is convenient if you plan to keep it in your PATH.
Once running, you can log into the user interface by opening http://localhost:4223 in a browser. The default login is:
- user:
admin - pass:
admin
These defaults let an instance start with no configuration on a bench or a
closed network. While the admin password is unchanged, or no SIOT_AUTH_TOKEN
is set, the server says so in its log at start-up and the UI shows a notice
after sign-in.
Before the instance is reachable by anyone else, change the password and then
set SIOT_AUTH_TOKEN; without a token, NATS and MQTT accept connections without
credentials. Once a token is set, sign-in with the default password is refused,
so change the password first. If the token is already set, write the admin
user’s pass point with siot import and sign in with the
new password. The
deployment checklist has the full
list.
Simple IoT self-install (Linux only)
Simple IoT self-installation does the following:
- creates a Systemd service file
- creates a data directory, readable by the service user only
- generates an auth token into
siot.envin the data directory (mode0600), which the service reads; an existing file is kept on reinstall - starts and enables the service
To install as user, copy the siot binary to some location like
/usr/local/bin and then run:
siot install
To install as root:
sudo siot install
The default ports are used (HTTP on 4223, NATS on 4222); to move them, set
SIOT_NATS_PORT in the generated siot.service file, and the other ports
follow it. The siot command line tools need the token from siot.env, for
example
siot log -token $(sed -n 's/^SIOT_AUTH_TOKEN=//p' /var/lib/siot/siot.env).
A root install adds systemd sandboxing: the service cannot gain privileges, sees
the rest of the system read-only, and may write only its data directory and the
directory its binary lives in (for siot update). A client that needs hardware
access has to be allowed it in a drop-in, for example for a serial port:
sudo systemctl edit siot
[Service]
SupplementaryGroups=dialout
DeviceAllow=/dev/ttyUSB0 rw
systemd-analyze security siot shows what the unit still allows.
Updating
Simple IoT can update itself to the latest release:
siot update
This downloads the release for the platform it is running on, verifies it
against the checksums published with the release, and replaces the binary in
place. The new binary is written to the directory the current one lives in, so
if Simple IoT is installed somewhere like /usr/local/bin, run
sudo siot update. To see what is available without installing it, use:
siot update -check
The new version starts running the next time Simple IoT starts, so if it is installed as a service, restart the service:
systemctl restart siot
Updating replaces the executable and leaves the data directory alone, so
configuration and historical data carry forward. The previous binary is removed
once the new one is in place, so keep a copy if you want to be able to return to
it. On Windows, the previous version is left alongside the new one as
siot.exe.old.
Note that siot update updates the Simple IoT application itself. To update the
operating system on an embedded device, see the update client.
Cloud/Server deployments
When on the public Internet, Simple IoT should be proxied by a web server like Caddy to provide TLS/HTTPS security. Caddy by default obtains free TLS certificates from Let’s Encrypt and ZeroSSL with automatic fallback if one provider fails. A Caddyfile for an instance on the default ports is:
siot.example.com {
reverse_proxy localhost:4223
}
Devices and MQTT clients that connect to the NATS port (4222) or the MQTT port
directly do not go through Caddy, so those listeners need a certificate of their
own. Set SIOT_NATS_TLS_DOMAIN to the instance’s name and Simple IoT obtains
one from Let’s Encrypt and renews it, keeping it under SIOT_DATA/certs. The
CA validates the name by fetching a path under /.well-known/acme-challenge/,
which Caddy proxies to Simple IoT like any other request, so the Caddyfile above
needs no change. Caddy and Simple IoT each hold their own certificate for the
name. See the configuration page for the settings,
including a staging CA to try first, and the
security reference for what the challenge route
exposes.
A certificate managed elsewhere can be used instead with SIOT_NATS_TLS_DIR or
the SIOT_NATS_TLS_CERT and SIOT_NATS_TLS_KEY paths. Pointing the directory
setting at Caddy’s own store works, but Caddy’s files are readable only by its
user, so that needs Simple IoT to run as root or a copy step; the domain setting
avoids that.
There are Ansible recipes available to deploy Simple IoT, Caddy, InfluxDB, and Grafana that work on most Linux servers.
Video: Setting up a Simple IoT System in the cloud
Building images
An image that runs Simple IoT on many units needs each unit to end up with its
own identity and credential. Ship a provisioning file (see
provisioning) with a sync node
that carries an enrollToken and no authToken; each unit generates its own
key on first start and
enrolls itself with the upstream. Do
not ship device.nkey in a shared image, since every unit would then be the
same device.
Yocto Linux
Yocto Linux is a popular edge Linux solution. There is a BitBake recipe for including Simple IoT in Yocto builds.
Networking
By default, Simple IoT runs an embedded NATS server and the SIOT NATS client is
configured to connect to nats://127.0.0.1:4222.