feat: add alternate domain names to cdn site host construct #84
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
We have had outages to both smalti's internal UI and production elevate caused by the cloud front distribution deleting the alias for the live DNS name when a release is performed.
This is because we manually create the DNS entry and the cloud front distribution alias for it. We haven't included these in the cloud formation stack previously because we want to be able to follow a process of deploying a new stack alongside a live stack and switch to it when we are happy. We want to use DNS to do this in the same way we would when bringing up a new instance of a traditional web server.
If the DNS entry or the cloud front distribution alias are contained in the cloud formation stack, a new stack with a different watermark can not be created alongside the live production stack. The DNS entry and the cloud front distribution alias can not be duplicated in another stack - the stack creation fails.
Possible Solutions Discussed To Resolve This
These options are from this investigation ticket: https://github.com/talis/platform/issues/6436#issuecomment-1505271353
Option 1 - Pro - minimal change to code. Con - Potential short downtime on every release.
Option 2 - Pro - minimal change to code. Con - increase in complexity around deployments in hercules and individual projects
Option 3 - Pro - Deployment moved away from making any changes to Cloud Front. Con - this is a much bigger change
The decision was to go for Option 2. This PR implements that solution.
Changes in This PR
Changes to the construct:
aliasSubDomains
aliasSubDomains
are added as aliases to the cloud front distributionA simple cdn site hosting construct example has been added to the examples section. This example:
The integration tests have been extended to run against this new sample project in the same way we have integration tests running against the other samples
The circle build has therefore been updated to deploy the new sample in parallel to it's deployments of the other samples.
The PR also adds a
Best Practices
section into the README to describe the imagined process for resolving this issue - changes are needed in both hercules and consuming projects.Smoke Testing
We have tested running through the envisaged process of bringing up a new stack and making it live alongside an existing live stack.
I was concerned about the final step - cloud formation adding in the new alias which has actually been added manually at the time of the DNS change.
However, this step did work and there are no issues with future releases after the switch.
Details here: https://techfromsage.atlassian.net/browse/PLT-62?focusedCommentId=110708