Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EPIC] CDK #7614

Closed
12 tasks done
AshCorr opened this issue Apr 25, 2023 · 5 comments · Fixed by #8669
Closed
12 tasks done

[EPIC] CDK #7614

AshCorr opened this issue Apr 25, 2023 · 5 comments · Fixed by #8669
Assignees
Labels
Epic 🥒WiP Work in Progress

Comments

@AshCorr
Copy link
Member

AshCorr commented Apr 25, 2023

Tasks

Preview Give feedback
  1. CDK ⚙️
    DanielCliftonGuardian cemms1
  2. CDK ⚙️
    DanielCliftonGuardian
  3. CDK ⚙️
    DanielCliftonGuardian ParisaTork
    cemms1
  4. CDK ⚙️
    DanielCliftonGuardian
  5. CDK ⚙️
    ParisaTork
  6. CDK ⚙️
    ParisaTork
  7. CDK ⚙️
  8. CDK ⚙️
    cemms1
  9. CDK ⚙️
    DanielCliftonGuardian
  10. CDK ⚙️
    DanielCliftonGuardian
  11. CDK ⚙️
    ParisaTork
  12. CDK ⚙️
    ParisaTork

Ideally we should be using one of the pre-defined patterns such as GuEc2App that @guardian/cdk provides, however for now I believe we should use our own structs atleast whilst we migrate to CDK.

  • This allows us to migrate one thing at a time to CDK, we can delete the resource definition from YML and add a CDK definition, whilst if we used a pattern I believe we'd have to migrate multiple things over at once.
  • I'm not entirely sure how well a pattern will work with the traffic swimlane concept we have for seperating AR traffic from Web traffic.

Migration Guide

  1. Pick a resource to migrate over
  2. Find the appropriate GuCDK construct to represent that resource https://github.com/guardian/cdk/tree/main/src/constructs (hopefully there should be one!)
  3. Create an instance of that construct in the constructor of https://github.com/guardian/dotcom-rendering/blob/main/dotcom-rendering/cdk/lib/dotcom-rendering.ts
export class DotcomRendering extends GuStack {
	constructor(scope: App, id: string, props: GuStackProps) {
		super(scope, id, props);

                const vpc = new GuVpc(this, "vpc")

                // New construct goes here!

		const yamlTemplateFilePath = join(
			__dirname,
			'../..',
			'cloudformation.yml',
		);
		new CfnInclude(this, 'YamlTemplate', {
			templateFile: yamlTemplateFilePath,
		});
	}
}

Constructs that depend on other constructs (like LoadBalancers that depend on SecurityGroups) should go last, whilst constructs that don't need other constructs such as VPCs should go first, other than that order is not very important. CfnInclude should always be last.

  1. Delete the old resource from the cloudformation file.
  2. Delete https://github.com/guardian/dotcom-rendering/blob/main/dotcom-rendering/cdk/lib/__snapshots__/dotcom-rendering.test.ts.snap#L495-L549 and run yarn cdk:synth, this should cause the file to be regenerated with your changes.
  3. Compare the new dotcom-rendering.test.ts.snap file with the old one and verify that it has not changed. Some changes are expected, the ID of a resources will likely change, and some extra properties that previously didn't exist might have been explicitly set to their default values, but otherwise the resource should look mostly the same.

Different properties based on stage

We previously used mappings to have different properties depending on Stage. We don't need to do this anymore with CDK.

If you need to have different properties for each stage add them as props to the DotcomRendering class (you might need to extend the GuStackProps type then specify them in https://github.com/guardian/dotcom-rendering/blob/main/dotcom-rendering/cdk/bin/cdk.ts

@AshCorr AshCorr moved this from Triage to Doing in Deprecated: WebX Health and Rota Apr 25, 2023
@AshCorr AshCorr added the 🥒WiP Work in Progress label Apr 25, 2023
@AshCorr AshCorr self-assigned this Apr 26, 2023
@rhiannareechaye rhiannareechaye moved this from In progress to Backlog in Deprecated: WebX Health and Rota Apr 28, 2023
@jamesgorrie jamesgorrie moved this from Backlog to Planned in Deprecated: WebX Health and Rota Jul 27, 2023
@jamesgorrie jamesgorrie moved this from Planned to Triage in Deprecated: WebX Health and Rota Jul 27, 2023
@github-project-automation github-project-automation bot moved this to Backlog in WebX Team Jul 27, 2023
@VDuczekW VDuczekW moved this from Backlog to Planned in WebX Team Jul 31, 2023
@cemms1 cemms1 moved this from Planned to In progress in WebX Team Jul 31, 2023
@VDuczekW
Copy link

VDuczekW commented Aug 1, 2023

Do reach out to DevX ops teams when needed

@VDuczekW
Copy link

VDuczekW commented Aug 3, 2023

it will be done one by one

@VDuczekW
Copy link

VDuczekW commented Aug 9, 2023

group to have a mob re how to move forward re load balancer - like for like or optimise

@VDuczekW
Copy link

good progress and work continuing as main priority this week

@VDuczekW
Copy link

check in with DevX to understand how and when we are ready to go in to prod - due to testing taking a lot of time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Epic 🥒WiP Work in Progress
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants