aeonian-europefix
v1.0.11
Published
Continuous deployment to for S3->CloudFront setups
Downloads
5
Readme
still in early development
I've built this to help supply a continuous delivery git-flow workflow hosted on an AWS serverless setup
What does this do?
Running .deploy('{environment}')
will do the following:
- Create a new S3 bucket
{prefix}-{commit-hash}-{environment}
based on the current repo and config - Upload the contents of a local directory you specified as
localDir
- Configure the newly created bucket as a static website
- Change the origin of the CloudFront ID associated to point to our new bucket's website URL
- Initiate an invalidation on
*
making the Distribution pull the new bucket's content - Delete the previous bucket that was assigned as the origin as to not leave a trail of buckets
Example
Let's say you have a script operations/staging.js
with the following
require('aeonian').config({
bucket: {
localDir: './dist/',
prefix: 'mysite-'
},
environments: {
staging: 'CLOUDFRONT_ID',
production: 'CLOUDFRONT_ID',
}
}).deploy('staging')
Running this would result in
Which would deploy ./dist/
to your S3+CF staging
environment
Installation
- Install the aeonian package
npm install aeonian
oryarn add aeonian
- Set the current environment variables to your AWS key and secret for the AWS JS SDK
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
- Other options on this step can be found here
CircleCI Integration
This is mostly why aeonian exists, to deploy based on commits. Based on the example above, lets say you have scripts operations/staging.js
and operations/production.js
in your repo. you could then add the following to your package.json
"scripts": {
..
"staging": "node operations/staging.js",
"production": "node operations/production.js",
..
},
After setting your AWS credentials on CircleCi, you could add something like this to your circle.yml
deployment:
staging:
branch: staging
commands:
- npm run staging
production:
branch: master
commands:
- npm run production
- Any commit/PR merge to the
staging
branch would deploy thestaging
environment - Any commit/PR merge to the
master
branch would deploy theproduction
environment
TravisCI Integration
Please submit a PR or an issue once you get this running, so I can update this