1
0
Fork 0

Add install instruction

This commit is contained in:
Alexander Böhm 2024-01-05 16:30:28 +01:00
parent 189528591e
commit ca70d8b39c
1 changed files with 49 additions and 0 deletions

View File

@ -32,3 +32,52 @@ Build the application for raspberry pi:
```sh
cargo build --target=armv7-unknown-linux-musleabihf
```
## Install
Place the build `pi` binary under `/usr/local/bin/spaceapi-dezentrale-pi-client`
```sh
install -m 755 -o root -g root \
target/release/pi \
/usr/local/bin/spaceapi-tuerpi
```
Configure the spaceapi systemd service by placing the service description under `/etc/systemd/system/spaceapi.service`:
```
[Unit]
Description=SpaceAPI tuerpi client
After=network.target
[Service]
Type=simple
Restart=always
EnvironmentFile=/etc/spaceapi-tuerpi.env
ExecStart=/usr/local/bin/spaceapi-tuerpi
[Install]
WantedBy=multi-user.target
```
Place the environment configuration with URL and API-Key under `/etc/spaceapi-tuerpi.env`:
```
SPACEAPI_URL=<your SpaceAPI server endpoint>
API_KEY=<your secret API key>
```
Ensure the `/etc/spaceapi-tuerpi.env` can be read only by root by executing:
```
chmod 600 /etc/spaceapi-tuerpi.env
chown root:root /etc/spaceapi-tuerpi.env
```
Apply changes to systemd to enable and start the service
```sh
systemctl daemon-reload
systemctl enable --now spaceapi
```