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 server
  • sudo systemctl stop virola-server - to stop the Virola server
  • sudo 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

  1. Open the file /home/virola/start-virola-server.sh in a text editor
  2. Find the --listen parameter
  3. Change the parameter value. The syntax is: --listen HOST:PORT
  4. Save the changes
  5. 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:

  1. Locate the database. By default, it is located in the /home/virola/storage directory, file virola_server_database_v9.db
  2. Run sudo systemctl stop virola-server to stop the Virola server before moving the database
  3. Move the database file to the new location
  4. Open the file /home/virola/start-virola-server.sh in a text editor
  5. Find the --storage-dir parameter
  6. Change the parameter value. The syntax is: --storage-dir STORAGE-DIRECTORY-PATH
  7. Save the changes
  8. 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)

  1. Create user virola
  2. Create the file virola-server.service in the /etc/systemd/system directory
  3. 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
    
    where
    • HOST is the IP you've chosen for the Virola server
    • PORT is the port you've chosen for the Virola server
  4. Execute the following commands one by one
    sudo systemctl daemon-reload
    sudo systemctl start virola-server
    sudo systemctl enable virola-server