Skip to content

Commit

Permalink
WIP: CloudWatch integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwinch committed Nov 17, 2023
1 parent 0e22858 commit 177bbb8
Show file tree
Hide file tree
Showing 15 changed files with 9,990 additions and 2 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: |
./script/ci
- name: Upload to riff-raff
- name: Upload to riff-raff (anghammarad)
uses: guardian/actions-riff-raff@v2
with:
app: anghammarad
Expand All @@ -55,4 +55,18 @@ jobs:
cfn:
- cloudformation/cfn.yaml
- name: Upload to riff-raff (cloudwatch)
uses: guardian/actions-riff-raff@v2
with:
app: cloudwatch-to-anghammarad
configPath: cdk/cdk.out/riff-raff.yaml
projectName: tools::cloudwatch-to-anghammarad
contentDirectories: |
cloudwatch-to-anghammarad:
- cloudwatch/cloudwatch.jar
cdk.out:
- cdk/cdk.out/CloudwatchToAnghammarad-CODE.template.json
- cdk/cdk.out/CloudwatchToAnghammarad-PROD.template.json


23 changes: 22 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ lazy val root = project
publishTo := sonatypePublishTo.value,
releaseProcess += releaseStepCommandAndRemaining("sonatypeRelease"),
)
.aggregate(anghammarad, client, common, dev)
.aggregate(anghammarad, client, cloudwatch, common, dev)

lazy val common = project
.settings(
Expand Down Expand Up @@ -109,6 +109,27 @@ lazy val anghammarad = project
assemblySettings,
)

lazy val cloudwatch = project
.enablePlugins(JavaAppPackaging, ScalafixPlugin)
.dependsOn(common)
.settings(
name := "cloudwatch",
libraryDependencies ++= Seq(
"com.amazonaws" % "aws-lambda-java-events" % "3.11.3",
"com.amazonaws" % "aws-lambda-java-core" % "1.2.3",
"com.amazonaws" % "aws-java-sdk-lambda" % awsSdkVersion,
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"ch.qos.logback" % "logback-classic" % "1.4.11",
"org.scalatest" %% "scalatest" % scalaTestVersion % Test
),
publish / skip := true,
assembly / assemblyOutputPath := file("cloudwatch/cloudwatch.jar"),
assemblySettings,
)

lazy val dev = project
.settings(
name := "dev",
Expand Down
11 changes: 11 additions & 0 deletions cdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.js
!jest.config.js
!jest.setup.js
!.eslintrc.js
*.d.ts
node_modules
dist

# CDK asset staging directory
.cdk.staging
cdk.out
5 changes: 5 additions & 0 deletions cdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Infrastructure

This directory defines the components to be deployed to AWS.

See [`package.json`](./package.json) for a list of available scripts.
7 changes: 7 additions & 0 deletions cdk/bin/cdk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import "source-map-support/register";
import { GuRoot } from "@guardian/cdk/lib/constructs/root";
import { CloudwatchToAnghammarad } from "../lib/cloudwatch-to-anghammarad";

const app = new GuRoot();
new CloudwatchToAnghammarad(app, "CloudwatchToAnghammarad-CODE", { stack: "deploy", stage: "CODE", env: { region: "eu-west-1" } });
new CloudwatchToAnghammarad(app, "CloudwatchToAnghammarad-PROD", { stack: "deploy", stage: "PROD", env: { region: "eu-west-1" } });
7 changes: 7 additions & 0 deletions cdk/cdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"app": "npx ts-node bin/cdk.ts",
"context": {
"aws-cdk:enableDiffNoFail": "true",
"@aws-cdk/core:stackRelativeExports": "true"
}
}
1 change: 1 addition & 0 deletions cdk/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jest.mock("@guardian/cdk/lib/constants/tracking-tag");
Loading

0 comments on commit 177bbb8

Please sign in to comment.