/tinypilot

Use your Raspberry Pi as a browser-based KVM.

Primary LanguagePythonMIT LicenseMIT

TinyPilot

CircleCI License

Overview

Turn your Raspberry Pi into a browser-based KVM.

TinyPilot demo

Pre-requisites

  • Raspberry Pi OS Stretch or later
  • python3-venv

Hardware requirements

See "TinyPilot: Build a KVM Over IP for Under $100" for a more detailed tutorial on how to assemble these parts to create a TinyPilot.

Simple installation

The following installation steps:

  • Create a service account for TinyPilot with limited priviliges.
  • Install TinyPilot as a systemd service so it runs automatically on every boot.
  • Install TinyPilot's dependencies.

From your Raspberry Pi device, run the following commands:

curl \
  --silent \
  --show-error \
  https://raw.githubusercontent.com/mtlynch/tinypilot/master/quick-install | \
    bash - && \
  sudo reboot

When your Pi reboots, you should be able to access TinyPilot by visiting your Pi hostname in the browser. For example, if your device is named raspberrypi:

Remote installation

If you have Ansible installed on your local machine, you can configure TinyPilot on a Raspberry Pi device using the TinyPilot Ansible role. To configure TinyPilot remotely, run the following commands from your Ansible control node:

PI_HOSTNAME="raspberrypi" # Change to your pi's hostname
PI_SSH_USERNAME="pi"      # Change to your Pi username

# Install the TinyPilot Ansible role
ansible-galaxy install mtlynch.tinypilot

# Create a minimal Ansible playbook to configure your Pi
echo "- hosts: $PI_HOSTNAME
  roles:
    - role: mtlynch.tinypilot" > install.yml

ansible-playbook \
  --inventory "$PI_HOSTNAME", \
  --user "$PI_SSH_USERNAME" \
  --ask-pass \
  --become \
  --become-method sudo \
  install.yml

ansible \
  "$PI_HOSTNAME" \
  -m reboot \
  --inventory "$PI_HOSTNAME", \
  --user "$PI_SSH_USERNAME" \
  --ask-pass \
  --become \
  --become-method sudo

After running these commands, you should be able to access TinyPilot through a web browser at:

Developer installation

If you're interesting in contributing to TinyPilot, follow these instructions to install the required developer packages in your development environment:

python3.7 -m venv venv
. venv/bin/activate
pip install --requirement requirements.txt
pip install --requirement dev_requirements.txt
hooks/enable_hooks

To run TinyPilot's build scripts, run:

./run_build

To enable TinyPilot's Git hooks, run:

./hooks/enable_hooks

To run TinyPilot on a non-Pi machine, run:

PORT=8000 HID_PATH=/dev/null ./app/main.py

Options

TinyPilot accepts various options through environment variables:

Environment Variable Default Description
HOST 0.0.0.0 Network interface to listen for incoming connections.
PORT 8000 HTTP port to listen for incoming connections.
HID_PATH /dev/hidg0 Path to keyboard HID interface.

Upgrades

The installation script is idempotent, so you can upgrade to the latest stable release of TinyPilot and its dependencies by just re-running the quick install script.

Security considerations

TinyPilot does not support authentication. You should only use TinyPilot on networks that you trust. Anyone who accesses the TinyPilot URL can shutdown or restart your Pi and type arbitrary commands into the device to which your Pi is connected.

If you need authentication, the simplest solution would be to adjust your Nginx configuration (included by default with the installation) to require HTTP Basic Authentication.

Support

If this project is useful to you, consider making a financial contribution to support its development:

See also