Skip to content

Commit

Permalink
Merge pull request #73 from hmrc/BDOG-2664
Browse files Browse the repository at this point in the history
BDOG-2664 improve unmanaged services text and updated readme for new …
  • Loading branch information
jordanrowe authored Jul 4, 2023
2 parents 2771136 + 298e6e0 commit 21840d4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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
```
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions servicemanager/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 21840d4

Please sign in to comment.