Services Runbooks

Octopus can deploy the services that your application depend on. Working with services often requires direct access to the server and elevated permissions. With Runbooks, you can give users a self-service method to perform operations on services without giving them access to the server or any special permissions.

The next section shows how you can create runbooks to manage services operations:

Windows services runbooks

When developing a Windows service, starting, stopping, and restarting are all common activities. However, once deployed to a server, the ability to start, stop, or restart a service requires the user to have either elevated permissions or at least be granted the ability to remotely perform the operation. If it’s not possible (or feasible) to grant that permission, you may need to fill out a ticket and wait for a server administrator to do it for you, which can kill productivity. Using a runbook, you can give developers a self-service option to start, stop, or restart a Windows service without having to grant them permission to the server.

For Windows services, there are three Community Step Templates available, one for each action:

Manage Windows services runbook

  1. To create a runbook, navigate to Project ➜ Operations ➜ Runbooks ➜ Add Runbook.
  2. Give the runbook a name and click SAVE.
  3. Click DEFINE YOUR RUNBOOK PROCESS, then click ADD STEP.
  4. Add one of the templates listed above.
  5. Fill out all the parameters in the step. It is best practice to use variables rather than entering the values directly in the step parameters.

All three services use a single parameter of the same name.

ParameterDescriptionExample
Service NameName of the Windows service.MyService

With a relatively simple runbook you can empower developers and speed up time to market.

Windows services samples

We have a Target - Windows Space on our Samples instance of Octopus. You can sign in as Guest to take a look at this example and more runbooks in the OctoFX project.

Linux services runbooks

Using a runbook in Octopus can provide a self-service mechanism for developers to restart a service on a Linux system, such as Ubuntu, without having to track down a server administrator.

Restart Ubuntu service runbook

  1. To create a runbook, navigate to Project ➜ Operations ➜ Runbooks ➜ Add Runbook.
  2. Give the runbook a name and click SAVE.
  3. Click DEFINE YOUR RUNBOOK PROCESS, then click ADD STEP.
  4. Add a new step template from the community library called Linux Service - Start, Stop, Restart.
  5. Fill out all the parameters in the step. We recommend using variables rather than entering the values directly in the step parameters, for instance:
ParameterDescriptionExample
Service NameName of the service to start (case sensitive).wildfly
ActionStart, Stop, Restart.Restart
Sleep in secondsLength of time in seconds to wait for the service to start.5 (default)

Use variables where possible so you can assign scopes to values. This will ensure that things like service name are correct for the environment you’re executing the runbook on.

After adding all of the required parameters, click Save, and you have a basic runbook to restart a service on Ubuntu. You can add additional steps to add security to your runbooks, such as a manual intervention step for business approvals.

Linux service samples

We have a Target - Wildfly Space on our Samples instance of Octopus. You can sign in as Guest to take a look at this example and more runbooks in the PetClinic project.

Learn more

Help us continuously improve

Please let us know if you have any feedback about this page.

Send feedback

Page updated on Sunday, January 1, 2023