Skip to content

Commit

Permalink
Add Prout to know when PRs are deployed or overdue
Browse files Browse the repository at this point in the history
Adds [Prout](https://www.theguardian.com/info/developer-blog/2015/feb/03/prout-is-your-pull-request-out),
to let us know when our changes don't ship as expected, or when they are ready to check in Production!

This PR uses guardian/permissions#174 as a recent example of
adding Prout, other examples include:

* guardian/typerighter#465
* guardian/dotcom-rendering#9692
  • Loading branch information
rtyley committed Sep 10, 2024
1 parent 558b196 commit 533f660
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .prout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"checkpoints": {
"PROD": { "url": "https://tagmanager.gutools.co.uk/management/healthcheck", "overdue": "30M" }
}
}
4 changes: 3 additions & 1 deletion app/controllers/Management.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package controllers

import com.gu.tagmanager.BuildInfo
import play.api.Logging
import play.api.libs.ws.WSClient
import play.api.mvc.{BaseController, ControllerComponents}
Expand All @@ -16,8 +17,9 @@ class Management(
extends BaseController
with Logging {

def manifest = Action { _ => Ok(BuildInfo.toJson) }

def healthCheck = Action {
Ok("OK")
}

}
9 changes: 8 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ lazy val dependencies = Seq(

dependencyOverrides += "org.bouncycastle" % "bcprov-jdk15on" % "1.67"

lazy val root = (project in file(".")).enablePlugins(PlayScala, SbtWeb, JDebPackaging, SystemdPlugin)
lazy val root = (project in file(".")).enablePlugins(PlayScala, SbtWeb, JDebPackaging, SystemdPlugin, BuildInfoPlugin)
.settings(Defaults.coreDefaultSettings: _*)
.settings(
playDefaultPort := 8247,
Expand All @@ -67,6 +67,13 @@ lazy val root = (project in file(".")).enablePlugins(PlayScala, SbtWeb, JDebPack
scalaVersion := scalaVer,
ThisBuild / scalaVersion := scalaVer,
libraryDependencies ++= dependencies,
buildInfoKeys := Seq(
name,
BuildInfoKey.sbtbuildinfoConstantEntry("buildTime", System.currentTimeMillis),
"gitCommitId" -> Option(System.getenv("GITHUB_SHA")).getOrElse("Unknown")
),
buildInfoPackage := "com.gu.tagmanager",
buildInfoOptions := Seq(BuildInfoOption.ToJson),

gzip / includeFilter := "*.html" || "*.css" || "*.js",
pipelineStages := Seq(digest, gzip),
Expand Down
1 change: 1 addition & 0 deletions conf/routes
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ GET /reauth controlle

# Management
+anyhost
GET /management/manifest controllers.Management.manifest()
GET /management/healthcheck controllers.Management.healthCheck

# Map static resources from the /public folder to the /assets URL path
Expand Down
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.3")

addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2")

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0")

// need to add jdeb dependency explicitly because https://github.com/sbt/sbt-native-packager/issues/1053
libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))

0 comments on commit 533f660

Please sign in to comment.