Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/acidjazz/aeonian
Continuous deployment assistance for S3 + CloudFront environments
https://github.com/acidjazz/aeonian
aeonian aws-sdk bucket circleci cloudfront git-flow ora
Last synced: 4 months ago
JSON representation
Continuous deployment assistance for S3 + CloudFront environments
- Host: GitHub
- URL: https://github.com/acidjazz/aeonian
- Owner: acidjazz
- License: apache-2.0
- Created: 2017-06-19T06:03:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-05-13T20:36:10.000Z (almost 5 years ago)
- Last Synced: 2024-09-19T05:44:43.301Z (5 months ago)
- Topics: aeonian, aws-sdk, bucket, circleci, cloudfront, git-flow, ora
- Language: JavaScript
- Homepage:
- Size: 1000 KB
- Stars: 44
- Watchers: 2
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
![]()
æonian
![]()
![]()
![]()
![]()
![]()
Continuous Deployment for your AWS S3 + CloudFront environments
> still in early development
[](https://badge.fury.io/js/aeonian)
[](https://github.com/acidjazz/aeonian/issues)
[](https://raw.githubusercontent.com/acidjazz/aeonian/master/license)
[](https://circleci.com/gh/acidjazz/aeonian/)
[](https://gitter.im/aws-aeonian/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[](https://nodei.co/npm/aeonian/)
I've built this to help supply a continuous delivery [git-flow](http://nvie.com/posts/a-successful-git-branching-model/) workflow hosted on an AWS serverless setup
### What does this do?
Running `.deploy('{environment}')` will do the following:
1. Create a new S3 bucket `{prefix}-{commit-hash}-{environment}` based on the current repo and config
2. Upload the contents of a local directory you specified as `localDir`
3. Configure the newly created bucket as a static website
4. Change the origin of the CloudFront ID associated to point to our new bucket's website URL
5. Initiate an invalidation on `*` making the Distribution pull the new bucket's content
6. 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/aeonian.js` with the following
```javascript
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
### Installation
* Install the aeonian package
`npm install aeonian` or `yarn add aeonian`
* Set the current environment variables to your AWS key and secret for the [AWS JS SDK](https://aws.amazon.com/sdk-for-node-js/)
* `AWS_ACCESS_KEY_ID`
* `AWS_SECRET_ACCESS_KEY`
* Other options on this step can be found [here](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html)### CircleCI Integration
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`
```javascript
"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`
```yaml
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 the `staging` environment
* Any commit/PR merge to the `master` branch would deploy the `production` environment### Nuxt.js Integration
The main reason I built aeonian is for my all of my [Nuxt.js](https://nuxtjs.org/) projects. I have the following commands in my `package.json` that I have CircleCI run based on environment```javascript
"scripts": {
...
"production": "yarn generate; node operations/aeonian.js production",
"staging": "yarn generate; node operations/aeonian.js staging",
...
},```