Fioctl¶
This section assumes you have followed Getting started to its completion. The aim of this section is to provide you with a template for using Fioctl by way of example.
Enabling/Disabling Apps¶
By default all apps defined in containers.git for any given tag are enabled. To change this behaviour, a list of allowed apps can be given per device, enabling only those apps that are in a comma separated list.
Via Fioctl¶
fioctl devices config updates <device_name> --apps <app_name1>,<app_name2>
- Set the app(s) a device will run.
Example
# First, list Targets and ensure app(s) are available in the latest Target.
$ fioctl targets list -f cowboy
# Find a device to instruct by name.
$ fioctl devices list -f cowboy
# Enable only the desired app(s) on the device.
$ fioctl devices config updates cowboy-device-1 --apps netdata,shellhttpd
# Now only the app(s) supplied in the list will run on the device.
Via lmp-device-register¶
When registering a device, lmp-device-register
can set a list of apps to
enable.
lmp-device-register --api-token=<token> --apps <app_name1>,<app_name2>
- Set the app(s) a device will run, during registration.
Inspecting Targets¶
A Factory produces Targets whenever a change is pushed to the Factory Source Code. A Target is a description of the software a device should run, as defined by a list of metadata which includes an OSTree Hash and one or more Docker-Compose App URIs.
This metadata is recorded upon Target creation, making the Target an immutable description of the Factory at a point in time.
Fioctl provides many methods of viewing Target metadata, which can reveal:
- What apps are available inside the Target.
- What tag a Target has.
- What MACHINE a Target has been produced for (HARDWARE ID).
- What git commits caused the Target to be produced.
Target metadata can be inspected by using 3 primary commands
fioctl targets list
Lists the Targets a Factory has produced so far.
Click to show command outputfioctl targets list -r
Lists the Targets a Factory has produced in
-r
(raw) json format. This is often piped intojq
in order to format the json neatly.The command output below has highlighted the
docker_compose_apps
section, which contains the names of apps that are available in this Target, as well as their Docker-Compose App URIs.Additionally, the OSTree Hash for the Target has been highlighted.
Click to show command outputfioctl targets show <target>
Prints detail about a specific Target, (e.g
fioctl targets show 58
).These details include:
A web link to the CI build produced for this Target where to view the console.log or download artifacts.
The hashes for each repo in the Factory Source Code at the time the Target was produced.
The OSTree Hash for this Target.
The Docker-Compose App URI for each available app at the time the Target was produced.
Click to show command output
Common Commands¶
- View Targets
fioctl targets list -f <factory>
Lists the Targets a Factory has produced so far:
$ fioctl targets list -f bebop VERSION TAGS APPS HARDWARE IDs ------- ---- ---- ------------ 2 devel raspberrypi3-64 3 main raspberrypi3-64 4 main shellhttpd raspberrypi3-64 5 main shellhttpd raspberrypi3-64 6 main raspberrypi3-64 7 main raspberrypi3-64 8 main httpd raspberrypi3-64 11 main octofio raspberrypi3-64
- List devices
fioctl devices list -f <factory>
- Lists the devices that have connected to a Factory, along with associated metadata, such as device name, status, Target and enabled apps.
- Set device tag
fioctl devices config updates <device_name> --tag <tag>
- Filter the Targets a device will accept by tag. For example, to move a device from accepting ‘devel’ builds to ‘main’ builds. See the Advanced Tagging section for more examples.
- Set app(s) to be enabled
fioctl devices config updates <device_name> --apps <app_name1>,<app_name2>
Set the app(s) a device will run.
- Enable WireGuard VPN
fioctl devices config wireguard <device_name> <enable|disable>
- Enable or disable the Wireguard systemd service on a LmP device. This requires that you configure a Factory to use an instance of Wireguard you have set up on your own server as described in the WireGuard VPN guide.