Skip to main content

NATS Service

Download, Extract, and Create Config

Download NATS

Start by downloading NATS from the NATS GitHub page. Click the latest release listed on the right hand side. At the time of this wiki the latest version is nats-server-v2.10.22-windows-amd64.zip and it will be used as an example in this guide.

nats-latest

Extract

Now that NATS is downloaded, extract the files. Create a new folder at the path C:\nats and move the extracts contents to it.

Config

Autonomys needs to have a parameter passed in via a config file, so open up Notepad and paste in the following

max_payload: 2MB

Then click "Save As" and name it "nats.conf". Then select the dropdown for "All Files" and click "Save".

nats-conf

Download NSSM

If NSSM is not already downloaded (it is used in the Prometheus wiki) then navigate to the Builds Page for NSSM and download the latest build.

Extract

Extract the contents. Create a folder at the path C:\nssm and move the extracted contents there. You only need the nssm.exe that is located in the win64 folder.

Create NATS Service

Move to NSSM Directory

Now open a Terminal with Admin privileges by right clicking on the Windows menu and selecting "Terminal (Admin)". Then navigate to the NSSM folder

cd C:\nssm

Create the Service

Then create the Prometheus service with NSSM

.\nssm.exe install NATS

nats-cli

Configure the NATS service in the NSSM Configuration Window

nats-nssm

  • For the Path field, select C:\nats\nats-server
  • In the Startup directory, enter C:\nats
  • In the Arguments field specify the config. If you want to also specify a custom port (defaul is 4222) then add -p <PORT> as well.
-c "C:\nats\nats.conf"

Then click Install service. You should get a message that "Service NATS installed successfully".

Start NATS

Start NATS Service

Open up the Services console by searching for services.msc in the Start menu. Find the "NATS" service, right-click, and then select Start. Make sure the startup type is "Automatic" if you want Prometheus to start on boot.

nats-service

NATS should now be running and can be used for you Autonomys cluster.