Skip to content

Commit

Permalink
prepare ember for deploying to production
Browse files Browse the repository at this point in the history
  • Loading branch information
konto-andrzeja committed Jul 9, 2016
1 parent 5ea0dcb commit e411f42
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
25 changes: 24 additions & 1 deletion ember-app/config/deploy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var VALID_DEPLOY_TARGETS = [ //update these to match what you call your deployment targets
'development-post-build'
'development-post-build',
'production'
];

module.exports = function(deployTarget) {
Expand All @@ -24,6 +25,28 @@ module.exports = function(deployTarget) {
};
}

if (deployTarget === 'production') {
ENV.build = {
environment: 'production'
};
ENV.redis = {
keyPrefix: 'rssify:index',
allowOverwrite: true,
host: 'localhost'
};
ENV['ssh-tunnel'] = {
username: process.env['EC2_SSH_USERNAME'],
host: process.env['EC2_HOST'],
dstHost: process.env['REDIS_HOST']
};
ENV.s3 = {
accessKeyId: process.env['AWS_ACCESS_KEY'],
secretAccessKey: process.env['AWS_SECRET_KEY'],
bucket: 'rssify',
region: 'eu-central-1'
};
}

return ENV;

/* Note: a synchronous return is shown above, but ember-cli-deploy
Expand Down
10 changes: 6 additions & 4 deletions ember-app/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@
var EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
var env = EmberApp.env() || 'development';
var isProduction = EmberApp.env() === 'production';
var app = new EmberApp(defaults, {
// Add options here
sassOptions: {
extension: 'scss'
},
fingerprint: {
enabled: true,
prepend: (env === 'development') ? 'http://localhost:4200/' : 'https://amazonaws.com/bucket/'
prepend: isProduction ? 'http://rssify.s3-website.eu-central-1.amazonaws.com/' : 'http://localhost:4200/'
},
emberCLIDeploy: {
runOnPostBuild: (env === 'development') ? 'development-post-build' : false,
runOnPostBuild: isProduction ? false : 'development-post-build',
shouldActivate: true
}
},
minifyCSS: { enabled: isProduction },
minifyJS: { enabled: isProduction }
});

// Use `app.import` to add additional libraries to the generated
Expand Down
1 change: 1 addition & 0 deletions ember-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"ember-cli-dependency-checker": "^1.2.0",
"ember-cli-deploy": "1.0.0-beta.1",
"ember-cli-deploy-lightning-pack": "0.6.5",
"ember-cli-deploy-ssh-tunnel": "0.2.2",
"ember-cli-htmlbars": "^1.0.3",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-inject-live-reload": "^1.4.0",
Expand Down

0 comments on commit e411f42

Please sign in to comment.