Skip to content

Commit 63287a6

Browse files
committed
doc: control readme update
1 parent 2d666bb commit 63287a6

File tree

4 files changed

+74
-6
lines changed

4 files changed

+74
-6
lines changed

control/README.md

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,60 @@
22

33
This goes somewhere connected to the LED network
44

5-
## Usage
5+
## Installation (using systemd)
6+
7+
1. Download the appropriate binary for your system from the [releases page](https://github.com/lancaster-university/infolab-lights/releases):
8+
```bash
9+
# For x86_64 systems
10+
wget https://github.com/lancaster-university/infolab-lights/releases/latest/download/infolab-light-controller-x86_64-unknown-linux-gnu.tar.gz
11+
12+
# For ARM64 systems (like Raspberry Pi 4)
13+
wget https://github.com/lancaster-university/infolab-lights/releases/latest/download/infolab-light-controller-aarch64-unknown-linux-gnu.tar.gz
14+
```
15+
16+
2. Extract the binary:
17+
```bash
18+
tar -xzf infolab-light-controller-*.tar.gz
19+
```
20+
21+
3. Create installation directory and move the binary:
22+
```bash
23+
sudo mkdir -p /opt/infolab-lights
24+
sudo mv infolab-light-controller-* /opt/infolab-lights/control
25+
sudo chmod +x /opt/infolab-lights/control
26+
```
27+
28+
4. Download the systemd service files:
29+
```bash
30+
# Download the main service file
31+
sudo wget -O /etc/systemd/system/infolab-lights.service https://raw.githubusercontent.com/lancaster-university/infolab-lights/master/control/infolab-lights.service
32+
33+
# Download the restart service file
34+
sudo wget -O /etc/systemd/system/infolab-lights-restart.service https://raw.githubusercontent.com/lancaster-university/infolab-lights/master/control/infolab-lights-restart.service
35+
36+
# Download the restart timer file
37+
sudo wget -O /etc/systemd/system/infolab-lights-restart.timer https://raw.githubusercontent.com/lancaster-university/infolab-lights/master/control/infolab-lights-restart.timer
38+
```
39+
40+
5. Download the scene file:
41+
```bash
42+
sudo wget -O /opt/infolab-lights/InfoLab.xml https://raw.githubusercontent.com/lancaster-university/infolab-lights/master/control/InfoLab.xml
43+
```
44+
45+
6. Enable and start the services:
46+
```bash
47+
sudo systemctl enable infolab-lights.service
48+
sudo systemctl start infolab-lights.service
49+
sudo systemctl enable infolab-lights-restart.timer
50+
sudo systemctl start infolab-lights-restart.timer
51+
```
52+
>Note: The restart timer ensures the service restarts 5 mins after reboot - this is a solution to help dealing with slow MikroTiks when there's a powercut.
53+
7. Check the service status:
54+
```bash
55+
sudo systemctl status infolab-lights.service
56+
```
57+
58+
## Optionally: building from source
659

760
```bash
861
cargo run -- --pixels wss://infolab21-lights.lancaster.ac.uk/live/websocket --scene InfoLab.xml
@@ -20,5 +73,5 @@ cargo run -- --pixels wss://infolab21-lights.lancaster.ac.uk/live/websocket --sc
2073
Build for rpi:
2174

2275
```bash
23-
cross build --release --target armv7-unknown-linux-gnueabihf
24-
```
76+
cross build --release --target armv7-unknown-linux-gnu
77+
```
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[Unit]
2+
Description=Restart Infolab Lights Service
3+
4+
[Service]
5+
Type=oneshot
6+
ExecStart=/bin/systemctl restart infolab-lights.service
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Unit]
2+
Description=Run infolab-lights-restart.service 5 minutes after boot
3+
4+
[Timer]
5+
OnBootSec=5min
6+
Unit=infolab-lights-restart.service
7+
8+
[Install]
9+
WantedBy=multi-user.target

control/infolab-lights.service

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ After=network.target
44

55
[Service]
66
Type=simple
7-
ExecStart=/path/to/your/control --scene /path/to/your/scene.xml --pixels wss://your-pixel-source.example.com
8-
WorkingDirectory=/path/to/your/working/directory
7+
ExecStart=/opt/infolab-lights/control --scene /opt/infolab-lights/InfoLab.xml --pixels wss://infolab21-lights.lancaster.ac.uk/screen_stream/websocket
8+
WorkingDirectory=/opt/infolab-lights
99
Restart=always
1010
RestartSec=5
1111
StartLimitIntervalSec=0
1212
# This makes systemd ignore the exit code 1
1313
SuccessExitStatus=1
1414

1515
[Install]
16-
WantedBy=multi-user.target
16+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)