Continuous Deployment for your AWS S3 + CloudFront environments
still in early development
I've built this to help supply a continuous delivery git-flow workflow hosted on an AWS serverless setup
Running .deploy('{environment}')
will do the following:
{prefix}-{commit-hash}-{environment}
based on the current repo and configlocalDir
*
making the Distribution pull the new bucket's contentLet's say you have a script operations/aeonian.js
with the following
require('aeonian').config({
bucket: {
localDir: './dist/',
prefix: 'mysite-'
},
website: {
index: 'index.html',
error: 'error/index.html',
},
environments: {
staging: 'CLOUDFRONT_ID',
production: 'CLOUDFRONT_ID',
}
}).deploy(process.argv[2])
Running node operations/aeonian.js staging
this would result in
Which would deploy ./dist/
to your S3+CF staging
environment
npm install aeonian
or yarn add aeonian
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
This is mostly why aeonian exists, to deploy based on commits. Based on the example above, lets say you have the above script operations/aeonian.js
in your repo. you could then add the following to your package.json
"scripts": {
...
"staging": "node operations/aeonian.js staging",
"production": "node operations/aeonian.js production",
...
},
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
staging
branch would deploy the staging
environmentmaster
branch would deploy the production
environmentThe main reason I built aeonian is for my all of my Nuxt.js projects. I have the following commands in my package.json
that I have CircleCI run based on environment
"scripts": {
...
"production": "yarn generate; node operations/aeonian.js production",
"staging": "yarn generate; node operations/aeonian.js staging",
...
},