Rhasspy as service with Debian installation

This post is a placeholder description for how to setup the standalone Rhasspy voice-assistant as a service on Debian/Ubuntu until the official docs are updated. This was gleaned from various posts on the Rhasspy forums and the OLD Rhasspy github, and then refined via trial and error.

Steps:

  1. Create a service account to run the Rhasspy daemon as a service. Instructions are here.
  2. Switch to the Rhasspy service account
$ sudo su rhasspy
$ cd ~
  1. Install the Rhasspy based on your use case. For me, this was for running Rhasspy as a satellite on various Raspberry Pi 4s around the house, that use a central Rhasspy instance running as a server interconnected with Home Assistant.

  2. Make sure that Rhasspy runs

$ rhasspy --profile en 2>&1 | cat

In a browser, navigate to http://:12101

You should see the following:

If you are good, then stop Rhasspy by using the keystrokes [CNTL]+C

  1. Switch back to your privileged account
$ exit
  1. Setup up the service account config directory
$ sudo mkdir /opt/rhasspy
  1. Create the service definition file
$ sudo nano /etc/systemd/system/rhasspy.service

then

[Unit]
Description=Rhasspy Service
After=syslog.target network.target mosquitto.service

[Service]
Type=simple
# for command, see https://github.com/rhasspy/rhasspy/issues/42#issuecomment-711472505
ExecStart=/bin/bash -c 'rhasspy -p en --user-profiles /home/rhasspy/.profiles/rhasspy 2>&1 | cat'
WorkingDirectory=/opt/rhasspy
User=rhasspy
Group=audio
RestartSec=10
Restart=on-failure
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rhasspy

[Install]
WantedBy=multi-user.target

Save the file using [CNTL]+o, and [CNTL]+z

  1. Enable the service
$ sudo systemctl enable rhasspy
  1. Now start the service
$ sudo systemctl daemon-reload
$ sudo systemctl start rhasspy
  1. Test that Rhasspy works by navigating to the Rhasspy Admin website on the device

In a browser, navigate to http://:12101

You should see the following:

If you are good, you should be able to start configuring the device as a satellite by following the instructions on the Rhasspy documentation site.

As is the case with all techno-things this approach will become outdated over time, so check the commands against the current version of Debian or Ubuntu. Drop me a line on Twitter if you find this useful or if needs updating.

Post Disclaimer

The information contained on this post is my opinion, and mine alone (with the occasional voice of friend). It does not represent the opinions of any clients or employers.


Posted

in

by