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.
Woah! I finished this? Wild.
You can see a preview of this on my local repo:
MelissaAutumn#1
This PR brings preview environments to thunderbird-website! Simply attach the
preview environment
label to a PR, and in like 7 minutes you'll have a live instance of that PR. If the PR is updated, the workflow will re-run and generate two new instances and clean up the old ones. If you unattach the label or delete the PR it should also clean up.Cleaning up is powered by tagging everything in AWS. I create a unique id derived from a particular PR, and use that to lookup specific resources to nuke before generating new instances (or not depending on if we're closing a PR.)
I may have overlooked a specific resource to be cleaned up but we can fix that later. The repository should clean up any images older than 7 days automatically.
I setup our
preview.thunderbird.dev
to wildcard to the load balancer used. And the target groups for that load balancer directs the user to the correct fargate instance. (That was a pain to setup.)There should be a user setup with the required permissions, but I may have missed one here or there. The task definitions should be created on upload, so don't worry about that.
Most importantly, this artfully crafts artisanal subdomains via a random name library, and a custom list of bird species I've scoured wikipedia for. (Do we need to attribute that?)
I believe I've updated all the hardcoded references, apologies if I didn't.
You'll need to setup the following secrets:
AWS_ACCESS_KEY_ID
- Access key of the IAM userAWS_SECRET_ACCESS_KEY
- The secret access key for the IAM userAWS_AVAIL_REGION
- This one is dumb, it's the availability region, so probably us-west-2a or 2b. This lives in the load balancerAWS_LISTENER_ARN
- The HTTPS:443 listener on the load balancer's arnAWS_LOAD_BALANCER_ARN
- The load balancer arnAWS_SUBNETS
- The subnets to use, I was lazy and put this in a secret. This needs to be a list of strings, so grab the two subnets and enter them as"subnet-arn-1","subnet-arn-2"
(Use double quotes)AWS_SECURITY_GROUPS
- Similar to subnets:"security-group-1","security-group-2"
, if there's only one then just put one string value. (Use double quotes)AWS_VPC_ID
- VPC IDPREVIEW_HOST_URL
-preview.thunderbird.dev
.PREVIEW_IS_SECURE
-1
I've named everything with preview-env, so look for those 😄
I'll answer any particular questions when I'm able to, but it may be a bit.