The demo site is deployed on netlify. The production site is deployed on AWS using CodePipeline.
Connect it to GitHub repo, and the deployment settings are as follows:
Build command: grow install; grow build; cp robots-demo.txt build/robots.txt
Publish directory: build
Production branch: deploy
Since this is demo site, no custom domain.
Set to build on all branches and to add status messages to PRs.
-
nd-website-deploy
-
bucket policy:
{ "Version": "2012-10-17", "Id": "Policy1509568446316", "Statement": [ { "Sid": "Stmt1509568444826", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::nd-website-deploy/*" } ]
- Name: nd-website-deploy
- Source: GitHub
- Branch: deploy
- Build provider: AWS CodeBuild
- Name: build-website
- image: Ubuntu/Python2.7.12
- buildspec.yml: buildspec_deploy.yml
{
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::nd-website-deploy/*",
"arn:aws:s3:::nd-website-deploy"
],
"Action": ["s3:*"]
}
Otherwise paths are not followed to their index.html objects
- Source is the bucket host URL (not the bucket object path)
- HTTP -> HTTPS redirect
- using default CloudFront certificate
- index.html as base object
- ListInvalidations/GetInvalidation/CreateInvalidation (so that each build invalidates CloudFront cache)
- Role needs permissions to S3 buckets as well
- Redirects are handled by the properties field in the Bucket (static website
hosting/redirection rules
), and the XML for this can be generated usingmisc/redirect.py
and copy/pasting into the bucket properties
- New CloudFront origin for talks (from a different bucket)
- Have a similar CodePipeline setup for the neurodata/talks repo, which just copies objects to the talks bucket.
- Under behaviors in CloudFront, we have the following hierarchy:
talks
| S3-nd-website-deploytalks/
| S3-nd-website-deploytalks/*
| S3-nd-talksDefault (*)
| S3-nd-website-deploy
- This allows serving the talks listing page at neurodata.io/talks/ while also serving each talk at
neurodata.io/talks/talk.html
- Inside the bucket for talks, all the content are organized with a prefix of
talks
.