-
Notifications
You must be signed in to change notification settings - Fork 4
Switching between Day 1 Architecture and The New Architecture of Hollowverse
Instructions on this page assume you have write access to the repositories in the Hollowverse organization on GitHub as well as administrator access in AWS.
IMPORTANT: Make sure every step is complete before moving on to the next step. Do not perform any step if the AWS resources in the previous step are still being updated, created or removed.
-
Deploy the following CloudFormation stacks using the Serverless framework:
a.
hollowverse/process-image
usingNODE_ENV=production yarn sls deploy --stage production
.b.
hollowverse/track-performance
usingNODE_ENV=production yarn sls deploy --stage production
.Alternatively, you can trigger the deployments from the respective Travis CI pages (assuming you have write access to these repos).
-
In the AWS web console, go to Route 53 and temporarily change the DNS record of both
hollowverse.com
andstatic.hollowverse.com
to point to the IP oflive.hollowverse.com
(the IP should be in the DNS record list). This is to avoid any downtime. -
Now go to CloudFront and de-associate all the aliases in the CloudFront distribution whose origin is
live.hollowverse.com
exceptstatic.legacy.hollowverse.com
. These aliases need to be de-associated before performing the next step. -
Deploy
hollowverse/route-request
usingNODE_ENV=production yarn sls deploy --stage production
or by triggering a new build from Travis. -
Now clone
hollowverse/infrastructure
:- Revert this commit
- Run
terraform init
- When asked for the bucket name, use
hollowverse-terraform-state-production
. - Run
terraform apply
. - When asked for variable values, use the following:
- for
stage
, useproduction
- for
public_ssh_key
, use the contents ofid_rsa.pub
stored in our secrets repository on GitHub. - for
db_password
, use the value stored in our secrets repository too
- for
- Review the changes and type
yes
to start applying the changes.
-
After the new infrastructure is up, clone the API repository,
hollowverse/api
and perform the following steps:- In
serverless.yml
, update the value ofcustom.vpnConfig.production.securityGroupIds
to be the security group ID that is returned from runningterraform output database_access_security_group
in thehollowverse/infrastructure
repository. - Run
NODE_ENV=production yarn sls deploy --stage production
.
- In
-
Update or add the DNS record for
api.hollowverse.com
to be an alias forapi-apigw-production.hollowverse.com
. -
After the API is up, revert this commit and deploy
hollowverse/hollowverse
(bothmaster
andbeta
branches):a. Checkout the
master
branch, revert the commit, and performBRANCH=master NODE_ENV=production yarn sls deploy --stage master
.b. Checkout the
beta
branch, revert the commit, and performBRANCH=beta NODE_ENV=production yarn sls deploy --stage beta
.Alternatively, you can trigger the deployments from the respective Travis CI pages (assuming you have write access to these repos).
-
Point the DNS record of
hollowverse.com
andstatic.hollowverse.com
to the new CloudFront distribution created byroute-request
whose origin isstatic.legacy.hollowverse.com
. -
Copy the images in https://github.com/hollowverse-archive/scraper/tree/master/output/images to a new folder named
notable-people
in the S3 bucket namedhollowverse-photos-unprocessed-production
. It's recommended that the files are uploaded in batches of ~100 images and that you wait a few minutes between each batch to avoid hitting the rate limits of Cloudinary, which is the service that we use to crop the photos when they are uploaded.
-
In Route 53, temporarily change the DNS records of both
hollowverse.com
andstatic.hollowverse.com
to point to the IP oflive.hollowverse.com
(the IP should be in the DNS record list). This is to avoid any downtime. -
Go to CloudFront and choose the CloudFront distribution created by
route-request
whose origin isstatic.legacy.hollowverse.com
.- Remove all aliases of this distribution
- Disable logging
- In the Behaviors tab, choose the default behavior and remove all the 3 Lambda@Edge functions associated with that behavior.
-
Now go back to CloudFront main dashboard and the choose the CloudFront distribution whose origin is
live.hollowverse.com
. Add the following aliases:hollowverse.com
static.hollowverse.com
www.hollowverse.com
www.thehollowverse.com
thehollowverse.com
-
Copy the CloudFront domain (e.g.
dryr01pq3kykt.cloudfront.net
) of that distribution and go to Route 53. Update the DNS record forhollowverse.com
to be an alias for that domain. -
Go to S3 and empty (but do not delete) the following buckets:
hollowverse-logs-production
hollowverse-photos-processed-production
hollowverse-photos-unprocessed-production
track-performance-production
-
Clone
hollowverse/infrastructure
:- Re-apply this commit.
- Run
terraform init
- When asked for the bucket name, use
hollowverse-terraform-state-production
. - Run
terraform apply
. - When asked for the value of the
stage
variable, useproduction
This will destroy almost all the infrastructure with the exception of the VPC which is required because the legacy website instance is in that VPC.
-
Clone
hollowverse/track-performance
,hollowverse/route-request
,hollowverse/process-image
,hollowverse/api
and runyarn sls remove --stage production
in each repository. -
Clone
hollowverse/hollowverse
and runyarn sls remove --stage master
andyarn sls remove --stage beta
. -
Remove the DNS record for
api.hollowverse.com
in Route 53. -
Because changes to CloudFront distributions usually take a considerable amount of time to propagate, removing
route-request
could fail. Please manually check the CloudFormation dashboard after around half an hour and try to delete theroute-request
stack manually.
If you need help or wanna get in touch, you can:
Post a message to our public message board, email us, or chat with us.