There are a variety of ways to get up and running with pi_portal depending on the linux distribution you're running.
This might save someone some trouble…
In some cases unplugging and then reconnecting USB web cameras may renumber the devices. This changes their hardware device name. Since the pi_portal configuration needs to match the hardware device names, this can occasionally cause problems.
For reliability, it's recommended to avoid these types of disconnections while using the application. If this scenario does occur, restarting your Raspberry Pi will restore the original device numbering.
Pi Portal makes heavy use of supervisord to manage processes.
If you have custom configuration for supervisord you will encounter problems during install and uninstall. Deploying Pi Portal as a docker container is strongly recommended in these types of scenarios.
On older Raspberry Pi hardware you should give the supervisor processes plenty of time to startup. Once they are fully loaded any excessive CPU usage should drop off.
This is probably the simplest approach, but requires installing docker. It's recommended to use a Raspberry PI OS docker host to eliminate possible problems with GPIO or video hardware access inside the container.
Steps:
-
Create a configuration file based on your Slack Bot and GPIOs.
-
Identify the GPIO device. On Raspberry PI OS this is
/dev/gpiomem
. -
Identify the video devices of your webcams. Usually this is
/dev/video0
or similar. -
Find your timezone identifier.
-
Install the container as a service:
docker run \ -d \ --restart unless-stopped \ --device [your_gpio_device_name] \ --device [your_webcam_device_name] \ -e TZ=[your_timezone_identifier] \ -v ${PWD}/[your_config_file.json]:/config.json \ ghcr.io/pi-portal/pi-portal:latest
-
Log into Slack and start interacting with your camera and sensors.
Important Note:
- Any user who is a member of the
docker
group will have full access to the container! - This includes snapshots, videos and credentials you've installed.
Other Operating Systems:
- You will run into problems if your linux distribution is missing the
gpio
orvideo
groups:- The docker image expects the GPIO hardware (usually
/dev/gpiomem
) to belong to thegpio
group. - The docker image also expects the video hardware (usually
/dev/video0
) to belong to thevideo
group.
- The docker image expects the GPIO hardware (usually
- For this reason it's recommended to run the container on a Raspberry PI OS system. It's possible to add these groups via udevadm, but keep in mind this will complicate your deployment.
The pi_portal Debian packages are also fairly straightforward to install:
Steps:
-
Identify your CPU architecture:
uname -m
-
Identify the underlying Debian version of your Raspberry PI OS install:
cat /etc/os-release
-
Visit the pi_portal latest release page and download the corresponding Debian package.
-
Install the Debian package:
sudo apt update sudo apt install ./pi-portal_x.x.x-[architecture]_[distribution].deb
-
Create a configuration file based on your Slack Bot and GPIOs.
-
Install your configuration file:
sudo portal install_config [your_config_file.json]
-
Test your installation:
sudo portal version
-
Log into Slack and start interacting with your camera and sensors.
You'll need to roll up your sleeves a little bit when installing pi_portal manually, but it's not that hard…
Steps:
-
Identify your CPU architecture:
uname -m
-
Visit the pi_portal latest release page and download:
- the correct filebeat tarball for your CPU
- the pi_portal python wheel
-
Assume root privileges:
sudo su
-
Install filebeat:
# as root tar xvzf filebeat-linux-[x-x-x]-[architecture].tar.gz -C /usr/bin
-
Install the Python build dependencies. (Commands and exact package names vary by distribution.)
- bash
- build-essential
- libffi-dev
- libssl-dev
- python3 (Versions 3.8 through 3.11 are supported.)
- python3-dev (Versions 3.8 through 3.11 are supported.)
- Note: you may also need to install packages such as
python3-venv
andpython3-pip
if they aren't included in your distribution's corepython3
package.
-
Install the runtime dependencies. (Commands and exact package names vary by distribution.)
-
It would be prudent to stop any services launched for motion or supervisor at this point.
- The installer will attempt this as well, but your distribution may have an incompatible init system.
-
Create the pi_portal user:
# as root useradd pi_portal --no-create-home -s /bin/false -l
-
Take a minute and determine what the
gpio
system group is on your system:- This linux system group is added to
/dev/gpiomem
or similarly named devices to allow non-root access to GPIO hardware. - The user
pi_portal
needs to be a member of this group.
# as root usermod -a -G gpio pi_portal
This group may be named differently, or may not exist at all. Creating this group yourself is possible, via udevadm.
- This linux system group is added to
-
Repeat this same process and identify what the
video
group is on your system:- This linux system group allows non-root access to video hardware.
- The user
pi_portal
needs to be a member of this group.
# as root usermod -a -G video pi_portal
This group may be named differently, or may not exist at all. Creating this group yourself is possible, via udevadm.
-
Create a configuration file based on your Slack Bot and GPIOs.
-
Install the pi_portal wheel:
# as root mkdir -p /opt/venvs python3 -m venv /opt/venvs/pi_portal source /opt/venvs/pi_portal/bin/activate pip install ./pi_portal-x.x.x-py3-none-any.whl chown -R pi_portal:pi_portal /opt/venvs/pi_portal chmod -R o=- /opt/venvs/pi_portal
- It's possible to change the location by setting an environment variable.
-
While still acting as root, install your configuration file:
# as root pi_portal install_config [your_config_file.json]
-
Confirm your installation was successful:
# as root portal version
-
Drop root privileges:
# as root exit
-
You may need to manually start the supervisor service if the installer doesn't recognize your init system.
-
Log into Slack and start interacting with your camera and sensors.