automated deployments to an opinionated AWS architecture
The goal of this component is to aid in the deployment to a cost-effective, test-effective, and fully automated deployment process for people who use AWS as their production (and test-prod) architecture. This solution is available on npm and can be installed with:
# Install globally
npm install -g aws-pusher
# initialize your project (from within project directory)
pusher init
The aws-pusher application is available as a CLI application to start with the following pipeline commands:
pusher.json
in project rootpusher.json
pusher status
The kind of information that would be provided to the user would include:
Note: EC2 is ignored unless configuration is specified; automation is strictly for static asset deployment
pusher push
The "push" command responds to a user request to build and deploy the users current sandboxed code to AWS.
Note: in order for this to be fully automated the pusher configuration will need to first build the latest version of the code and then push it to to the AWS architecture. This requires that either the static framework is known (for now just Ember) or that the pusher configuration provides a hook to allow
pusher commit
The "commit" can be run as a CLI command but is more typically attached to git's post-commit
hook. This ensures that whenever a
git push
is made that pusher has a chance to ensure AWS is up-to-date.
pusher addon
This will dynamically install a dependency into the global CLI so that its functionality (imagined to mainly be additional pipeline tasks). This command would not be available day one but supports the idea of providing future extensibility.
This tooling is meant to deploy static assets to an opinionated AWS architecture regardless of the underlying static site's technology. That said, over time
it will be helpful for the pusher push
command to understand how to plug into the static assets build pipeline. To kick of this contextual awareness, the
aws-pusher will come with out of the box support for Ember apps which use ember-cli.
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "Allow Public Access to All Objects",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::[your-site.com]/*"
}
]
}
Hosting the same site off of http://WWW.site.com
and http://site.com
is not good for your SEO juju so you'll want to redirect. Is that a problem? Nope. But it may be a surprise that this happens at the S3 level rather than Route53. Whether you decide to force the 'www' or lose it make very little difference, this example will assume that the redirection will be done toward removing the 'www':
Create a S3 bucket called 'www.site.com', then configure it like so:
Now go to Route53 and create a A record (as an Alias) which points to your "Endpoint" defined for your new bucket.
All done.
The pusher script is going to push all your CSS and JS files with a content-type of 'gzip'. That is good. Your ember build is going to produce CSS and JS that are not gzipped. That is bad. Problem solved:
ember install:addon ember-cli-gzip
And then modify your Brocfile:
var app = new EmberApp({
gzip: {
appendSuffix: false
}
});