Skip to main content

Relays

To start a Webrelay service you many need to use SSH to log into a remote machine and then sign-in and start the service, If you have many servers, management and control of these services can be cumbersome and time-consuming.

A Relay is a user-mode daemon which is connected to your webrelay account and intended to run continuously on your remote machines. Its purpose is to simplify the process of starting and stopping Webrelay services on the machine where it's running.

What is a Relay

A Relay is designed to act like a remote control for Webrelay services on the remote machines where it's running. Once a Relay is started on a machine, you can control the Webrelay services on that machine from anywhere by simply invoking service commands on your local machine and using the -r flag to specify the Relay.

You can Install and run a Relay on any machine that you want to control remotely. For service registration and management the operating systems mechanisms are used. The relay is installed as a user scoped daemon and escalated permissions are not required to install a relay as a daemon.

Consider a scenario where you have a database server running on a remote machine, by setting up a Relay on that database server, you can remotely control Webrelay services on that server without having to log in to the remote machine each time.

To install a relay daemon on a remote machine, you can use the webrelay relay install command:

webrelay relay install -n <relayname>

Note that this does not start the relay, it only installs it. To start the relay, you can use the webrelay relay start command:

webrelay relay start -d

The relay daemons are always started in user mode, and escalated permissions are not required to start a relay daemon.

Once the relay is started, you can use the webrelay relay list command to see a list of all the relays that are running on your behalf

img.png

Here the name that you specified when you installed the relay is displayed with a '#' and is appended to the hostname

After a relay starts, you can ask it to expose services from anywhere in the world, for example if you want to start a service on the database server, you can use the webrelay service start command with the -r flag from your local machine:

webrelay service start -n <mydatabase> -p <5432> -t tcp -r <relayname>

In the command above:

  • -n mydatabase tells Webrelay to assign the name "mydatabase" to this service.
  • -p 5432 indicates that the service is running on TCP port 5432.
  • -t tcp specifies the protocol used by the service, in this case, TCP.
  • -r relayname directs the command to the Relay named "relayname" which is running on the remote machine.

Upon executing this command, Webrelay signals the Relay on the remote server to start the specified service, and the service becomes accessible across your network. You can run as many relays that you want, To see a list of all the relays that you are running you can use the webrelay relay list command.

Webrelay allows relays to be installed as daemons on Linux and Mac machines. This means that once a relay is installed, it will automatically start when the machine boots up, and will continue running in the background until the machine is shut down.