Add a microservice to Service Manager

Make your service easier to run locally by configuring it in the shared Service Manager repository.

What is Service Manager?

Service Manager is a shared repository of utilities that helps developers run applications and microservices during development and testing.

Check that Service Manager starts up

Run this to verify it’s working:

sm2 -diagnostic

Then update your local configuration:

sm2 -update-config

Select an unused port

Choose a port between 1024 and 65535 that isn’t already in use. List current assignments with:

sm2 -ports

Add Service Manager configuration locally

  1. Create a branch in the service-manager-config repo.
  2. Open or create your team’s JSON file in the services folder.
  3. Add your microservice configuration (replace placeholders and remove angle brackets):
"<MICROSERVICE_NAME>": {
  "name": "<Microservice Name>",
  "template": "PLAY",
  "location": "/<microservice-name>",
  "defaultPort": <port number the microservice will run on>,
  "sources": {
    "repo": "git@github.com:hmrc/<microservice-name>.git"
  },
  "binary": {
    "artifact": "<microservice-name>_%%",
    "groupId": "uk/gov/hmrc/",
    "destinationSubdir": "<microservice-name>",
    "cmd": [
      "./<microservice-name>/bin/<microservice-name>",
      "-Dconfig.resource=application.conf",
      "-Dapplication.router=prod.Routes",
      "-J-Xmx256m",
      "-J-Xms64m"
    ]
  }
}

Add to your team's profile

If the microservice is part of a group, add it to your team profile by updating profiles.json.

Test the microservice locally

Start your microservice:

sm2 -start <MICROSERVICE_NAME>

Check for port conflicts:

sm2 -checkports

Confirm everything works

From the service root, start it again to confirm:

sm2 -start <MICROSERVICE_NAME>

Then check status:

sm2 -status

Need support?

Contact #team-platops on Slack.

Got feedback?

We’re always improving our documentation. Share your feedback with the team channel above.