Commit 85ef0f44 authored by Remo Zumsteg's avatar Remo Zumsteg

feat: rename folders, add FT as submodule

parent 1510266f
[submodule "packages/server/flaschentaschen"]
path = packages/server/flaschentaschen
url = https://github.com/hzeller/flaschen-taschen.git
# Setup Rasperry Pi
# Hubscreen
## Setup Rasperry Pi
### Prerequisites
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`.
First thing to do is to setup basic software dependencies:
```sh
sudo apt update
sudo apt install git
```
Because both the server and the client are part of this monorepo, the first step to do is to **recursively** clone this repo under `~/hubscreen` on the RaspberryPi:
### Setup Flaschentaschen Server
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`.
First compile the flaschentaschen server:
```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 ./packages/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 `systemclt` and `journalctl`, eg: `journalctl -u flaschentaschen.service`
## Setup Raspian
// TODO
## General
1. sudo apt-get update
2. install git: `apt-get install git`
3. create folder `~/hubscreen` (all following commands are executed in this directory)
## Setup ft-server
1. clone flaschen-taschen repo: `git clone --recursive https://github.com/hzeller/flaschen-taschen.git ft-server`
2. compile ft-server with `rgb-matrix` backend: `cd ft-server/server; make FT_BACKEND=rgb-matrix`
2. compile ft-server with `rgb-matrix` backend: `cd ft-server/server; make FT_BACKEND=rgb-matrix`
3. start the server: `sudo cd ft-server/server; ./ft-server --led-chain=10 --led-brightness=50 --led-slowdown-gpio=2 --led-no-hardware-pulse`
## Setup ft-client
1. Install pip: `sudo apt-get install python3-pip`
2. Install pipenv: `pip3 install --user pipenv`
3. add the following snippet to the bottom of `~/.bashrc`:
```sh
# hubscreen
PATH=$PATH:~/.local/bin # pipenv is installed here
```
4. clone hubscreen repo: `git clone https://git.panter.ch/rmo/hub-screen.git ft-client`
5. navigate to `packages/hubscreen-client`, where the ft-client client is located
6.
6.
This readme documents how to setup a [flaschentaschen server](https://github.com/hzeller/flaschen-taschen) on a raspberry PI.
# 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
```
# Start Server manualy
After building the server, it can be started manually using following command:
```sh
sudo ~/hubscreen/ft-client/packages/hubscreen-server/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.
#!/usr/bin/env bash
# compiles the flaschentaschen server.
# Executable will be located at: `~/hubscreen/packages/server/flaschentaschen/server/ft-server`
pushd ~/hubscreen/packages/server/flaschentaschen/server
# build the flaschentaschen server for the `rgb-matrix` backend,
# see: https://github.com/hzeller/flaschen-taschen/tree/master/server#rgb-matrix-panel-display
make FT_BACKEND=rgb-matrix
popd
Subproject commit 14c0a7f4f8f206162ec1c00d46e426ea4d02d0da
[Unit]
Description=Flaschentaschen Server
After=network.target
StartLimitIntervalSec=0[Service]
Type=simple
Restart=always
User=root
ExecStart=/home/pi/hubscreen/packages/server/start_server.sh
[Install]
WantedBy=multi-user.target
#!/usr/bin/env bash
# create symlink of service file in styemd unit directory:
ln -s /etc/systemd/system/flaschentaschen.service /home/pi/hubscreen/packages/server/flaschentaschen.service
# initially start service
systemctl start flaschentaschen
# enable service to restart after stystem reboot:
systemctl enable flaschentaschen
\ No newline at end of file
#!/usr/bin/env bash
~/hubscreen/packages/server/flaschentaschen/server/ft-server --led-chain=10 --led-brightness=50 --led-slowdown-gpio=2 --led-no-hardware-pulse
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