From 3a66d5ac2ed55b6ba7a6471eae477cb4e953f8e3 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 28 Aug 2018 03:54:34 -0400 Subject: [PATCH] Update for 'trumped.com' --- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++ frontend/animation.ts | 3 +- s3-deploy.sh | 34 +++++++++++----------- 3 files changed, 85 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 3ea2198479..40ec06dc84 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,72 @@ Trumpet 2. ??? 3. lol +AWS Notes +--------- + +### S3 Bucket + +- Bucket *must* be named per the domain, eg. `trumped.com` instead of `trumped-index`. +- Static website hosting: set index.html, error.html +- Set the Bucket Policy: ```{ + "Version": "2012-10-17", + "Id": "Policy1535378813796", + "Statement": [ + { + "Sid": "Stmt1478413958263", + "Effect": "Allow", + "Principal": { + "AWS": "arn:aws:iam::961528074194:user/junglehorse" + }, + "Action": "s3:*", + "Resource": "arn:aws:s3:::trumped.com/*" + }, + { + "Sid": "PublicReadGetObject", + "Effect": "Allow", + "Principal": "*", + "Action": "s3:GetObject", + "Resource": "arn:aws:s3:::trumped.com/*" + } + ] +} +``` + +- Set CORS headers, + +```xml + + + + * + GET + HEAD + 3000 + * + + +``` + +- Note that the URL is `http://trumped.com.s3-website-us-east-1.amazonaws.com/` (static websites), + not `http://trumped.com.s3.amazonaws.com/` (REST endpoints)! + +### Cloudfront + +- Origin domain name: trumped-frontend.s3.amazonaws.com +- Origin path: (null) +- Origin id: S3-trumped-frontend +- Restrict access: no +- Alternative domain names (CNAMEs): trumped.com, www.trumped.com, cdn.trumped.com +- SSL certificate: Default Cloudfront (\*.cloudfront.net) +- Default root object: index.html +- Extra: + - Behaviors: `/` at precedence 0, forward query strings. + - Error pages (403, 404) to direct to `/error.html` + +### Elastic Beanstalk + +- (Make sure you're in the same region you set the app up in!) + Running the server ------------------ diff --git a/frontend/animation.ts b/frontend/animation.ts index 03036ad2ce..bec35dc1fe 100644 --- a/frontend/animation.ts +++ b/frontend/animation.ts @@ -102,7 +102,8 @@ export function setup_animation() { //logo = new PIXI.Text('Jungle Horse', // {font: '150px Impact Bold', fill: 0x000000, align: 'center'}); - let texture = PIXI.Texture.fromImage(`${prefix}/jungle_horse_lobster.png`); + //let texture = PIXI.Texture.fromImage(`${prefix}/jungle_horse_lobster.png`); + let texture = PIXI.Texture.fromImage(`${prefix}/trumped.png`); logo2 = new PIXI.Sprite(texture); PIXI.loader.add('asset', `${prefix}/trumpette/idle_0.png`) diff --git a/s3-deploy.sh b/s3-deploy.sh index f41599b5a3..0cb7520a55 100755 --- a/s3-deploy.sh +++ b/s3-deploy.sh @@ -39,18 +39,18 @@ upload_assets() { pushd $output_dir # /assets/output/main.built.js -> /assets/main.built.js sed -i "s/assets\/output/assets/g" index.html - # /assets/main.built.js -> //cdn.jungle.horse/assets/${checksum}/main.built.js - sed -i "s/\/assets/\/\/cdn.jungle.horse\/assets\/${checksum}/g" index.html + # /assets/main.built.js -> //cdn.trumped.com/assets/${checksum}/main.built.js + sed -i "s/\/assets/\/\/cdn.trumped.com\/assets\/${checksum}/g" index.html # Variable substitutions sed -i "s/asset_content_hash/${checksum}/g" index.html sed -i "s/DEVELOPMENT/production/g" index.html - sed -i "s/API_HOST/http:\/\/api.jungle.horse/g" index.html - sed -i "s/CDN_HOST/\/\/cdn.jungle.horse/g" index.html + sed -i "s/API_HOST/http:\/\/api.trumped.com/g" index.html + sed -i "s/CDN_HOST/\/\/cdn.trumped.com/g" index.html popd - aws s3 cp $output_dir s3://junglehorse-frontend/assets/${checksum} --recursive - aws s3 cp $output_dir/index.html s3://jungle.horse/index.html - aws s3 cp $output_dir/index.html s3://junglehorse.com/index.html + aws s3 cp $output_dir s3://cdn.trumped.com/assets/${checksum} --recursive + aws s3 cp $output_dir/index.html s3://trumped.com/index.html + #aws s3 cp $output_dir/index.html s3://junglehorse.com/index.html popd } @@ -61,24 +61,24 @@ upload_stable_assets() { echo '> Upload stable assets (images, robots.txt, etc.)' pushd web # S3 Bucket - # jungle.horse website - aws s3 cp error.html s3://jungle.horse/ - aws s3 cp favicon.ico s3://jungle.horse/favicon.ico - aws s3 cp robots.txt s3://jungle.horse/ + # trumped.com website + aws s3 cp error.html s3://trumped.com/ + aws s3 cp favicon.ico s3://trumped.com/favicon.ico + aws s3 cp robots.txt s3://trumped.com/ # S3 Bucket # junglehorse.com website - aws s3 cp error.html s3://junglehorse.com/ - aws s3 cp favicon.ico s3://junglehorse.com/favicon.ico - aws s3 cp robots.txt s3://junglehorse.com/ + #aws s3 cp error.html s3://junglehorse.com/ + #aws s3 cp favicon.ico s3://junglehorse.com/favicon.ico + #aws s3 cp robots.txt s3://junglehorse.com/ # Cloudfront bucket. # Keep error.html in both buckets. - aws s3 cp error.html s3://junglehorse-frontend/ - aws s3 cp images/ s3://junglehorse-frontend/images/ --recursive + aws s3 cp error.html s3://cdn.trumped.com/ + aws s3 cp images/ s3://cdn.trumped.com/images/ --recursive popd } upload_assets -#upload_stable_assets +upload_stable_assets