HashiCorp Learn
Infrastructure
  • TerraformTerraformLearn terraformDocs
  • PackerPackerLearn packerDocs
  • VagrantVagrantLearn vagrantDocs
Security
  • VaultVaultLearn vaultDocs
  • BoundaryBoundaryLearn boundaryDocs
Networking
  • ConsulConsulLearn consulDocs
Applications
  • NomadNomadLearn nomadDocs
  • WaypointWaypointLearn waypointDocs
  • HashiCorp Cloud Platform (HCP) LogoHashiCorp Cloud Platform (HCP)HashiCorp Cloud Platform (HCP)Docs
Type '/' to Search
Loading account...
  • Bookmarks
  • Manage Account
  • Overview
  • Install Nomad as a service
  • Run Nomad as a service
  • Next Steps
DocsForum
Back to nomad
WindowsView Collection
    Run Nomad as a Windows Service

Run Nomad as a Windows Service

  • 3 min
  • Products Usednomad

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.

PS> New-Service -Name "Nomad" -BinaryPathName "<path to the Nomad.exe> agent -config-dir=<path to configuration directory>" -StartupType Automatic
Status   Name               DisplayName
------   ----               -----------
Stopped  Nomad              Nomad

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 Start Service button is located in the Window Services GUI's toolbar. Click the button to start the service.

Image of the Windows Services UI showing the Nomad Service selected with the
mouse pointer over the Start Service button with the tooltip
showing.

You can use the Start option in the context menu to start the service. Right click on the Nomad service and select the Start option.

Image of the Windows Services UI showing the Nomad Service with the context
menu open. The mouse pointer is on the "Start" option, which is
highlighted

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.


HashiCorp
  • System Status
  • Terms of Use
  • Security
  • Privacy
stdin: is not a tty