Giter VIP home page Giter VIP logo

hmpps-architecture-as-code's Introduction

Publish Build and validate

hmpps-architecture-as-code

Modelling architecture in HM Prisons and Probations Service (HMPPS) with the C4 model and Structurizr.

Key outputs

Workspaces

This repository defines a Structurizr workspace for the HM Prison and Probation Service.

For the model and diagrams, please visit https://structurizr.com/share/56937.

Overview

Overview key

Linking from other repositories

To link to a live version of a diagram, insert the following code into your repository's readme:

(Replace nomiscontainer with the diagram key in the code)

[Container diagram source](https://github.com/ministryofjustice/hmpps-architecture-as-code/search?q=nomiscontainer)

![Container diagram](https://static.structurizr.com/workspace/56937/diagrams/nomiscontainer.png)

![Container diagram legend](https://static.structurizr.com/workspace/56937/diagrams/nomiscontainer-key.png)

Running

The project is built with gradle.

Action Command
Build the project ./gradlew build
Create a local Structurizr workspace JSON file ./gradlew run
Push to the remote Structurizr workspace ./gradlew run --args='--push'
(please see "Secrets" section below)

๐Ÿšจ Remote-only changes will be lost

The remote workspace's content is replaced with the content in this repository. Remote-only changes will be lost.

Secrets

The --push command can be configured with these environment variables:

Environment variable Meaning
STRUCTURIZR_API_KEY Required The API key for the Structurizr API.
STRUCTURIZR_API_SECRET Required The API secret for the Structurizr API.
STRUCTURIZR_WORKSPACE_ID Overrides the default workspace ID.

Example:

STRUCTURIZR_WORKSPACE_ID=12345 \
  STRUCTURIZR_API_KEY=key \
  STRUCTURIZR_API_SECRET=secret \
  ./gradlew run --args='--push'

You can view these secrets on the dashboard, after clicking Show more... next to the desired workspace.

Generating images locally

Requires graphviz and wget to be installed (e.g. with brew install graphviz wget)

script/generate_images.sh

This command will locally generate all defined workspace diagrams without using the Structurizr web API.

hmpps-architecture-as-code's People

Contributors

andrewl avatar andrewrlee avatar andymarke avatar anthony-britton-moj avatar brightonsbox avatar carlov20 avatar dependabot[bot] avatar floppy avatar garethmdavies avatar jezhiggins avatar lawrence-forooghian avatar louisenorris avatar markberridge avatar mattops avatar mjwillis avatar mr-ken avatar mxco86 avatar philroffe avatar renovate[bot] avatar rj-adams avatar sldblog avatar sp-watson avatar spikeheap avatar staberinde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hmpps-architecture-as-code's Issues

How to represent widely applicable C4 container concerns?

from #56 (review):

My gut reaction was: could we add this to our HMPPSSoftwareSystem interface, so it becomes an attribute of our object rather than a functional wrapper? Obviously that doesn't work in this case because we want to add API doc URLs to containers as well as systems, so is it highlighting the need for a container abstraction?

This does make me wonder:

  1. Should we be expanding our abstraction layer to include containers, and/or
  2. Is this a useful abstraction to push upstream?

It feels like we're unlikely to be the only users of this building additional tooling for this, and it'd be amazing if what we build here could end up helping other Structurizr/C4 developers.

Anyway, they're more grand thoughts than a review! This is spot-on while we consider the wider architecture, as it'll make identifying and refactoring API URLs much easier if/when we need to.

Which way should we define relationships?

// in Delius.kt
      OASys.system.uses(system, "assessment info, risk measures are copied into", "NDH")
      NOMIS.system.uses(system, "offender data is coped into", "NDH")

I'm still a little uneasy about defining relationships this way round. It feels like the relationship should be defined alongside the initiator of the communication, so the class is more explicit about the outgoing connections of that system. To be fair, it makes no difference to the generated diagrams, but I think it makes it easier to build a mental model from the code.

Again, this looks fine for this PR. Maybe we could decide/record this as an ADR?! ๐Ÿคฏ

Originally posted by @spikeheap in #50

Layouting: automatic or manual?

We now have a few views with enableAutomaticLayout(...). The generated layouts are not very readable except for straightforward diagrams.

We could layout the diagrams ourselves. The Java library retains layout information from the workspace whenever possible. It breaks when:

  • diagram keys are changed
  • elements are renamed

Manual layouts also require

  • a user with editor rights locking the workspace, positioning new elements on the views after each change

Should we try manual layouts?

API docs URLs: environment and VPN inconsistencies

I notice this is a test URL, where-as the other swagger docs are production.
Also it's not accessible unless on the MoJ VPN - maybe not an issue for a dev, but just an observation about the availability of the swagger docs.

Originally posted by @philroffe in #62

Todo:

  • Go through all API docs and settle on the production URLs, where possible.
  • Go with non-VPN URLs or mark the requirements for a VPN in the model

Enforce code style

Everyone has different editors

Let's enforce a consistent style, so we don't auto-format over each other

Should we merge workspaces?

It sounded like there are more arguments towards merging the prison and probation workspaces.

Pros: single model, some of our apps are cross-cutting anyway
Cons: landscape diagrams will be harder to generate or will be very busy

Please vote with ๐Ÿ‘ if you're in favour of merging, ๐Ÿ‘Ž if in favour of keeping stuff as-is. ๐Ÿ™‡โ€โ™‚๏ธ

I'll close this issue on Wednesday, 22 July 2020.

Discovering what's available: topical landscape diagrams

In the last development session, one of the feedback was about making it easier to discover things.

I was thinking that maybe removing the system context diagrams and introducing topical landscape diagrams would help with that discovery process.

For example, instead of having MoJ SignOn context, HMPPS Auth context, we could have an "Authentication landscape" which could detail these lifecycle intentions [edit: in the original PR, we discussed how to expose intent that "MoJ SignOn" is essentially deprecated].

Originally posted by @sldblog in #45 (comment)

Publish offline generated images

#21 added script/generate_images.sh which uses the Structurizr CLI and PlantUML to generate images of all diagrams defined in the workspaces.

On 16 July 2020 (Thursday) we discussed that it would be useful to auto-publish these images.

Maybe a GitHub pages branch/repo with Git LFS?

Publishing failing

[git] Cloning https://github.com/ministryofjustice/hmpps-interventions-docs
225
Error: Exception in thread "main" java.lang.IllegalArgumentException: No enum constant com.structurizr.documentation.DecisionStatus.Approved

A branch protection setting is not enabled: codeowners require reviews

Hi there
The default branch protection setting called codeowners require review is not enabled for this repository
This option affects a pull request, i.e a PR will need to be reviewed and approved by a CODEOWNER before it can be merged.
See repository settings/Branches/Branch protection rules
Either add a new Branch protection rule or edit the existing branch protection rule and select the Require review from Code Owners option
Create a .github/CODEOWNERS file
Add a or multiple entries of @ministryofjustice/team_name to the CODEOWNERS file
The team_name shall be a team from within the MoJ teams: https://github.com/orgs/ministryofjustice/teams
See GH Codeowners documentation: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
See the repository standards: https://github.com/ministryofjustice/github-repository-standards
See the report: https://operations-engineering-reports.cloud-platform.service.justice.gov.uk/github_repositories
Please contact Operations Engineering on Slack #ask-operations-engineering, if you need any assistance

Is the HMPPSSoftwareSystem interface good for our purposes?

It's used for defining systems:

class NOMIS private constructor() {
companion object : HMPPSSoftwareSystem {
lateinit var system: SoftwareSystem
lateinit var db: Container
lateinit var prisonApi: Container

And it's used for defining a grouping for related teams:

class InterventionTeams private constructor() {
companion object : HMPPSSoftwareSystem {
lateinit var interventionServicesTeam: Person
lateinit var npsTreatmentManager: Person
lateinit var contractManagerForCRC: Person
lateinit var crcTreatmentManager: Person
lateinit var crcProgrammeManager: Person

I've just realised we might have made HMPPSSoftwareSystem overly specific, as CourtUsers [...]

Note In the example, InterventionTeams

[...] wants to conform to the same interface but isn't a software system. That's not a criticism of this PR, and shouldn't block merge, but we may want to rename the interface or create a more appropriate one โ€“ I'm guessing that would have model entities and relationships, but not views?

Originally posted by @spikeheap in #50

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.