An ember-cli-deploy plugin that archives and uploads FastBoot build to AWS S3.
npm install ember-cli-deploy-fastboot-s3> An ember-cli-deploy plugin that archives and uploads FastBoot build to AWS S3 based on [FastBoot AWS][1].




This plugin is based on [FastBoot AWS][1], but it only manages FastBoot builds for S3, and does only three things:
1. archives the FastBoot build(from [ember-cli-deploy-build][2]) using revision information(from [ember-cli-deploy-revision-data][3]).
2. creates a file that contains FastBoot deploy info using the archived build as so:
```
{
"bucket": "S3_BUCKET",
"key": "NAME_OF_ZIP_FILE"
}
3. uploads archived build and optionally the FastBoot deploy info file to S3.
This plugin works along with [ember-fastboot-app-server][7]. The same bucket and key in FastBoot deploy info are required for both to work together.
Set the activate flag to upload and update fastboot-deploy-info.json at the same time.
`ember deploy --activate production`
Use ember deploy:activate --revision=myRevision to update fastboot-deploy-info.json with myRevision and not upload the fastboot deploy archive.
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][4].
- Ensure both [ember-cli-deploy-build][2] and [ember-cli-deploy-revision-data][3] are installed and configured.
- Install this plugin
`bash`
$ ember install ember-cli-deploy-fastboot-s3
- Place the following configuration into config/deploy.js
`javascript`
ENV['fastboot-s3'] = {
accessKeyId: '
secretAccessKey: '
bucket: '
region: '
}
- Run the pipeline
`bash`
$ ember deploy production
For detailed information on what plugin hooks are and how they work, please refer to the [Plugin Documentation][4].
- configuredidPrepare
- upload
- activate
- didDeploy
-
For detailed information on how configuration of plugins works, please refer to the [Plugin Documentation][4].
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][5] will take place.
Default: undefined
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
The AWS bucket that the files will be uploaded to.
Default: undefined
The region the AWS bucket is located in.
Default: undefined
A path to upload your files to within the bucket.
Default: undefined
A full path where the S3 compatible service (ie. Minio, Digital Ocean Spaces) resides. When an endpoint is specified a region is no longer required.
Default: undefined
The archive directory for which the archived files are stored.
Default: 'tmp/deploy-archive'
The archive type (zip|tar).
Default: 'zip'
The deploy info file.
Default: 'fastboot-deploy-info.json'
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
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
The following properties are expected to be present on the deployment context object:
- distDir (provided by [ember-cli-deploy-build][2])revisionKey
- (provided by [ember-cli-deploy-revision-data][3])
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:::
],
"Principal": { "AWS": "arn:aws:iam::AWS-account-ID:root" }
}
]
}
`
Replace
To properly serve certain assets (i.e. webfonts) a basic CORS configuration is needed
``
Replace http://www.your-site.com with your domain.
Some more info: [Amazon CORS guide][5], [Stackoverflow][6]
* yarn test`
For more information on using ember-cli, visit http://ember-cli.com/.
[1]: https://github.com/tomdale/fastboot-aws
[2]: https://github.com/ember-cli-deploy/ember-cli-deploy-build
[3]: https://github.com/ember-cli-deploy/ember-cli-deploy-revision-data
[4]: http://ember-cli-deploy.com/docs/v1.0.x/using-plugins "Plugin Documentation"
[5]: http://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html "Amazon CORS guide"
[6]: http://stackoverflow.com/questions/12229844/amazon-s3-cors-cross-origin-resource-sharing-and-firefox-cross-domain-font-loa?answertab=votes#tab-top "Stackoverflow"
[7]: https://github.com/he9qi/ember-fastboot-app-server