GithubHelp home page GithubHelp logo

tomdale / ember-cli-deploy-elastic-beanstalk Goto Github PK

View Code? Open in Web Editor NEW
21.0 2.0 20.0 45 KB

An ember-cli-deploy plugin for deploying an Ember app to AWS Elastic Beanstalk running FastBoot.

License: MIT License

JavaScript 94.77% HTML 5.23%

ember-cli-deploy-elastic-beanstalk's Introduction

ember-cli-deploy-elastic-beanstalk

An ember-cli-deploy plugin for deploying an Ember app to AWS Elastic Beanstalk running FastBoot. Designed to be used in tandem with fastboot-aws.

This plugin builds your application for FastBoot server-side rendering, then uploads a zip of the build to Amazon S3.

Requires Node.js v4 or later.

What is an ember-cli-deploy plugin?

A plugin is an addon that can be executed as a part of the ember-cli-deploy pipeline. A plugin will implement one or more of the ember-cli-deploy's pipeline hooks.

For more information on what plugins are and how they work, please refer to the Plugin Documentation.

Quick Start

To get up and running quickly, do the following:

  • Configure your ember-cli-deploy pipeline for deploying to a CDN as usual. I recommend ember-cli-deploy-s3 with CloudFront.
  • Install this plugin
$ ember install ember-cli-deploy-elastic-beanstalk
  • Place the following configuration into config/deploy.js
ENV['elastic-beanstalk'] = {
  bucket: '<your-s3-bucket>'
}
  • Run the pipeline
$ ember deploy

Installation

Run the following command in your terminal:

ember install ember-cli-deploy-elastic-beanstalk

A Note on AWS Permissions

This plugin relies on the official AWS SDK to perform uploads to S3. As such, it will inherit any credentials you have saved by running aws configure via the AWS CLI.

For managing multiple credentials, I recommend using the officially-supported profiles feature of AWS.

To create a new profile, make sure you've installed the AWS CLI and then run:

aws configure --profile acme-corp

Enter your access key, secret key and other information requested. Once done, this will create a profile called acme-corp.

To do a deploy with this saved credential profile, invoke the command with the AWS_PROFILE environment variable set:

AWS_PROFILE=acme-corp ember deploy

ember-cli-deploy Hooks Implemented

For detailed information on what plugin hooks are and how they work, please refer to the Plugin Documentation.

  • build
  • didBuild
  • willUpload
  • upload

Configuration Options

For detailed information on how configuration of plugins works, please refer to the Plugin Documentation.

bucket (required)

The AWS bucket that the FastBoot build will be uploaded to.

Default: undefined

environment

The environment target for the FastBoot build. Can be one of "development" or "production".

Default: production

outputPath

The path to the directory you'd like the FastBoot build to be built in to.

Default: tmp/fastboot-dist

zipPath

The path to the zip file that should be created from the outputPath.

Default: tmp/fastboot-dist.zip

filesToExclude

Files that match this pattern will be excluded from the zip. For instance to exclude files with .map extension pass: '\*.map'.

Default: ''

skipNpmInstall

Does not run npm install as part of the build procedure if set to true.

Default: false

Thanks

A big thank you to Luke Melia for helping me refactor my deploy script into an ember-cli-deploy plugin and to the entire ember-cli-deploy core team for answering my many questions.

ember-cli-deploy-elastic-beanstalk's People

Contributors

bobisjan avatar ember-tomster avatar kpfefferle avatar sevab avatar simonihmig avatar tomdale avatar

Stargazers

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

Watchers

 avatar  avatar

ember-cli-deploy-elastic-beanstalk's Issues

eb:provision command works only for us-east-1 region

The S3 bucket (https://github.com/tomdale/ember-cli-deploy-elastic-beanstalk/blob/master/lib/aws/elastic-beanstalk.js#L64) containing fastboot-aws is in the us-east-1 region. As AWS requires the EB Application to be in the same region as the source bundle, this effectively prevents creating the EB Application in any other region than us-east-1.

Not sure how to fix this. Maybe the user has to deploy fastboot-aws into his own S3 bucket in his region? Would require a configurable bucket name...

ember eb:provision Unable to download from S3 location (301)

I'm getting a 301 in trying to provision.
Error:

Creating Elastic Beanstalk application version
Unable to download from S3 location (Bucket: fastboot-aws  Key: fastboot-aws-latest.zip). Reason: Moved Permanently
InvalidParameterCombination: Unable to download from S3 location (Bucket: fastboot-aws  Key: fastboot-aws-latest.zip). Reason: Moved Permanently
    at Request.extractError (/Users/xn/sites/thing/node_modules/aws-sdk/lib/protocol/query.js:40:29)
    at Request.callListeners (/Users/xn/sites/thing/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
    at Request.emit (/Users/xn/sites/thing/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/Users/xn/sites/thing/node_modules/aws-sdk/lib/request.js:615:14)
    at Request.transition (/Users/xn/sites/thing/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/Users/xn/sites/thing/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /Users/xn/sites/thing/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/Users/xn/sites/thing/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/Users/xn/sites/thing/node_modules/aws-sdk/lib/request.js:617:12)
    at Request.callListeners (/Users/xn/sites/thing/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
    at Request.emit (/Users/xn/sites/thing/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/Users/xn/sites/thing/node_modules/aws-sdk/lib/request.js:615:14)
    at Request.transition (/Users/xn/sites/thing/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/Users/xn/sites/thing/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /Users/xn/sites/thing/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/Users/xn/sites/thing/node_modules/aws-sdk/lib/request.js:38:9)

deploy.js

    ENV['elastic-beanstalk'] = {
      bucket: process.env.STAGING_BUCKET
    }
    ENV.s3 = {
      accessKeyId: process.env.AWS_KEY,
      secretAccessKey: process.env.AWS_SECRET,
      bucket: process.env.STAGING_BUCKET,
      region: process.env.STAGING_REGION
    }

Maybe the s3 url is mangled?

MissingRequiredParameter: Missing required key 'Key' in params

Complete stack trace:

+- upload
|  |
|  +- elastic-beanstalk
- uploading tmp/deploy-dist-1d0832b056db7adf518bca06279d56ee.zip to ember-deployment-fastboot-test
|
+- didFail
MissingRequiredParameter: Missing required key 'Key' in params
    at ParamValidator.fail (/Users/kieranhall/workspace/aws-deployment-test/node_modules/ember-cli-deploy-elastic-beanstalk/node_modules/aws-sdk/lib/param_validator.js:50:37)
    at ParamValidator.validateStructure (/Users/kieranhall/workspace/aws-deployment-test/node_modules/ember-cli-deploy-elastic-beanstalk/node_modules/aws-sdk/lib/param_validator.js:61:14)
    at ParamValidator.validateMember (/Users/kieranhall/workspace/aws-deployment-test/node_modules/ember-cli-deploy-elastic-beanstalk/node_modules/aws-sdk/lib/param_validator.js:88:21)
    at ParamValidator.validate (/Users/kieranhall/workspace/aws-deployment-test/node_modules/ember-cli-deploy-elastic-beanstalk/node_modules/aws-sdk/lib/param_validator.js:34:10)
    at Request.VALIDATE_PARAMETERS (/Users/kieranhall/workspace/aws-deployment-test/node_modules/ember-cli-deploy-elastic-beanstalk/node_modules/aws-sdk/lib/event_listeners.js:109:42)
    at Request.callListeners (/Users/kieranhall/workspace/aws-deployment-test/node_modules/ember-cli-deploy-elastic-beanstalk/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
    at callNextListener (/Users/kieranhall/workspace/aws-deployment-test/node_modules/ember-cli-deploy-elastic-beanstalk/node_modules/aws-sdk/lib/sequential_executor.js:95:12)
    at /Users/kieranhall/workspace/mindcurv/aws-deployment-test/node_modules/ember-cli-deploy-elastic-beanstalk/node_modules/aws-sdk/lib/event_listeners.js:75:9
    at finish (/Users/kieranhall/workspace/aws-deployment-test/node_modules/ember-cli-deploy-elastic-beanstalk/node_modules/aws-sdk/lib/config.js:308:7)

Prior to getting this error, my config object looked like:

'elastic-beanstalk': {
  bucket: 'ember-deployment-fastboot-test'
}

After some tinkering and help from Michael Klein, we determined that the config needs to have a key key defining like so:

'elastic-beanstalk': {
  bucket: 'ember-deployment-fastboot-test',
  key: 'fastboot-dist.json' // inline with fastboot-aws server requirements
}

After this change, the deployment works, and I see my dist-***.zip in my bucket, plus the key configuration creates a file by the same name, with the expected mapping to be picked up by EB.

Perhaps the AWS CLI API changed? I am working with this version on my machine.

I'll prepare a PR for the documentation change.

Can not upload to bucket in Frankfurt

Hello,

when uploading application to S3 bucket located in Frankfurt I got
Failed InvalidRequest: The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256..

According to documentation it is required to use v4 with Frankfurt and some other locations.

I have configuration in config/deploy.js like

...
'elastic-beanstalk': {
      bucket: 'some-fastboot-bucket',
      region: 'eu-central-1',
      key: 'fastboot-deploy-info.json'
},
...

But the region is lost here, so it ends up with AWS.S3 instance configured to

{
  ...
  region: 'us-east-1',
  signatureVersion: 's3'
  ...
}

So, a fix may look like

this.s3 = new S3({ region: options.region });

and PR is coming.

Cannot find module './lib/aws'

I think I've followed all the steps in ember-cli-deploy-s3 and here.
I've successfully provisioned a tier in aws but when it comes to deploy I get this stack trace.

Cannot find module './lib/aws'
Error: Cannot find module './lib/aws'
    at Function.Module._resolveFilename (module.js:327:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:355:17)
    at require (internal/module.js:13:17)
    at Object.<anonymous> (/Users/miguelcamba/code/own/ember-power-select/node_modules/ember-cli-deploy-elastic-beanstalk/node_modules/aws-sdk/index.js:2:18)
    at Module._compile (module.js:399:26)
    at Object.Module._extensions..js (module.js:406:10)
    at Module.load (module.js:345:32)
    at Function.Module._load (module.js:302:12)
    at Module.require (module.js:355:17)
    at require (internal/module.js:13:17)
    at Object.<anonymous> (/Users/miguelcamba/code/own/ember-power-select/node_modules/ember-cli-deploy-elastic-beanstalk/lib/elastic-beanstalk-deploy-plugin.js:8:25)
    at Module._compile (module.js:399:26)
    at Object.Module._extensions..js (module.js:406:10)
    at Module.load (module.js:345:32)
    at Function.Module._load (module.js:302:12)

In case it makes a difference, the app I'm trying to deploy is actually the dummy app in an addon, so everything is open source in case it helps.

Probably I'm missing something obvious, aws is confusing as hell for me.

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.