Skip to content
On this page

Deploying

This section will help you daemonize the API so it is up and running at all times on your Raspberry Pi.

Step. 1: Download the lastest release

WIP

In the meantime, do as follows and move the binary to /usr/bin
http://www.raspberryapi.com/docs/getting-started.html#manual-send

Step. 2: Create service file

Create the following file:

bash
sudo vi /etc/systemd/system/raspberryapi.service

Add the following content:

bash
[Unit]  
Description= Hi there, I am the Raspberry API.
Wants=network-online.target
After=network.target network-online.target

[Service]  
Type=simple   
ExecStart=/usr/bin/raspberryapi
Restart=always
RestartSec=5

[Install]  
WantedBy=multi-user.target

Step. 3: Create config file

Create the following YAML file:

bash
sudo mkdir /etc/raspberryapi
cd /etc/raspberryapi
sudo vi raspberryapi.yaml

Add the following content:

bash
server:
    port: :3333
    debug: true
    read_timeout_seconds: 30
    write_timeout_seconds: 15

Step. 4: Activate the daemon

bash
sudo chmod 644 /etc/systemd/system/raspberryapi.service
sudo systemctl daemon-reload
# enable and start the service
sudo systemct enable --now raspberryapi.service
sudo systemctl status raspberryapi.service