Git Product home page Git Product logo

ember-cli-deploy-fastboot-s3's Introduction

ember-cli-deploy-fastboot-s3

An ember-cli-deploy plugin that archives and uploads FastBoot build to AWS S3 based on FastBoot AWS.

Build Status npm version Ember Observer Score

This plugin is based on FastBoot AWS, but it only manages FastBoot builds for S3, and does only three things:

  1. archives the FastBoot build(from ember-cli-deploy-build) using revision information(from ember-cli-deploy-revision-data).
  2. creates a file that contains FastBoot deploy info using the archived build as so:
{
  "bucket": "S3_BUCKET",
  "key": "NAME_OF_ZIP_FILE"
}
  1. uploads archived build and the FastBoot deploy info file to S3.

This plugin works along with ember-fastboot-app-server. The same bucket and key in FastBoot deploy info are required for both to work together.

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:

$ ember install ember-cli-deploy-fastboot-s3
  • Place the following configuration into config/deploy.js
ENV['fastboot-s3'] = {
  accessKeyId: '<your-aws-access-key>',
  secretAccessKey: '<your-aws-secret>',
  bucket: '<your-s3-bucket>',
  region: '<the-region-your-bucket-is-in>'
}
  • Run the pipeline
$ ember deploy

Installation

Run the following command in your terminal:

ember install ember-cli-deploy-fastboot-s3

ember-cli-deploy Hooks Implemented

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

  • didPrepare
  • upload

Configuration Options

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

accessKeyId

The AWS access key for the user that has the ability to upload to the bucket. If this is left undefined, the normal AWS SDK credential resolution will take place.

Default: undefined

secretAccessKey

The AWS secret for the user that has the ability to upload to the bucket. This must be defined when accessKeyId is defined.

Default: undefined

bucket (required)

The AWS bucket that the files will be uploaded to.

Default: undefined

region (required)

The region the AWS bucket is located in.

Default: undefined

archivePath

The archive directory for which the archived files are stored.

Default: 'tmp/deploy-archive'

archiveType

The archive type (zip|tar).

Default: 'zip'

deployInfo

The deploy info file.

Default: 'fastboot-deploy-info.json'

distDir

The root directory where the file matching filePattern will be searched for. By default, this option will use the distDir property of the deployment context.

Default: context.distDir

revisionKey

The unique revision number for the version of the file being archived and uploaded to S3. By default this option will use either the revisionKey passed in from the command line or the revisionData.revisionKey property from the deployment context.

Default: context.commandLineArgs.revisionKey || context.revisionData.revisionKey

Prerequisites

The following properties are expected to be present on the deployment context object:

Configuring Amazon S3

Minimum S3 Permissions

Ensure you have the minimum required permissions configured for the user (accessKeyId). A bare minimum policy should have the following permissions:

{
    "Statement": [
        {
            "Sid": "Stmt1EmberCLIS3DeployPolicy",
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:PutObject",
                "s3:PutObjectACL"
            ],
            "Resource": [
                "arn:aws:s3:::<your-s3-bucket-name>/*"
            ],
            "Principal": { "AWS": "arn:aws:iam::AWS-account-ID:root" }
        }
    ]
}

Replace with the name of the actual bucket you are deploying to. Also, remember that "PutObject" permission will effectively overwrite any existing files with the same name unless you use a fingerprinting or a manifest plugin.

Sample CORS configuration

To properly serve certain assets (i.e. webfonts) a basic CORS configuration is needed

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <CORSRule>
    <AllowedOrigin>http://www.your-site.com</AllowedOrigin>
    <AllowedOrigin>https://www.your-site.com</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <AllowedMethod>HEAD</AllowedMethod>
  </CORSRule>
</CORSConfiguration>

Replace http://www.your-site.com with your domain.

Some more info: Amazon CORS guide, Stackoverflow

Running Tests

  • node tests/runner.js

For more information on using ember-cli, visit http://ember-cli.com/.

Contributing

PRs welcome!

ember-cli-deploy-fastboot-s3's People

Contributors

cspanring avatar ember-tomster avatar he9qi avatar willviles avatar

Watchers

 avatar  avatar

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.