Update for 'trumped.com'

This commit is contained in:
Brandon Thomas committed 2018-08-28 03:54:34 -04:00
1 parent 3d32bd2fbc
commit 3a66d5ac2e
3 files changed
+85 -18

No files matched your search

+66
View File
@@ -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
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
```
- 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
------------------
+2 -1
View File
@@ -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`)
+17 -17
View File
@@ -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