This setup guide provides detailed instructions for installing, configuring, and running the Pi Monitor System. The system consists of a server application and client scripts running on Raspberry Pis connected to monitors. This document covers the prerequisites, installation steps, and maintenance procedures for both the server and clients.
- Prerequisites
- Server Setup
- Client Setup
- Auto-Update Mechanism
- Maintenance
- Security Considerations
- Contact
- Operating System:
- Recommended: Linux (e.g., Arch Linux, Ubuntu)
- Alternative: macOS (functionality may vary; Linux is preferred)
- Python 3: Version 3.7 or higher
- Internet Access: For fetching announcements and accessing external APIs
- Google API Credentials:
announcements/credentials.json
file with valid credentials to access the Google Docs API- Note: Contact Mr. Rozenberg to obtain access to the
credentials.json
file; his account owns the Google Cloud Platform project associated with this system.
-
For Raspberry Pi Deployment:
- Hardware: Raspberry Pi, with some screen connected
- Operating System: Raspberry Pi OS (formerly Raspbian)
- Internet Access: Internal network access to the server
- Physical Access: For initial setup and troubleshooting
-
For Local Development and Debugging:
- Operating System:
- Linux (preferred)
- macOS (possible, but not extensively tested)
- Browser: Chromium or Google Chrome
- Internet Access: Access to the server (can be running locally)
- Operating System:
Such a setup has already been performed, and the server is running in Room 203 on the Arch Linux desktop there. But you may wish to reconfigure it, or deploy to a new server.
Install the following packages on the server:
-
Python Packages:
- FastAPI
- Uvicorn
- Bcrypt
- Google API Client
- Refer to
requirements.txt
for the full list
-
System Packages:
git
jq
python3-virtualenv
orpython-virtualenv
-
Optional:
kakoune
(text editor)
-
Clone the Repository:
mkdir ~/src cd ~/src git clone https://github.com/a13xrzteach/a13xrzteach.github.io/ cd a13xrzteach.github.io
-
Set Up Virtual Environment:
cd pi virtualenv env source env/bin/activate pip install -r ../requirements.txt
-
Configure Google API Credentials:
- Obtain the
credentials.json
file from Google Cloud Platform. - Place the file in the
announcements
directory:cp /path/to/credentials.json ./announcements/credentials.json
- Obtain the
-
Disable Power Saving and Screen Locks (if applicable):
- Adjust settings in the desktop environment (e.g., KDE) to prevent the server from sleeping or locking the screen.
To start the server application:
-
Navigate to the Server Directory:
cd ~/src/a13xrzteach.github.io/pi
-
Run the Server Script:
./server
-
The script will output the private IP address and port number on which the server is running.
-
Example output:
pi server: Serving /home/oboro/src/a13xrzteach.github.io on port 17860 pi server: Private IP address: 10.242.207.207
-
-
Keep the Terminal Open:
- Leave the terminal window running to keep the server active.
The clients (Raspberry Pis) can be set up automatically using the client_setup
script. If you prefer to operate it manually, look at the script for reference
on what to follow.
-
Access the Setup Script:
-
If the server is running and accessible, use the following command:
curl 10.242.207.207:17860/setup | sh
Replace
10.242.207.207:17860
with the actual IP address and port of the server. -
If the server is not accessible, fetch the script directly from GitHub:
curl "https://raw.githubusercontent.com/a13xrzteach/a13xrzteach.github.io/main/pi/client_setup" | sh
-
-
Script Execution:
- The script will perform the following actions:
- Update and upgrade system packages.
- Install required packages (
git
,chromium
,kakoune
). - Clone the repository into
~/src
. - Configure Git settings.
- Set up the autostart script to run on boot.
- Reboot the Raspberry Pi.
- The script will perform the following actions:
-
Post-Reboot Behavior:
- Upon reboot, the Raspberry Pi will automatically start the
startup
script, which manages the client application.
- Upon reboot, the Raspberry Pi will automatically start the
For development and debugging purposes, you may want to run the client on your local machine.
Note: Do not run the client_setup
script on your local machine. It is
intended only for Raspberry Pis.
-
Ensure Dependencies are Installed:
- Linux (Preferred): Install
git
,chromium
orgoogle-chrome
, and any necessary development tools. - macOS: Install
git
andgoogle-chrome
.
- Linux (Preferred): Install
-
Clone the Repository:
mkdir ~/src cd ~/src git clone https://github.com/a13xrzteach/a13xrzteach.github.io/ cd a13xrzteach.github.io
-
Modify the Endpoint (if necessary):
-
In the
pi/client
script, adjust theendpoint
variable to point to your local server or the appropriate address.endpoint="http://localhost:17860/"
-
-
Start the Server Locally (if not already running):
- Follow the Server Setup instructions to start the server on your local machine.
-
Run the Client Script Manually:
-
Instead of using the
client_setup
script, you can run theclient
script directly:cd ~/src/a13xrzteach.github.io/pi ./client
-
This will launch Chromium in kiosk mode pointing to the specified endpoint.
-
-
Development Tips:
- Disable Kiosk Mode:
- For easier debugging, you might want to disable kiosk mode by removing
the
--kiosk
flag in theclient
script.
- For easier debugging, you might want to disable kiosk mode by removing
the
- Inspect Elements:
- Use browser developer tools to inspect elements and debug JavaScript code.
- Disable Kiosk Mode:
-
Client Auto-Updates:
- The
client_manager
script ensures that clients automatically pull updates from the GitHub repository. - Clients periodically restart to apply updates and refresh content.
- The
-
Server Updates:
- The server does not have an auto-update mechanism.
- To update the server, pull the latest code and restart the server script.
-
Pull Latest Changes:
cd ~/src/a13xrzteach.github.io git pull
-
Restart the Server:
-
Stop the running server process (e.g., by closing the terminal or stopping the process).
-
Start the server again:
cd pi ./server
-
-
Raspberry Pis:
- Clients update themselves automatically via the
client_manager
script. - No manual intervention is required unless there are issues.
- Clients update themselves automatically via the
-
Local Development:
-
Manually pull updates as needed:
cd ~/src/a13xrzteach.github.io git pull
-
-
Server Issues:
- Server Not Responding:
- Ensure the server script is running.
- Check network connectivity.
- Authentication Problems:
- Verify the
config/monitor_password.txt
contains the correct bcrypt-hashed password. - Ensure that credentials are entered correctly when accessing the content management GUI.
- Verify the
- Server Not Responding:
-
Client Issues:
- Display Not Updating:
- Check if the Raspberry Pi has network access to the server.
- Verify that the
client_manager
script is running.
- Script Errors:
- Access the Raspberry Pi terminal.
- Check logs or output messages from the scripts.
- Manually run scripts to observe any errors.
- Display Not Updating:
-
Development Environment:
- Local Client Not Displaying Correctly:
- Ensure the endpoint in the
client
script points to the correct server address. - Check browser console for JavaScript errors.
- Ensure the endpoint in the
- Server Running Locally:
- Verify that the server is running on your local machine and accessible at the specified port.
- Local Client Not Displaying Correctly:
-
General Tips:
- No SSH Access (Raspberry Pi):
- Physical access to Raspberry Pis is required for troubleshooting.
- Consider connecting a keyboard and monitor to access the terminal.
- Logs and Output:
- Use terminal output for diagnosing issues.
- Add logging statements to scripts if necessary.
- No SSH Access (Raspberry Pi):
-
Internal Network Operation:
- The system operates within the school's internal network, reducing exposure to external threats.
-
Authentication:
- The content management GUI uses HTTP Basic Auth with a bcrypt-hashed password.
- Passwords are currently transmitted over HTTP; consider using HTTPS in the future if feasible.
-
Physical Access Risks:
- Physical access to the server or clients poses a security risk.
- Ensure that devices are secured to prevent unauthorized access.
-
Password Management:
- Use strong, complex passwords for administrative access.
- Store your hashed password securely in
config/monitor_password.txt
.
For assistance or questions, please contact the maintainers through the CS Club Discord server or visit Room 203.