Commit 49ef059e authored by Remo Zumsteg's avatar Remo Zumsteg

docs: cleanup and re-structure

parent 88a5cfea
......@@ -2,91 +2,48 @@
## Setup Rasperry Pi
### Prerequisites
After flashing the SD card of the Raspberry PI, the PI has to get integrated into the nextwork again. Follow the online tutorials how to assign a hostname and a static IP address. Following values should be used by default for this PI:
The setup process is splitted into two parts: Setting up the flaschentaschen server (always required) and optionally setting up the python client provided in this repo under `packages/client`.
- hostname: `raspberrypi`
- IP: `10.2.3.57`
- default user: `pi`
- root/pi password: see `pass show colab/hub-screen/pi`
First thing to do is to setup basic software dependencies:
Here some links for setting up the PI:
```sh
sudo apt update
sudo apt install git
```
Download and copy [Raspbian Lite](https://downloads.raspberrypi.org/raspbian_lite_latest) to SD card.
Because both the server and the client are part of this monorepo, the next step is **recursively** cloning this repo under `~/hubscreen` on the RaspberryPi:
```sh
git clone https://git.panter.ch/rmo/hub-screen.git ~/hubscreen
```
Put an empty file called `ssh` into the root of the SD card to enable remote [ssh access](https://www.raspberrypi.org/documentation/remote-access/ssh/).
### Setup Flaschentaschen Server
Log in and change password.
The code of the server is contained in this repo as submodule under `packages/server/flaschentaschen`, that's why it is important to recursively clone this repo. Following commands are all executed in the directory `~/hubscreen/packages/server`.
To configure [static ip](https://www.modmypi.com/blog/how-to-give-your-raspberry-pi-a-static-ip-address-update),
append the following to `/etc/dhcpcd.conf`:
First compile the flaschentaschen server:
interface eth0
static ip_address=10.2.3.57/16
static routers=10.2.0.1
static domain_name_servers=10.2.0.1
```sh
./compile_server.sh
```
The server can be manually started using following command. But for normal operation, preferably manage the server via a systemd service, as described below.
```sh
sudo ./start_server.sh
```
Next step is to install and enable the server as a systemd service, to restart the server automatically after crashes and system reboots:
```sh
sudo ./install_service.sh
```
(Alternatively, see [how to configure wireless](https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md).)
After executing the commands above, the flaschentaschen server should already be running and listening on port 1337. It also should automatically start after a system reboot.
Switch off on-board sound: `dtparam=audio=off` in `/boot/config.txt`
To verify the correct setup of the flaschentaschen service, use `systemctl` and `journalctl` commands, such as `journalctl -u flaschentaschen.service` or `systemctl status flaschentaschen.service`.
### Setup Server and Client
### Setup default Python Client
The code of the python client is located at `./packages/client`. All following commands are executed in this directory.
First install the required python version and global python packages to run the hubscreen client:
```sh
# Install pip3:
sudo apt-get install python3-pip
# Install pipenv:
pip3 install --user pipenv
# pipenv will be installed to ~/.local/bin/pipenv.
# if you want to have it available in your shell, also execute following command:
echo "PATH=$PATH:~/.local/bin" >> ~/.bashrc
```
Before any python dependencies can be installed, some system dependencies have to be added first:
```sh
sudo apt install libgraphicsmagick++1-dev libboost-python-dev -y
```
Next activate the pipenv environement and install all dependencies (make sure your're at `~/hubscreen/packages/client`):
```sh
pipenv shell
pipenv install -v
```
This might take a while, better grab a coffee. If it seems to hang, it probably doesn't. Good measure is to use `htop` to check if any gcc/python process is still heavily working in the background.
The setup process is splitted into two parts: Setting up the flaschentaschen server (always required) and optionally setting up the python client provided in this repo under `packages/client`.
To verify the setup, use the following command to start the client manually:
First thing to do is to setup basic software dependencies:
```sh
python src/main.py
sudo apt update
sudo apt install git
```
If everything works, install the systemd service for the Hubscreen client using following commands:
Because both the server and the client are part of this monorepo, the next step is **recursively** cloning this repo under `~/hubscreen` on the RaspberryPi:
```sh
sudo ./install_service.sh
git clone https://git.panter.ch/rmo/hub-screen.git ~/hubscreen
```
To verify the correct setup of the hubscreen_client service, use `systemctl` and `journalctl` commands, such as `journalctl -u hubscreen_client.service` or `systemctl status hubscreen_client.service`.
Then follow the instructions in the [Server-README](./packages/server/README.md) and [Client-README](./packages/client/README.md)
\ No newline at end of file
## Admin interface
The Raspberry Pi should start a Web-GUI on <http://10.2.3.57:8080/admin/>
(login with username `admin`) on boot and also automatically turn on the LED display.
# Hubscreen Client
## Development
The following stuff is automagically done on boot and the Pi assigned a static IP on ImpactHub net:
ssh pi@10.2.3.57
cd ./hubscreen-django
python3 manage.py runserver 0.0.0.0:8080 --noreload
cd ./hubscreen
sudo python3 runtext.py -c 10 --led-brightness 50 --led-slowdown-gpio 2
- See [hubscreen-django](https://gitlab.com/mb21/hubscreen-django) for the accompanying Web-GUI.
- Both of the above (located in `~/hubscreen` and `~/hubscreen-django`) are started automatically by `~/hubscreen/bootscreen.sh`
- See [wiki](https://gitlab.com/mb21/hubscreen/wikis) and
[rpi-rgb-led-matrix/python](https://github.com/hzeller/rpi-rgb-led-matrix/tree/master/python)
for details.
## Documentation of Setup
Download and copy [Raspbian Lite](https://downloads.raspberrypi.org/raspbian_lite_latest) to SD card.
### Setup
Put an empty file called `ssh` into the root of the SD card to enable remote [ssh access](https://www.raspberrypi.org/documentation/remote-access/ssh/).
On OSX, you might have to increase the maximum allowed UDP message size using the following command: `sudo sysctl -w net.inet.udp.maxdgram=65535`
Log in and change password.
This setup makes use of ImageMagick to generate images sent to the FlaschenTaschen server. before installing pip dependencies, following system dependencies have to be installed:
[Install software](https://www.raspberrypi.org/documentation/linux/software/python.md):
- ImageMagick for pgmagick, see: https://pypi.org/project/pgmagick/
sudo apt-get update
sudo apt-get install git
sudo apt-get install python3-dev python3-pillow -y
This python project uses `pipenv` to manage all python dependencies, which allows locking down dependencies and their versions using a `Pipfile.lock` file, and installing project dependencies directly in a virtual environment to avoid conflicts with other pip packages installed on the local system:
To configure [static ip](https://www.modmypi.com/blog/how-to-give-your-raspberry-pi-a-static-ip-address-update),
append the following to `/etc/dhcpcd.conf`:
- install pipenv: https://pipenv.readthedocs.io
- activate environment: `pipenv shell` (working directory has to be `./packages/client`)
- install all project dependencies: `pipenv install`
interface eth0
static ip_address=10.2.3.57/16
static routers=10.2.0.1
static domain_name_servers=10.2.0.1
## Setup Client on the Raspberry Pi
(Alternatively, see [how to configure wireless](https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md).)
The following documentation assumes you followed the [initial setup steps](../../README.md) first.
Install library to drive LEDs:
The code of the python client is located at `./packages/client`. All following commands are executed in this directory.
git clone https://github.com/hzeller/rpi-rgb-led-matrix.git
cd rpi-rgb-led-matrix/bindings/python
make build-python PYTHON=$(which python3)
sudo make install-python PYTHON=$(which python3)
First install the required python version and global python packages to run the hubscreen client:
Switch off on-board sound: `dtparam=audio=off` in `/boot/config.txt`
```sh
# Install pip3:
sudo apt-get install python3-pip
# Install pipenv:
pip3 install --user pipenv
Test:
# pipenv will be installed to ~/.local/bin/pipenv.
# if you want to have it available in your shell, also execute following command:
echo "PATH=$PATH:~/.local/bin" >> ~/.bashrc
```
cd rpi-rgb-led-matrix/bindings/python/samples
sudo python3 graphics.py
Before any python dependencies can be installed, some system dependencies have to be added first:
Code:
```sh
sudo apt install libgraphicsmagick++1-dev libboost-python-dev -y
```
https://gitlab.com/mb21/hubscreen
Next activate the pipenv environement and install all dependencies (make sure you're at `~/hubscreen/packages/client`):
## Development
```sh
pipenv shell
pipenv install -v
```
### Setup
This might take a while, better grab a coffee. If it seems to hang, it probably doesn't. Good measure is to use `htop` to check if any gcc/python process is still heavily working in the background.
On OSX, you might have to increase the maximum allowed UDP message size using the following command: `sudo sysctl -w net.inet.udp.maxdgram=65535`
To verify the setup, use the following command to start the client manually:
This setup makes use of ImageMagick to generate images sent to the FlaschenTaschen server. before installing pip dependencies, following system dependencies have to be installed:
```sh
python src/main.py
```
- ImageMagick for pgmagick, see: https://pypi.org/project/pgmagick/
If everything works, install the systemd service for the Hubscreen client using following commands:
This python project uses `pipenv` to manage all python dependencies, which allows locking down dependencies and their versions using a `Pipfile.lock` file, and installing project dependencies directly in a virtual environment to avoid conflicts with other pip packages installed on the local system:
```sh
sudo ./install_service.sh
```
- install pipenv: https://pipenv.readthedocs.io
- activate environment: `pipenv shell`
- install all project dependencies: `pipenv install`
To verify the correct setup of the hubscreen_client service, use `systemctl` and `journalctl
https://calendar.google.com/calendar/ical/qd9vfhku8jdorichq7tmq3om80@group.calendar.google.com/public/basic.ics
https://calendar.google.com/calendar/ical/sran6lldsp5k4tj6c97so1mppc@group.calendar.google.com/public/basic.ics
`commands, such as`journalctl -u hubscreen_client.service`or`systemctl status hubscreen_client.service`.
This readme documents how to setup a [flaschentaschen server](https://github.com/hzeller/flaschen-taschen) on a raspberry PI.
# Hubscreen Flaschentaschen Server
## Overview
This package only contains a README, some helper scripts and the actual source code of the flaschentaschen server as a GIT submodule pointing to [hzeller/flaschentaschen server](https://github.com/hzeller/flaschen-taschen). After compiling and starting, the server will listen on UDP port 1337 for incoming bitmap frames and renders them on the screen. This interface is then used by the `client` package, which generates bitmap images and simply sends them to this server over a UDP connection.
## Setup on the Raspberry PI
The following documentation assumes you followed the [initial setup steps](../../README.md) first.
The code of the server is contained in this repo as a submodule under `packages/server/flaschentaschen`, that's why it is important to recursively clone this repo. Following commands are all executed in the directory `~/hubscreen/packages/server`.
First compile the flaschentaschen server:
# Setup Server
Execute following script, which clones the flaschentaschen repo to `~/hubscreen/ft-server` and builds the server using `make`, as described at https://github.com/hzeller/flaschen-taschen/tree/master/server#rgb-matrix-panel-display :
```sh
./install-server.sh
./compile_server.sh
```
# Start Server manualy
After building the server, it can be started manually using following command:
The server can be manually started using following command. But for normal operation, preferably manage the server via a systemd service, as described below.
```sh
sudo ~/hubscreen/ft-client/packages/hubscreen-server/start_server.sh
sudo ./start_server.sh
```
by additionally padding the `-d` flag, the server will run as a daemon in the background.
# Start server automatically on startup
This project makes use of systemd, allowing us to setup a service surviving unexpected exists and system restarts.
Next step is to install and enable the server as a systemd service, to restart the server automatically after crashes and system reboots:
```sh
sudo ./install_service.sh
```
After executing the commands above, the flaschentaschen server should already be running and listening on port 1337. It also should automatically start after a system reboot.
To verify the correct setup of the flaschentaschen service, use `systemctl` and `journalctl` commands, such as `journalctl -u flaschentaschen.service` or `systemctl status flaschentaschen.service`.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment