Run Nomad as a Windows service
Nomad runs as a native Windows service once you register it with the operating system. You can use PowerShell cmdlets or the sc command, either on PowerShell or the Windows command line, to register Nomad with the Windows Service Manager.
In this tutorial, you will download the Nomad binary, register the Nomad service with the Service Manager, and finally start Nomad.
The steps presented here, assume that you have launched PowerShell or the Windows command prompt with Administrator capabilities.
Before installing Nomad, you will need to create a permanent directory for
storing the configuration files. Once that directory is created, you will set it
when starting Nomad with the -config
option.
Install Nomad as a service
Download the Nomad binary for your architecture.
Use PowerShell's New-Service
cmdlet or the sc command to create a
service named Nomad, that will load the configuration files from the
config-dir
. Read the agent configuration documentation to
learn more about configuration options.
Tip
Nomad does not use the Windows Event Log for logging, so ensure that you configure file-based logging in your Nomad configuration.
If you get an output that is similar to the one above, then your service is registered with the Service Manager.
If you get an error, please verify that you have specified the proper path to the binary, and check if you've entered the arguments correctly for the Nomad service.
Tip
Running the same command as defined in your service definition interactively can help you identify configuration errors that prevent Nomad from starting to the point where it writes to log.
Run Nomad as a service
You have a few options for starting the service.
Start the Windows Services user interface by clicking on the Start button and typing "services.msc". Once in the services user interface, look for Nomad under the service name. To start it, you can use the "Start Service" button in the toolbar or the "Start" option in the context menu.
The service automatically starts up during/after boot, so you don't need to launch Nomad from the command-line again.
Next steps
In this tutorial, you setup a Nomad service on Windows. This process can be repeated to setup an entire datacenter of agents.