
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:
- Create a service account to run the Rhasspy daemon as a service. Instructions are here.
- Switch to the Rhasspy service account
$ sudo su rhasspy
$ cd ~
-
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.
-
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
- Switch back to your privileged account
$ exit
- Setup up the service account config directory
$ sudo mkdir /opt/rhasspy
- 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
- Enable the service
$ sudo systemctl enable rhasspy
- Now start the service
$ sudo systemctl daemon-reload
$ sudo systemctl start rhasspy
- 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.