tiny-pilot / tinypilot

Use your Raspberry Pi as a browser-based KVM.
https://tinypilotkvm.com
MIT License
3k stars 252 forks source link

Install uStreamer Launcher with Debian packaging #1592

Closed mtlynch closed 1 year ago

mtlynch commented 1 year ago

Resolves #1549 Related https://github.com/tiny-pilot/tinypilot-pro/issues/972

Overview

ustreamer-launcher is our thin wrapper around the uStreamer binary. It reads settings from YAML files and then generates the appropriate command-line string to execute uStreamer with command-line flags that match the settings in the YAML files.

Previously, we installed ustreamer-launcher with Ansible. This change performs the install through Debian packaging, as part of our ongoing efforts to eliminate Ansible from our install.

Design changes

The Ansible-based installer had a lot of complexity around how it populated the base uStreamer config file at /opt/ustreamer-launcher/configs.d/000-defaults.yml.

The Ansible-based installer wrote all of the non-null uStreamer settings to 000-defaults.yml, but this is an artifact of when ustreamer-launcher was meant to be a general-purpose uStreamer tool rather than something TinyPilot specific. ustreamer-launcher was creating a 000-defaults.yml file that was open-ended because the client using the Ansible role could theoretically specify any Ansible vars.

This change simplifies ustreamer-launcher to the TinyPilot use case. We are either specifying the unique defaults for the TC358743 scenario (e.g., Voyager) or the HDMI to USB dongle scenario (Hobbyist).

Now, instead of the installer dynamically writing arbitrary settings to 000-defaults.yml, that file is a symlink that can point to one of two files.

We have two static YAML files that are always installed on the filesystem: one for TC358743 and one for HDMI to USB. At install time, tinypilot.postinst ensures that 000-defaults.yml is a symlink that points to either the TC358743 settings or the HDMI to USB settings depending on whether TC358743 is enabled.

Functional changes

This is mostly a non-functional refactoring, but for the sake of simplicity, we're now ignoring these YAML settings:

Previously, it was possible for users to override these settings in /home/tinypilot/settings.yml and ustreamer-launcher would launch uStreamer with corresponding command-line flags. We never documented these settings in a customer-facing place, and I don't know of any users exercising them, so we can remove them.

We are also changing the permissions on the files in /opt/ustreamer-launcher. Previously, the ownership was a mixture of root and ustreamer. There isn't actually a need for ustreamer to be an owner, so we're simplifying to root owning everything. tinypilot still owns its override file, so the app can dynamically make changes to settings.

Manual tests

To test this bundle, run:

curl \
  --silent \
  --show-error \
  --location \
  https://raw.githubusercontent.com/tiny-pilot/tinypilot/master/scripts/install-bundle | \
  sudo bash -s -- \
    https://output.circle-artifacts.com/output/job/8d968bdd-9797-4437-ae4c-2754c8913f40/artifacts/0/bundler/dist/tinypilot-community-20230825T1401Z-1.9.0-80+5ff91e0.tgz

Review on CodeApprove

mtlynch commented 1 year ago
Automated comment from CodeApprove ➜

⏳ @jotaen4tinypilot please review this Pull Request

mtlynch commented 1 year ago

I stacked this on top of https://github.com/tiny-pilot/tinypilot/pull/1588 for the convenience of having bundles build on each commit, so I'll wait to merge until that PR goes in first.