Virola self-hosted server running as a daemon on Ubuntu or Debian
During the installation of the self-hosted Virola server on Linux, you are given the option to register your server as a systemd service (daemon). Once configured, systemd service will handle tasks such as starting the server during system startup and gracefully restarting it after failures.
Below, you will find a set of instructions essential for managing your registered systemd service. And even if you chose not to register the Virola server as a systemd service during installation, you can still create the configuration file later yourself.
How to manage Virola systemd service
Start, stop, restart
Use the following commands to start, stop, or restart the Virola server:
sudo systemctl start virola-server
- to start the Virola serversudo systemctl stop virola-server
- to stop the Virola serversudo systemctl restart virola-server
- to restart the Virola server
Change host or port
To change the host or port your Virola server is listening on
-
Open the file
/home/virola/start-virola-server.sh
in a text editor - Find the
--listen
parameter - Change the parameter value. The syntax is:
--listen HOST:PORT
- Save the changes
- Run
sudo systemctl restart virola-server
for the changes to take effect
Make sure to update the Server Host and Server Port credentials in your Virola client after this.
Move database to another location
To move the Virola server database to another location:
-
Locate the database. By default, it is located in the
/home/virola/storage
directory, filevirola_server_database_v9.db
- Run
sudo systemctl stop virola-server
to stop the Virola server before moving the database - Move the database file to the new location
- Open the file
/home/virola/start-virola-server.sh
in a text editor - Find the
--storage-dir
parameter - Change the parameter value. The syntax is:
--storage-dir STORAGE-DIRECTORY-PATH
- Save the changes
- Run
sudo systemctl start virola-server
to start the server again
Note! If you cannot find the
/home/virola/start-virola-server.sh
file, your Virola server
was likely registered as a systemd service manually. In this case, the server host, port and
database location are specified directly in the virola-server.service
file
located in the /etc/systemd/system
directory.
How to manually register Virola server as a systemd service (daemon)
- Create user
virola
-
Create the file
virola-server.service
in the/etc/systemd/system
directory -
Add the following to the file:
[Unit] Description=Virola Server Wants=network.target After=network.target [Service] WorkingDirectory=/home/virola User=virola ExecStart=/usr/bin/virola-server --listen HOST:PORT --storage-dir ./storage Restart=on-failure [Install] WantedBy=multi-user.target
whereHOST
is the IP you've chosen for the Virola serverPORT
is the port you've chosen for the Virola server
-
Execute the following commands one by one
sudo systemctl daemon-reload sudo systemctl start virola-server sudo systemctl enable virola-server