Running RouteMaster as a Windows service

RouteMaster is often run just as a Windows desktop application. You can configure Windows to run RouteMaster as a startup application, but this still requires a user to log on to the computer.

Running RouteMaster as a service solves this problem, because services run as soon as the PC boots. Because service applications don’t appear as regular windows on the desktop, we’ll configure RouteMaster to allow remote control for configuration via it’s internal REST API, and use NSSM (the “Non-sucking Service Manager”)  to run RouteMaster as a service.

Installing the service

Install RouteMaster as normal, Then download NSSM. Unzip the NSSM archive and – using the command prompt – run nssm.exe

> nssm.exe install RouteMaster

You’ll see NSSM’s graphical UI which allows you to set the path the the RouteMaster application, normally C:\Program Files(x86)\Rascular\RouteMaster\RouteMaster.exe

The important settings are the command line arguments passed to RouteMaster.

  • -p 7777 This tells RouteMaster to run the REST API on TCP port 7777. Normally, the port number is allocated dynamically, but we need a fixed port number to allow us to communicate with RouteMaster when it’s a service.
  •  -f C:\rmdata This is optional, but tells RouteMaster to use the specified folder for its configuration and log files.

You can also enter a friendly name and description in the Details tab. Other fields do not need changing.

Once this is done, click OK and the service should appear in the list of Windows services.

Configuring the RouteMaster service

Now the service is running, we need to connect to it for configuration. We can do this using the RouteMaster from the command line, with the -c option.

routemaster.exe -c http://localhost:7777

This runs the RouteMaster UI, but connects to the REST API provided by the service.  You can modify all the settings as if you were running RouteMaster on the desktop. You can also use this option to manage a routemaster instance running on a different machine,  by entering the correct URL.

So now we have the RouteMaster application running as a service at startup. The last thing to check is that RouteMaster is configured to start in the “Run” mode. Make sure this checkbox is enabled in the “Configure Router…” dialog.