Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add setup and running services doc #37

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 191 additions & 0 deletions docs/setup_ovos_services.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
# Running & Setting Up OVOS Services

OpenVoiceOS is a software stack that includes seven important services, with some being optional, depending on the platform or environment. If you are a developer or would like to quickly test OpenVoiceOS for debugging purposes, you can run each service separately in a terminal. However, for users, distributions, and packagers, it is recommended to use systemd or any other init service that their userland supports for launching and managing OpenVoiceOS services.

### Here are the commands for launching each of the services from the CLI:

- Launching the Messagebus service (required): python3 -m mycroft.messagebus.service
- Launching the Skills service (required): python3 -m mycroft.skills
- Launching the PHAL service (required): python3 -m ovos_PHAL
- Launching the Audio service (required): python3 -m mycroft.audio
- Launching the Voice service (required): python3 -m mycroft.client.speech
AIIX marked this conversation as resolved.
Show resolved Hide resolved
- Launching the GUI service (optional): python3 -m mycroft.gui
- Launching the CLI service (optional): python3 -m mycroft.client.text
AIIX marked this conversation as resolved.
Show resolved Hide resolved

OpenVoiceOS services can be set up as SYSTEM or USER systemd services. The choice of which type to use and how to set them up is left up to the user, packager, and distributions. Keep in mind that these service scripts are just examples and may require changes based on your requirements.

### Setup the OpenVoiceOS service:
- Create a service file called "ovos.service" under "/usr/lib/systemd/user/" with the following contents:

```
[Unit]
Description=OpenVoiceOS Software stack.
Requires=ovos-messagebus.service
Requires=ovos-skills.service
Requires=ovos-audio.service
Requires=ovos-voice.service
Requires=ovos-gui.service
Requires=ovos-phal.service

[Service]
Type=simple
ExecStart=/bin/true
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
```

Here are the service files required for each of the individual services:

### Setting up Messagebus service as a user service:
- Create a service file called "ovos-messagebus.service" under "/usr/lib/systemd/user/" with the following contents:

```
[Unit]
Description=OpenVoiceOS Messagebus
Requires=ovos.service
PartOf=ovos.service

[Service]
Type=simple
ExecStart=/usr/bin/python -m mycroft.messagebus.service
TimeoutStartSec=1m
TimeoutStopSec=1m
Restart=on-failure
StartLimitInterval=5min
StartLimitBurst=4
StandardOutput=append:/var/log/ovos/bus.log
AIIX marked this conversation as resolved.
Show resolved Hide resolved
StandardError=file:/var/log/ovos/bus.error.log

[Install]
WantedBy=ovos.service
```

### Setting up Skills service:
- Create a service file called "ovos-skills.service" under "/usr/lib/systemd/user/" with the following contents:

```
[Unit]
Description=OpenVoiceOS Skills
PartOf=ovos.service
Requires=ovos-messagebus.service

[Service]
Type=simple
ExecStart=/usr/bin/python -m mycroft.skills
TimeoutStartSec=1m
TimeoutStopSec=1m
Restart=on-failure
StartLimitInterval=5min
StartLimitBurst=4
StandardOutput=append:/var/log/ovos/skills.log
StandardError=file:/var/log/ovos/skills.error.log

[Install]
WantedBy=ovos.service
```

### Setting up PHAL service:
- Create a service file called "ovos-phal.service" under "/usr/lib/systemd/user/" with the following contents:

```
[Unit]
Description=OVOS PHAL
PartOf=ovos.service
Requires=ovos-messagebus.service


[Service]
Type=simple
ExecStart=/usr/bin/python -m ovos_PHAL
TimeoutStartSec=1m
TimeoutStopSec=1m
Restart=on-failure
StartLimitInterval=5min
StartLimitBurst=4
StandardOutput=append:/var/log/ovos/phal.log
StandardError=file:/var/log/ovos/phal.error.log

[Install]
WantedBy=ovos.service
```

### Setting up Audio service:
- Create a service file called "ovos-audio.service" under "/usr/lib/systemd/user/" with the following contents:

```
[Unit]
Description=OVOS Audio
PartOf=ovos.service
Requires=ovos-messagebus.service


[Service]
Type=simple
ExecStart=/usr/bin/python -m mycroft.audio
TimeoutStartSec=1m
TimeoutStopSec=1m
Restart=on-failure
StartLimitInterval=5min
StartLimitBurst=4
StandardOutput=append:/var/log/ovos/audio.log
StandardError=file:/var/log/ovos/audio.error.log

[Install]
WantedBy=ovos.service
```

### Setting up Voice service:
- Create a service file called "ovos-voice.service" under "/usr/lib/systemd/user/" with the following contents:

```
[Unit]
Description=OVOS Voice
PartOf=ovos.service
Requires=ovos-messagebus.service


[Service]
Type=simple
ExecStart=/usr/bin/python -m mycroft.client.speech
TimeoutStartSec=1m
TimeoutStopSec=1m
Restart=on-failure
StartLimitInterval=5min
StartLimitBurst=4
StandardOutput=append:/var/log/ovos/voice.log
StandardError=file:/var/log/ovos/voice.error.log

[Install]
WantedBy=ovos.service
```

### Setting up GUI service:
- Create a service file called "ovos-gui.service" under "/usr/lib/systemd/user/" with the following contents:

```
[Unit]
Description=OVOS Gui
PartOf=ovos.service
Requires=ovos-messagebus.service


[Service]
Type=simple
ExecStart=/usr/bin/python -m mycroft.gui
TimeoutStartSec=1m
TimeoutStopSec=1m
Restart=on-failure
StartLimitInterval=5min
StartLimitBurst=4
StandardOutput=append:/var/log/ovos/ovos-gui.log
StandardError=file:/var/log/ovos/ovos-gui.error.log

[Install]
WantedBy=ovos.service
```

### Using helper scripts

You can find helper scripts such as **start-mycroft.sh** and **stop-mycroft.sh** on this website: https://github.com/OpenVoiceOS/scripts. These scripts are designed to mimic a daemon and manage multiple OVOS services. However, please note that they are optional and should be used with care. They are not the most recommended method for running OVOS services.