Add a microservice to Service Manager

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

About this page. Adapted from documentation I wrote for a government platform. Platform and team names, infrastructure details, repository names and internal references have been removed or replaced. The structure, the writing and the approach are as I wrote them.

Before you start

The service manager starts a group of services locally with one command, so developers can run the parts of the platform they need without starting each one by hand. Adding your service to it means other teams can include it in their local setup.

Check the service manager runs and its configuration is current:

terminal
svcmgr -diagnostic
svcmgr -update-config

Choose a port

Your service needs a port no other service is using. Ports run from 1024 to 65535. List the ports already assigned, then choose one that is not listed and keep it, because you will need it in the next step and in your own configuration.

terminal
svcmgr -ports

Add your configuration

  1. Create a branch in the service manager configuration repository.
  2. Open your team's file in the services folder, or create one if your team does not have it yet.
  3. Add an entry for your service:
    json
    "<SERVICE_NAME>": {
      "name": "<Service Name>",
      "template": "PLAY",
      "location": "/<service-name>",
      "defaultPort": <PORT>,
      "sources": {
        "repo": "<REPOSITORY_URL>"
      },
      "binary": {
        "artifact": "<service-name>_%%",
        "groupId": "<GROUP_ID>",
        "destinationSubdir": "<service-name>",
        "cmd": [
          "./<service-name>/bin/<service-name>",
          "-Dconfig.resource=application.conf",
          "-Dapplication.router=prod.Routes",
          "-J-Xmx256m",
          "-J-Xms64m"
        ]
      }
    }

    Replace:

    • <SERVICE_NAME> with your service's name in upper case with underscores
    • <service-name> with its name in lower case with hyphens
    • <PORT> with the port you chose
    • <REPOSITORY_URL> with its clone URL
    • <GROUP_ID> with your organisation's artefact group
  4. Add your service to your team's profile in profiles.json, so anyone can start the whole team's services in one command.
  5. Raise a pull request and ask a teammate to review it.

Check it worked

Start your service, confirm no ports clash, and check its status:

terminal
svcmgr -start <SERVICE_NAME>
svcmgr -checkports
svcmgr -status

svcmgr -status should show your service as running. If it does not start, svcmgr -diagnostic usually names the cause. If it does not, your platform support channel can help.

Add a microservice to Service Manager

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

About this page. Adapted from documentation I wrote for a government platform. Platform and team names, infrastructure details, repository names and internal references have been removed or replaced. The structure, the writing and the approach are as I wrote them.

Before you start

The service manager starts a group of services locally with one command, so developers can run the parts of the platform they need without starting each one by hand. Adding your service to it means other teams can include it in their local setup.

Check the service manager runs and its configuration is current:

terminal
svcmgr -diagnostic
svcmgr -update-config

Choose a port

Your service needs a port no other service is using. Ports run from 1024 to 65535. List the ports already assigned, then choose one that is not listed and keep it, because you will need it in the next step and in your own configuration.

terminal
svcmgr -ports

Add your configuration

  1. Create a branch in the service manager configuration repository.
  2. Open your team's file in the services folder, or create one if your team does not have it yet.
  3. Add an entry for your service:
    json
    "<SERVICE_NAME>": {
      "name": "<Service Name>",
      "template": "PLAY",
      "location": "/<service-name>",
      "defaultPort": <PORT>,
      "sources": {
        "repo": "<REPOSITORY_URL>"
      },
      "binary": {
        "artifact": "<service-name>_%%",
        "groupId": "<GROUP_ID>",
        "destinationSubdir": "<service-name>",
        "cmd": [
          "./<service-name>/bin/<service-name>",
          "-Dconfig.resource=application.conf",
          "-Dapplication.router=prod.Routes",
          "-J-Xmx256m",
          "-J-Xms64m"
        ]
      }
    }

    Replace:

    • <SERVICE_NAME> with your service's name in upper case with underscores
    • <service-name> with its name in lower case with hyphens
    • <PORT> with the port you chose
    • <REPOSITORY_URL> with its clone URL
    • <GROUP_ID> with your organisation's artefact group
  4. Add your service to your team's profile in profiles.json, so anyone can start the whole team's services in one command.
  5. Raise a pull request and ask a teammate to review it.

Check it worked

Start your service, confirm no ports clash, and check its status:

terminal
svcmgr -start <SERVICE_NAME>
svcmgr -checkports
svcmgr -status

svcmgr -status should show your service as running. If it does not start, svcmgr -diagnostic usually names the cause. If it does not, your platform support channel can help.

Add a microservice to Service Manager

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

About this page. Adapted from documentation I wrote for a government platform. Platform and team names, infrastructure details, repository names and internal references have been removed or replaced. The structure, the writing and the approach are as I wrote them.

Before you start

The service manager starts a group of services locally with one command, so developers can run the parts of the platform they need without starting each one by hand. Adding your service to it means other teams can include it in their local setup.

Check the service manager runs and its configuration is current:

terminal
svcmgr -diagnostic
svcmgr -update-config

Choose a port

Your service needs a port no other service is using. Ports run from 1024 to 65535. List the ports already assigned, then choose one that is not listed and keep it, because you will need it in the next step and in your own configuration.

terminal
svcmgr -ports

Add your configuration

  1. Create a branch in the service manager configuration repository.
  2. Open your team's file in the services folder, or create one if your team does not have it yet.
  3. Add an entry for your service:
    json
    "<SERVICE_NAME>": {
      "name": "<Service Name>",
      "template": "PLAY",
      "location": "/<service-name>",
      "defaultPort": <PORT>,
      "sources": {
        "repo": "<REPOSITORY_URL>"
      },
      "binary": {
        "artifact": "<service-name>_%%",
        "groupId": "<GROUP_ID>",
        "destinationSubdir": "<service-name>",
        "cmd": [
          "./<service-name>/bin/<service-name>",
          "-Dconfig.resource=application.conf",
          "-Dapplication.router=prod.Routes",
          "-J-Xmx256m",
          "-J-Xms64m"
        ]
      }
    }

    Replace:

    • <SERVICE_NAME> with your service's name in upper case with underscores
    • <service-name> with its name in lower case with hyphens
    • <PORT> with the port you chose
    • <REPOSITORY_URL> with its clone URL
    • <GROUP_ID> with your organisation's artefact group
  4. Add your service to your team's profile in profiles.json, so anyone can start the whole team's services in one command.
  5. Raise a pull request and ask a teammate to review it.

Check it worked

Start your service, confirm no ports clash, and check its status:

terminal
svcmgr -start <SERVICE_NAME>
svcmgr -checkports
svcmgr -status

svcmgr -status should show your service as running. If it does not start, svcmgr -diagnostic usually names the cause. If it does not, your platform support channel can help.