tiny-pilot / tinypilot

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

Refactor ustreamer service installation from Ansible to Debian #1549

Closed mtlynch closed 1 year ago

mtlynch commented 1 year ago

As part of the Ansible to Debian refactoring, we should replace our Ansible-based install of the uStreamer systemd service to an install that uses Debian packaging.

We have ported several other systemd services from Ansible to Debian, so we know generally what this process looks like. Our previous experience with this:

Here, I'd like to move the uStreamer service install to the TinyPilot Debian package.

Normally, the service would be part of the same package as the binary, but in this case, we want the uStreamer service in the TinyPilot Debian package for a few reasons:

  1. It's easier to have more code in the TinyPilot monorepo than to straddle changes across the TinyPilot repo and the ustreamer-debian repo.
  2. The systemd service is not a native part of uStreamer but rather a TinyPilot-specific service + wrapper script that we created.

Follow these steps to implement the change and verify that it works as expected:

  1. (For background) Read the first half of the Ansible-to-Debian refactoring doc (until the section "Testing your changes")
  2. In the uStreamer Ansible role, delete the tasks related to installing and enabling the service file.
  3. Delete the task for copying the launch script
  4. Delete the reload systemd config handler and any lines that refer to it (e.g., this one)
  5. Delete the restart uStreamer handler and any lines that refer to it.
  6. Move ansible-role-ustreamer/files/launch to debian-pkg/opt/ustreamer-launcher/launch
  7. Move ansible-role-ustreamer/files/ustreamer.service to debian-pkg/debian/tinypilot.ustreamer.service
    • We'll create the source file in #1550
  8. Add a line to the override_dh_installsystemd section of rules for the ustreamer service like dh_installsystemd --name=ustreamer
  9. Build a one-off TinyPilot Community install bundle with your changes.
  10. Install the bundle on a bare Raspbian system.
  11. Verify that video streaming works on the new TinyPilot install.
  12. Create a draft PR from your TinyPilot repo changes.
  13. Add test instructions to your draft PR that allows a teammate to easily test your changes
  14. Submit your PR for review.
  15. After the PR is approved, perform the pre-merge tests on your TinyPilot repo changes.
  16. Merge your PR.