From 298e6e0905cda3e61a3e93d30fe63980399619f0 Mon Sep 17 00:00:00 2001 From: jordanrowe <37838443+jordanrowe@users.noreply.github.com> Date: Mon, 3 Jul 2023 17:38:09 +0100 Subject: [PATCH] BDOG-2664 improve unmanaged services text and updated readme for new version --- README.md | 23 +++++++++++++++-------- makefile | 2 +- servicemanager/status.go | 6 ++++-- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b5c3d72..df34113 100644 --- a/README.md +++ b/README.md @@ -9,24 +9,24 @@ It's based on the the original [service-manager](https://github.com/hmrc/service **Linux Intel** ```base -curl -L -O https://github.com/hmrc/sm2/releases/download/v1.0.8/sm2-1.0.8-linux-intel.zip && unzip sm2-1.0.8-linux-intel.zip && rm sm2-1.0.8-linux-intel.zip && chmod +x sm2 +curl -L -O https://github.com/hmrc/sm2/releases/download/v1.0.9/sm2-1.0.9-linux-intel.zip && unzip sm2-1.0.9-linux-intel.zip && rm sm2-1.0.9-linux-intel.zip && chmod +x sm2 ``` **Linux Arm64** ```base -curl -L -O https://github.com/hmrc/sm2/releases/download/v1.0.8/sm2-1.0.8-linux-arm64.zip && unzip sm2-1.0.8-linux-arm64.zip && rm sm2-1.0.8-linux-arm64.zip && chmod +x sm2 +curl -L -O https://github.com/hmrc/sm2/releases/download/v1.0.9/sm2-1.0.9-linux-arm64.zip && unzip sm2-1.0.9-linux-arm64.zip && rm sm2-1.0.9-linux-arm64.zip && chmod +x sm2 ``` **OSX/Apple (latest M1/M2 cpus)** ```base -curl -L -O https://github.com/hmrc/sm2/releases/download/v1.0.8/sm2-1.0.8-apple-arm64.zip && unzip sm2-1.0.8-apple-arm64.zip && rm sm2-1.0.8-apple-arm64.zip && chmod +x sm2 +curl -L -O https://github.com/hmrc/sm2/releases/download/v1.0.9/sm2-1.0.9-apple-arm64.zip && unzip sm2-1.0.9-apple-arm64.zip && rm sm2-1.0.9-apple-arm64.zip && chmod +x sm2 ``` **OSX/Apple (older Intel cpus)** ```base -curl -L -O https://github.com/hmrc/sm2/releases/download/v1.0.8/sm2-1.0.8-apple-intel.zip && unzip sm2-1.0.8-apple-intel.zip && rm sm2-1.0.8-apple-intel.zip && chmod +x sm2 +curl -L -O https://github.com/hmrc/sm2/releases/download/v1.0.9/sm2-1.0.9-apple-intel.zip && unzip sm2-1.0.9-apple-intel.zip && rm sm2-1.0.9-apple-intel.zip && chmod +x sm2 ``` If everything has worked you should have an executable called `sm2`. @@ -59,10 +59,12 @@ sm2 --diagnostic ``` ### Upgrading Service Manager 2 -Upgrades are a simple matter of downloading the latest version of sm2 and overwriting the `sm2` binary with the new one. +As of v1.0.9 `sm2` can update itself - simply run `sm2 -update`. You will need to ensure `sm2` is available on your `$PATH`. + +Alternatively, upgrades are a simple matter of downloading the latest version of sm2 and overwriting the `sm2` binary with the new one. If you are unsure where `sm2` is installed you can use the whereis command to find it: -```base +```shell $ whereis sm2 sm2 : /usr/local/bin/sm2 ``` @@ -138,10 +140,15 @@ $ sm2 -stop-all ``` You can also restart services using: -``` +```shell $ sm2 -restart SERVICE_NAME ``` +When restarting a service or profile, you can specify `-latest` to check for a new version before restarting: +```shell +$ sm2 -restart SERVICE_NAME -latest +``` + ### Checking the status of services (-s or -status) You can check what services are running using the status command @@ -196,7 +203,7 @@ Sometimes a service will fail to start up. To help determine why, service manage Before doing anything else, it’s worth running service-manager’s self-checks to ensure it is installed correctly. ```shell $ sm2 -diagnostic -version: 1.0.8 +version: 1.0.9 build: ef49b60 OS: OK (linux, amd64) JAVA: OK (11.0.17) diff --git a/makefile b/makefile index b96ca13..eaa71fe 100644 --- a/makefile +++ b/makefile @@ -8,7 +8,7 @@ ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) BINARY := sm2 -VERSION := 1.0.8 +VERSION := 1.0.9 BUILD := `git rev-parse HEAD` # Setup linker flags option for build that interoperate with variable names in src code diff --git a/servicemanager/status.go b/servicemanager/status.go index ce45933..3b8e5eb 100644 --- a/servicemanager/status.go +++ b/servicemanager/status.go @@ -48,8 +48,10 @@ func (sm *ServiceManager) PrintStatus() { printHelpIfRequired(statuses) if len(unmanaged) > 0 { - fmt.Print("\n\033[34mAlso, it looks like the following services are running outside of sm2:\n\n") - fmt.Print("These might include services running from inside your IDE or by other means.\n") + fmt.Print("\n\033[34mAlso, the following processes are running which occupy ports of services\n") + fmt.Print("that are defined in service manager config:\n\n") + fmt.Print("These might include entirely separate processes running on your machine,\n") + fmt.Print("or they could be services running from inside your IDE or by other means.\n") fmt.Print("Please note: You will not be able to manage these services using sm2.\n") printUnmanagedTable(unmanaged, termWidth, longestServiceName, os.Stdout) fmt.Print("\033[0m\n")