GithubHelp home page GithubHelp logo

acidjazz / aeonian Goto Github PK

View Code? Open in Web Editor NEW
44.0 2.0 12.0 1 MB

Continuous deployment assistance for S3 + CloudFront environments

License: Apache License 2.0

JavaScript 100.00%
aeonian aws-sdk ora git-flow circleci cloudfront bucket

aeonian's Introduction

Aeonian Logo

æonian

Continuous Deployment for your AWS S3 + CloudFront environments

still in early development

npm version GitHub issues GitHub license CircleCI Join the chat at https://gitter.im/aws-aeonian/Lobby

NPM

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:

  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

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

Aeonian Demo

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
    • 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 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
  • 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 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",
    ...
  },

aeonian's People

Contributors

acidjazz avatar nicolashmln avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

aeonian's Issues

Issue with S3 bucket recreation on redeploy

After recreating the s3 bucket a few times with the same name, seems like something on AWS doesn't like that and I am not able to create the bucket with the same name again.

Log message when issue starts:

  nuxt:generate Generate done +1ms
✔ Loading æonian
✔ Parsing configuration
ℹ Bucket currently exists, removing first
✔ Emptying bucket: xx-xxxxxxx-production
✔ Deleting bucket: xx-xxxxxxx-production
✔ Creating bucket: xx-xxxxxxx-production
✖ unable to sync:
Done in 50.76s.

Log message the next time it is run:

nuxt:generate Generate done +0ms
✔ Loading æonian
✔ Parsing configuration
✖ s3.createbucket() Error:BucketAlreadyExists: The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.
Done in 40.14s.

Due to this, I think we shouldn't delete the bucket unless the bucket name has changed and we should only empty the bucket.

Make ErrorDocument a config var

When using this with react-router it needs all requests to point to index.html even the false requests. So it would be nice to make this configurable.

Region support

Will you support different regions other than us-east anytime soon?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.