Rivendell Remote Access

With Ubuntu 18.04, Guacamole, & Discord

Updated: 1/31/2021

Using this guide, you can create a Rivendell workstation capable of remote access through a web browser for screen sharing and Discord for good quality audio. A working Rivendell server (running CentOS 7 recommended) is required. The guide is written as if you have intermediate knowledge of Ubuntu Linux 18.04 and each command is not specified precisely. However, this should at least be a good starting point.

These pages provided inspiration and guided me along this journey:

Start with a Minimal Install of Ubuntu Server 18.04. During installation, create a primary user with username rd. Once rebooted, use apt to Update and Upgrade.

Set up Apache Guacamole Remote Desktop using the above instructions from LinuxBabe. Although they are for Ubuntu Server 20.04, they also apply to 18.04. Go ahead and use the latest version of Guacamole (1.3.0 as of this writing). Once complete, you should be able to access a desktop environment from any HTML5 web browser. Make sure you disable guacd, tomcat9, and vncserver@1 services from starting at bootup. Test them along the way! We will be starting them manually later.

At this point, you may log in to the console and run "startx" for a graphical environment if you like. You may also install a display manager such as LightDM to have the graphical environment automatically started and even use auto-login for your rd user.

Please note MySQL Server and Apache2 are not required for the workstation configuration. Your workstation will be using the resources from the Rivendell server.

Create a new user and group for rivendell with userid and groupid of 150 (to match CentOS 7 server's IDs). Add your rd user to the rivendell and audio groups.

Install dependencies and compile Rivendell.

Disable PulseAudio from autostarting.

Install nfs-common package so that you can access /var/snd from the Rivendell server, create the /var/snd directory, chgrp the directory's ownership to rivendell:rivendell, and make the appropriate addition to your /etc/fstab:

{Rivendell server IP}:/var/snd /var/snd nfs defaults 0 0

Do a "sudo mount -a" to enable access to /var/snd.

Perform the following edit to the Hostname value in the /etc/rd.conf file:

[mySQL]
; The connection parameters for the MySQL server.
Hostname={Rivendell server IP}

You may also need to configure MySQL on your Rivendell server to allow access from the workstation.

We are going to be using Jack and PulseAudio, so create an empty file at /etc/asound.conf so that Rivendell will not use ALSA:

sudo touch /etc/asound.conf

Stop Rivendell (if running) and disable it from autostarting.

Add "User=rd" to /lib/systemd/system/rivendell.service.

Install pulseaudio-module-jack package so Jack and PulseAudio may work together.

Add these two lines to the bottom of your /etc/pulse/default.pa file:

load-module module-jack-sink
load-module module-jack-source

Install aj-snapshot package to help manage Jack connections.

Download Discord linux deb file from https://discord.com/download. Before you run it, install the libappindicator1 and libc++1 packages as they are prerequisites for Discord. Then run "sudo dpkg -i {discord linux deb file}" to install Discord.

Start your Discord client and create a new user if you don't already have one. Create a new server named whatever you like and log into it. (This is the server you will connect to from the remote machine with headphones and a mic as well as send to anyone who will be voice tracking for you.) Create a voice channel for voice tracking. On the channel's settings, slide the BITRATE over to 96kbps for the best quality. Under "Voice & Video" change the Input and Output Devices to Jack Source and Jack Sink respectively, Input Mode to Voice Activity, and Sensitivity to -90db. Disable Echo Cancellation, Noise Reduction, and Automatic Gain Control. Once you get the Jack and PulseAudio connected up properly, Discord should "talk" whenever there is audio out of Rivendell (that is above -90db), and when you speak on the client, the audio should be heard on the Rivendell workstation.

Create "logs" directory under /home/rd and create subdirectories "jackd" and "pulseaudio" inside /home/rd/logs.

Create on_startup.sh in /usr/local/bin with the following contents:

#!/bin/bash
# on_startup.sh
# Start jackd (or qjackctl)
cd /home/rd/logs/jackd
rm -f nohup.out
# Replace jackd parameters with ones specific to your needs
nohup /usr/bin/jackd -dalsa -r48000 -p1024 -n2 -D -Chw:PCH -Phw:PCH &
sleep 10
# Start Rivendell
sudo systemctl start rivendell
sleep 10
# Start PulseAudio
cd /home/rd/logs/pulseaudio
rm -f nohup.out
nohup pulseaudio &
sleep 10
# Disconnect all Jack connections
aj-snapshot -jx
sleep 1
# Connect all Jack connections
aj-snapshot -rx /home/rd/on_startup.snap
sleep 1
# Start remote access
printf "Starting remote access...\n"
sudo systemctl start guacd tomcat9 vncserver@1
sleep 1
# Start Discord client (it should automatically connect to your previous server and voice channel)
cd /home/rd/logs/discord
rm -f nohup.out
nohup discord &

NOTE: While you are getting jackd running properly and setting up the Jack connections to your preferences, you may want to use qjackctl in place of jackd above. With qjackctl, you will be able to graphically change your Jack connections on the fly and as you see fit, ensure everything works, and once you have your Jack connectionss perfected you can run "aj-snapshot -j /home/rd/on_startup.snap" to save them.

Finally, make /usr/local/bin/on_startup.sh executable then go into your graphical environment on the console and add /usr/local/bin/on_startup.sh to run on startup. When you reboot, everything should run in the proper order.

Also, while "Step 6: Set Up a Reverse Proxy for the Guacamole Web Application" of the Guacamole setup article is great, I'm sure, I prefer Nginx Proxy Manager. It's much easier to setup and maintain.

I realize these instructions aren't the greatest, and, while there are many ways to accomplish similar functionality, this is how I did it and how I prefer things to be configured after many years of Linux experience. You may not like it and you may know better ways to do the same things. You are welcome to contact me at admin@bbontheradio.com.