To proceed with the deployment to S3, we will install these plugins:
As they are Ember addon you can easily install by running the following commands
ember install ember-cli-deploy-s3-index
ember install ember-cli-deploy-s3
All you need after that is to configure deploy.js file which should under /config folder:
// config/deploy.js
module.exports = function(deployTarget) {
var ENV = {
build: {
environment: deployTarget
},
'revision-data': {
type: 'git-commit'
},
's3-index': {
accessKeyId: process.env['S3_ACCESS_KEY'],
secretAccessKey: process.env['S3_SECRET_ACCESS_KEY'],
bucket: "your-app-deployment-bucket",
region: "YOUR REGISION",
allowOverwrite: true // if you want to overwrite index file if not change it to false
},
's3': {
accessKeyId: process.env['S3_ACCESS_KEY'],
secretAccessKey: process.env['S3_SECRET_ACCESS_KEY'],
bucket: "your-app-deployment-bucket",
region: "YOUR REGISION",
}
};
return ENV;
};
Notice that we have used the environmental variables within our config.If you need to read configuration from a file, it’s also possible to return a promise that resolves with the ENV
object. Here is an example to define different environments in deploy.js file:
if (deployTarget === 'development') {
ENV.build.environment = 'development';
// configure other plugins for development deploy target here
}
if (deployTarget === 'staging') {
ENV.build.environment = 'production';
// configure other plugins for staging deploy target here
}
if (deployTarget === 'production') {
ENV.build.environment = 'production';
// configure other plugins for production deploy target here
}
Finally, you can easily run following command to deploy
ember deploy [YOUR APP ENVIRONMENT] //e.g-> ember deploy production or ember deploy staging
if you like to see details you can run:
ember deploy production --verbose --activate=true