From b5ae3f06998d9c4e0d53ace4ef2a912bd6d299a7 Mon Sep 17 00:00:00 2001 From: Manuel Schoebel Date: Mon, 23 Feb 2015 17:54:03 +0100 Subject: [PATCH 01/73] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 903ba0e..f85c64e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Meteor Up (mup for short) is a command line tool that allows you to deploy any [Meteor](http://meteor.com) app to your own server. It supports only Debian/Ubuntu flavours and Open Solaris at the moments. (PRs are welcome) -> Screencast: [How to deploy a Meteor app with Meteor Up (by Sacha Grief)](https://www.youtube.com/watch?v=WLGdXtZMmiI) +> Screencast: [How to deploy a Meteor app with Meteor Up (by Sacha Greif)](https://www.youtube.com/watch?v=WLGdXtZMmiI) **Table of Contents** From b2cd231ddeff4ad567bb5576a5b1dd1f626c3c26 Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 26 Feb 2015 14:27:20 -0600 Subject: [PATCH 02/73] Update README.md Added this to the readme Make sure you also add your ssh key to the ```/YOUR_USERNAME/.ssh/authorized_keys``` list --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f85c64e..a8e4708 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,8 @@ This will setup the server for the `mup` deployments. It will take around 2-5 mi Please ensure your key file (pem) is not protected by a passphrase. Also the setup process will require NOPASSWD access to sudo. (Since Meteor needs port 80, sudo access is required.) +Make sure you also add your ssh key to the ```/YOUR_USERNAME/.ssh/authorized_keys``` list + You can add your user to the sudo group: sudo adduser *username* sudo From 97c05a67923a1a493196c0b3d50f37ea9576be76 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sat, 7 Mar 2015 15:29:05 +0530 Subject: [PATCH 03/73] Improve binary module building logic --- templates/linux/deploy.sh | 41 ++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/templates/linux/deploy.sh b/templates/linux/deploy.sh index c1895b0..592cd2a 100644 --- a/templates/linux/deploy.sh +++ b/templates/linux/deploy.sh @@ -4,23 +4,46 @@ gyp_rebuild_inside_node_modules () { for npmModule in ./*; do cd $npmModule - if [ -f binding.gyp ]; then - echo "=> re-installing binary npm module '${npmModule:2}' of package '${package:2}'" - sudo node-gyp rebuild - fi + isBinaryModule="no" # recursively rebuild npm modules inside node_modules - if [ -d ./node_modules ]; then - cd ./node_modules - gyp_rebuild_inside_node_modules - cd ../ + check_for_binary_modules () { + if [ -f binding.gyp ]; then + isBinaryModule="yes" + fi + + if [ $isBinaryModule != "yes" ]; then + if [ -d ./node_modules ]; then + cd ./node_modules + for module in ./*; do + cd $module + check_for_binary_modules + cd .. + done + cd ../ + fi + fi + } + + check_for_binary_modules + + if [ $isBinaryModule == "yes" ]; then + echo " > $npmModule: npm install due to binary npm modules" + rm -rf node_modules + if [ -f binding.gyp ]; then + node-gyp rebuild || : + npm install + else + npm install + fi fi + cd .. done } rebuild_binary_npm_modules () { - for package in ./*; do + for package in ./*; do if [ -d $package/node_modules ]; then cd $package/node_modules gyp_rebuild_inside_node_modules From 0a867d08b7af41932b49b4b0a978a7a8ac615391 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Mon, 9 Mar 2015 11:18:20 +0530 Subject: [PATCH 04/73] 0.9.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c2dad27..2541b68 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.9.1", + "version": "0.9.2", "description": "Production Quality Meteor Deployments", "dependencies": { "nodemiral": "0.3.x", From b21d8a4de4a447b653bcbb1553794b9e90ab7a2b Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Wed, 11 Mar 2015 07:14:12 +0530 Subject: [PATCH 05/73] Verify SSL config --- lib/taskLists/linux.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/taskLists/linux.js b/lib/taskLists/linux.js index 5cea09b..c8f507f 100644 --- a/lib/taskLists/linux.js +++ b/lib/taskLists/linux.js @@ -262,6 +262,7 @@ function configureStud(taskList, pemFilePath, port) { dest: '/opt/stud/ssl.pem' }); + taskList.copy('Configuring Stud', { src: path.resolve(TEMPLATES_DIR, 'stud.conf'), dest: '/opt/stud/stud.conf', @@ -270,6 +271,10 @@ function configureStud(taskList, pemFilePath, port) { } }); + taskList.execute('Verifying SSL Configurations (ssl.pem)', { + command: 'stud --test --config=/opt/stud/stud.conf' + }); + //restart stud taskList.execute('Strating Stud', { command: '(sudo stop stud || :) && (sudo start stud || :)' From 9314502d1d26f311bd09be9dcb4b72a4115632e3 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Wed, 11 Mar 2015 07:14:21 +0530 Subject: [PATCH 06/73] 0.9.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2541b68..740a0fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.9.2", + "version": "0.9.3", "description": "Production Quality Meteor Deployments", "dependencies": { "nodemiral": "0.3.x", From 4ee3baac07d19d500ed973c83aa01e985b5c14d9 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Thu, 12 Mar 2015 17:46:51 +0530 Subject: [PATCH 07/73] Add missing sudo --- templates/linux/deploy.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/linux/deploy.sh b/templates/linux/deploy.sh index 592cd2a..96d8778 100644 --- a/templates/linux/deploy.sh +++ b/templates/linux/deploy.sh @@ -31,10 +31,10 @@ gyp_rebuild_inside_node_modules () { echo " > $npmModule: npm install due to binary npm modules" rm -rf node_modules if [ -f binding.gyp ]; then - node-gyp rebuild || : - npm install + sudo node-gyp rebuild || : + sudo npm install else - npm install + sudo npm install fi fi From 6d03d94f3e7dfb6544793002882861597f26f814 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Thu, 12 Mar 2015 17:47:17 +0530 Subject: [PATCH 08/73] 0.9.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 740a0fb..71ab21a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.9.3", + "version": "0.9.4", "description": "Production Quality Meteor Deployments", "dependencies": { "nodemiral": "0.3.x", From e78f61a5d69dddbaf40f982b23f56e91a795088f Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sun, 15 Mar 2015 15:58:08 +0530 Subject: [PATCH 09/73] Install npm modules before doing binary rebuild --- templates/linux/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/linux/deploy.sh b/templates/linux/deploy.sh index 96d8778..eaa7e9b 100644 --- a/templates/linux/deploy.sh +++ b/templates/linux/deploy.sh @@ -31,8 +31,8 @@ gyp_rebuild_inside_node_modules () { echo " > $npmModule: npm install due to binary npm modules" rm -rf node_modules if [ -f binding.gyp ]; then - sudo node-gyp rebuild || : sudo npm install + sudo node-gyp rebuild || : else sudo npm install fi From 087b2e8417b110d252394e25eb42004904323fbd Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sun, 15 Mar 2015 15:59:18 +0530 Subject: [PATCH 10/73] 0.9.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 71ab21a..7b15ce7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.9.4", + "version": "0.9.5", "description": "Production Quality Meteor Deployments", "dependencies": { "nodemiral": "0.3.x", From fcd3ae5fe051696cf6dc21cf9ca3088b77a70a06 Mon Sep 17 00:00:00 2001 From: FabienB4 Date: Tue, 17 Mar 2015 22:25:20 -0600 Subject: [PATCH 11/73] Bumped node version according to changes to Meteor 1.0.4 --- README.md | 2 +- example/mup.json | 4 ++-- scripts/linux/install-node.sh | 2 +- scripts/sunos/install-node.sh | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a8e4708..f93e3eb 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ This will create two files in your Meteor Up project directory: "setupNode": true, // WARNING: nodeVersion defaults to 0.10.33 if omitted. Do not use v, just the version number. - "nodeVersion": "0.10.33", + "nodeVersion": "0.10.36", // Install PhantomJS on the server "setupPhantom": true, diff --git a/example/mup.json b/example/mup.json index ba7deac..5a4327c 100644 --- a/example/mup.json +++ b/example/mup.json @@ -16,8 +16,8 @@ // WARNING: Node.js is required! Only skip if you already have Node.js installed on server. "setupNode": true, - // WARNING: If nodeVersion omitted will setup 0.10.33 by default. Do not use v, only version number. - "nodeVersion": "0.10.33", + // WARNING: If nodeVersion omitted will setup 0.10.36 by default. Do not use v, only version number. + "nodeVersion": "0.10.36", // Install PhantomJS in the server "setupPhantom": true, diff --git a/scripts/linux/install-node.sh b/scripts/linux/install-node.sh index 1b796ba..ba63ec4 100644 --- a/scripts/linux/install-node.sh +++ b/scripts/linux/install-node.sh @@ -14,7 +14,7 @@ sudo apt-get update <% if (nodeVersion) { %> NODE_VERSION=<%= nodeVersion %> <% } else {%> - NODE_VERSION=0.10.33 + NODE_VERSION=0.10.36 <% } %> ARCH=$(python -c 'import platform; print platform.architecture()[0]') diff --git a/scripts/sunos/install-node.sh b/scripts/sunos/install-node.sh index 3320694..1a615ff 100644 --- a/scripts/sunos/install-node.sh +++ b/scripts/sunos/install-node.sh @@ -4,7 +4,7 @@ <% if (nodeVersion) { %> NODE_VERSION=<%= nodeVersion %> <% } else {%> - NODE_VERSION=0.10.33 + NODE_VERSION=0.10.36 <% } %> ARCH=$(python -c 'import platform; print platform.architecture()[0]') From ed091515e0c8e905525342299511aaf3e7f0dcf9 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Wed, 18 Mar 2015 09:57:45 +0530 Subject: [PATCH 12/73] Change Readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f93e3eb..fc73d54 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ This will create two files in your Meteor Up project directory: // WARNING: Node.js is required! Only skip if you already have Node.js installed on server. "setupNode": true, - // WARNING: nodeVersion defaults to 0.10.33 if omitted. Do not use v, just the version number. + // WARNING: nodeVersion defaults to 0.10.36 if omitted. Do not use v, just the version number. "nodeVersion": "0.10.36", // Install PhantomJS on the server From bb1ec80026110d7aa24c32397aa20433a0cc23a4 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Wed, 18 Mar 2015 09:57:53 +0530 Subject: [PATCH 13/73] 0.9.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7b15ce7..92b5b6e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.9.5", + "version": "0.9.6", "description": "Production Quality Meteor Deployments", "dependencies": { "nodemiral": "0.3.x", From 76ffbd1dbb5038c57dc828b441cdca3e5623e52f Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Fri, 20 Mar 2015 16:00:05 +0530 Subject: [PATCH 14/73] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index fc73d54..8a47aaf 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ #### Production Quality Meteor Deployments +Note: Meteor Up does not support Windows yet! + Meteor Up (mup for short) is a command line tool that allows you to deploy any [Meteor](http://meteor.com) app to your own server. It supports only Debian/Ubuntu flavours and Open Solaris at the moments. (PRs are welcome) > Screencast: [How to deploy a Meteor app with Meteor Up (by Sacha Greif)](https://www.youtube.com/watch?v=WLGdXtZMmiI) From 58a35a94810a7eea3cdf9d04439b5f13b1a87785 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Fri, 20 Mar 2015 16:00:25 +0530 Subject: [PATCH 15/73] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a47aaf..aba9f16 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ #### Production Quality Meteor Deployments -Note: Meteor Up does not support Windows yet! +> **Note: Meteor Up does not support Windows yet!** Meteor Up (mup for short) is a command line tool that allows you to deploy any [Meteor](http://meteor.com) app to your own server. It supports only Debian/Ubuntu flavours and Open Solaris at the moments. (PRs are welcome) From fda1661c804ac7b894474352cce65d5d0a323ff2 Mon Sep 17 00:00:00 2001 From: Jonas Aschenbrenner Date: Mon, 23 Mar 2015 03:32:45 +0100 Subject: [PATCH 16/73] Exit with code 1 when deploy failed (fixes #324) --- lib/actions.js | 49 +++++++++++++++++++++++++++++++++++++++++-------- package.json | 7 ++++--- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/lib/actions.js b/lib/actions.js index 4bf4320..5c9c999 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -8,6 +8,7 @@ var uuid = require('uuid'); var format = require('util').format; var extend = require('util')._extend; var _ = require('underscore'); +var async = require('async'); require('colors'); module.exports = Actions; @@ -113,20 +114,37 @@ Actions.prototype.deploy = function() { if(err) { process.exit(1); } else { - for(var os in self.sessionsMap) { - var sessionsInfo = self.sessionsMap[os]; - sessionsInfo.sessions.forEach(function(session) { + var sessionsData = []; + _.forEach(self.sessionsMap, function (sessionsInfo) { + var taskListsBuilder = sessionsInfo.taskListsBuilder; + _.forEach(sessionsInfo.sessions, function (session) { + sessionsData.push({ + taskListsBuilder: taskListsBuilder, + session: session + }); + }); + }); + + async.mapSeries( + sessionsData, + function (sessionData, callback) { + var session = sessionData.session; + var taskListsBuilder = sessionData.taskListsBuilder var env = _.extend({}, self.config.env, session._serverConfig.env); - var taskList = sessionsInfo.taskListsBuilder.deploy( + var taskList = taskListsBuilder.deploy( bundlePath, env, deployCheckWaitTime, appName, setupNginx, ssl); - taskList.run(session, afterCompleted); - }); - } + taskList.run(session, function (summaryMap) { + afterCompleted(summaryMap); + callback(null, summaryMap); + }); + }, + exit + ) } }); - function afterCompleted(summeryMap) { + function afterCompleted(summaryMap) { rimraf.sync(buildLocation); } }; @@ -265,3 +283,18 @@ function storeLastNChars(vars, field, limit, color) { } } } + +function exit(error, summaryMaps) { + var errorCode = error || haveSummaryMapsErrors(summaryMaps) ? 1 : 0; + process.exit(errorCode); +} + +function haveSummaryMapsErrors(summaryMaps) { + return _.some(summaryMaps, hasSummaryMapErrors); +} + +function hasSummaryMapErrors(summaryMap) { + return _.some(summaryMap, function (summary) { + return summary.error; + }) +} diff --git a/package.json b/package.json index 92b5b6e..240f545 100644 --- a/package.json +++ b/package.json @@ -3,12 +3,13 @@ "version": "0.9.6", "description": "Production Quality Meteor Deployments", "dependencies": { - "nodemiral": "0.3.x", + "async": "^0.9.0", "cjson": "0.3.x", - "uuid": "1.4.x", "colors": "0.6.x", + "nodemiral": "0.3.x", "rimraf": "2.x.x", - "underscore": "1.7.0" + "underscore": "1.7.0", + "uuid": "1.4.x" }, "bin": { "mup": "./bin/mup" From de5a1ffd38e48ed15d36f0b812c9c0d4f6bd5d27 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Mon, 23 Mar 2015 13:21:05 +0530 Subject: [PATCH 17/73] Remove bundle at the end --- lib/actions.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/actions.js b/lib/actions.js index 5c9c999..a948849 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -135,18 +135,13 @@ Actions.prototype.deploy = function() { bundlePath, env, deployCheckWaitTime, appName, setupNginx, ssl); taskList.run(session, function (summaryMap) { - afterCompleted(summaryMap); callback(null, summaryMap); }); }, - exit + whenAfterCompleted(buildLocation) ) } }); - - function afterCompleted(summaryMap) { - rimraf.sync(buildLocation); - } }; Actions.prototype.reconfig = function() { @@ -284,9 +279,12 @@ function storeLastNChars(vars, field, limit, color) { } } -function exit(error, summaryMaps) { - var errorCode = error || haveSummaryMapsErrors(summaryMaps) ? 1 : 0; - process.exit(errorCode); +function whenAfterCompleted(buildLocation) { + return function(error, summaryMaps) { + rimraf.sync(buildLocation); + var errorCode = error || haveSummaryMapsErrors(summaryMaps) ? 1 : 0; + process.exit(errorCode); + }; } function haveSummaryMapsErrors(summaryMaps) { From 7d2a937c727ce80954299ad0ed8bb61b9a0b9e96 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Mon, 23 Mar 2015 13:21:26 +0530 Subject: [PATCH 18/73] 0.9.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 240f545..5208960 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.9.6", + "version": "0.9.7", "description": "Production Quality Meteor Deployments", "dependencies": { "async": "^0.9.0", From e5e8050f83dfaca22fa170ea801177b5838b984b Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Thu, 23 Apr 2015 23:46:50 +0530 Subject: [PATCH 19/73] Build meteor app with JS --- lib/actions.js | 38 ++------------------------------------ lib/build.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 3 ++- 3 files changed, 53 insertions(+), 37 deletions(-) create mode 100644 lib/build.js diff --git a/lib/actions.js b/lib/actions.js index a948849..d38ad7b 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -9,6 +9,7 @@ var format = require('util').format; var extend = require('util')._extend; var _ = require('underscore'); var async = require('async'); +var buildApp = require('./build.js'); require('colors'); module.exports = Actions; @@ -103,14 +104,13 @@ Actions.prototype.deploy = function() { // so we can simply set them like this process.env.BUILD_LOCATION = buildLocation; - var buildScript = path.resolve(__dirname, 'build.sh'); var deployCheckWaitTime = this.config.deployCheckWaitTime; var appName = this.config.appName; var setupNginx = this.config.setupNginx || false; var ssl = this.config.ssl || false; console.log('Building Started: ' + this.config.app); - buildApp(buildScript, options, function(err) { + buildApp(buildLocation, function(err) { if(err) { process.exit(1); } else { @@ -236,40 +236,6 @@ Actions.init = function() { } }; - -function buildApp(buildScript, options, callback) { - var vars = { - stdout: "", - stderr: "", - error: "" - }; - - var bash = spawn("bash", [buildScript], options); - bash.stdout.on('data', storeLastNChars(vars, "stdout", 1000)); - bash.stderr.on('data', storeLastNChars(vars, "stderr", 1000)); - bash.on('error', function(err) { - vars.error = err.message; - }); - bash.on('close', function(code) { - //clear callback - bash.stdout.removeAllListeners('data'); - bash.stderr.removeAllListeners('data'); - bash.removeAllListeners('error'); - bash.removeAllListeners('close'); - - if(code != 0) { - console.error(format('Bundling Error: code=%s, error:%s', code, vars.error)); - console.error('-------------------STDOUT-------------------'.bold); - console.error(vars.stdout); - console.error('-------------------STDERR-------------------'.bold.red); - console.error(vars.stderr.red); - callback({message: vars.error}); - } else { - callback(null); - } - }); -} - function storeLastNChars(vars, field, limit, color) { return function(data) { vars[field] += data.toString(); diff --git a/lib/build.js b/lib/build.js new file mode 100644 index 0000000..3bc3c32 --- /dev/null +++ b/lib/build.js @@ -0,0 +1,49 @@ +var spawn = require('child_process').spawn; +var archiver = require('archiver'); +var fs = require('fs'); +var pathResolve = require('path').resolve; +var _ = require('underscore'); + +function buildApp(buildLocaltion, callback) { + var meteor = spawn("meteor", ["build", "--directory", buildLocaltion]); + var stdout = ""; + var stderr = ""; + + meteor.stdout.pipe(process.stdout, {end: false}); + meteor.stderr.pipe(process.stderr, {end: false}); + + meteor.on('close', function(code) { + if(code == 0) { + archiveIt(buildLocaltion, callback); + } else { + console.log("\n=> Build Error"); + callback(new Error("build-error")); + } + }); +} + +function archiveIt(buildLocaltion, callback) { + callback = _.once(callback); + var bundlePath = pathResolve(buildLocaltion, 'bundle.tar.gz'); + var sourceDir = pathResolve(buildLocaltion, 'bundle'); + + var output = fs.createWriteStream(bundlePath); + var archive = archiver('tar', { + gzip: true, + gzipOptions: { + level: 1 + } + }); + + archive.pipe(output); + output.once('close', callback); + + archive.once('error', function(err) { + console.log("=> Archiving failed:", err.message); + callback(err); + }); + + archive.directory(sourceDir, 'bundle').finalize(); +} + +module.exports = buildApp; \ No newline at end of file diff --git a/package.json b/package.json index 5208960..279dd5c 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "nodemiral": "0.3.x", "rimraf": "2.x.x", "underscore": "1.7.0", - "uuid": "1.4.x" + "uuid": "1.4.x", + "archiver": "0.14.x" }, "bin": { "mup": "./bin/mup" From 62b1af67177ddfdbbb14e88d844b6f5d6c8512e3 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Fri, 24 Apr 2015 00:17:10 +0530 Subject: [PATCH 20/73] Use ssh2 branch of nodemiral --- lib/build.js | 40 ++++++++++++++++++++++++++++++++++------ package.json | 2 +- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/lib/build.js b/lib/build.js index 3bc3c32..3451449 100644 --- a/lib/build.js +++ b/lib/build.js @@ -5,14 +5,20 @@ var pathResolve = require('path').resolve; var _ = require('underscore'); function buildApp(buildLocaltion, callback) { - var meteor = spawn("meteor", ["build", "--directory", buildLocaltion]); - var stdout = ""; - var stderr = ""; + //// check for cordova app and restore them with firefoxos + // var platformsFilePath = pathResolve('.meteor', 'platforms'); + // var platformsFileContent = fs.readFileSync(platformsFilePath); + // if(/(ios|android|firefoxos)/.test(platformsFileContent)) { + // fs.writeFileSync(platformsFilePath, "server\r\nbrowser\r\nfirefoxos\r\n"); + // } - meteor.stdout.pipe(process.stdout, {end: false}); - meteor.stderr.pipe(process.stderr, {end: false}); + // restore platforms file + var restorePlatformsFile = _.once(function() { + // fs.writeFileSync(platformsFilePath, platformsFileContent); + }); - meteor.on('close', function(code) { + buildMeteorApp(buildLocaltion, function(code) { + restorePlatformsFile(); if(code == 0) { archiveIt(buildLocaltion, callback); } else { @@ -20,6 +26,28 @@ function buildApp(buildLocaltion, callback) { callback(new Error("build-error")); } }); + + // make sure to restore platforms file + ['exit', 'SIGINT'].forEach(function(fn) { + process.once(fn, function() { + restorePlatformsFile(); + }); + }); +} + +function buildMeteorApp(buildLocaltion, callback) { + var args = [ + "build", "--directory", buildLocaltion, + "--server", "http://localhost:3000" + ]; + var meteor = spawn("meteor", args); + var stdout = ""; + var stderr = ""; + + meteor.stdout.pipe(process.stdout, {end: false}); + meteor.stderr.pipe(process.stderr, {end: false}); + + meteor.on('close', callback); } function archiveIt(buildLocaltion, callback) { diff --git a/package.json b/package.json index 279dd5c..7c4ffdd 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "async": "^0.9.0", "cjson": "0.3.x", "colors": "0.6.x", - "nodemiral": "0.3.x", + "nodemiral": "arunoda/nodemiral#ssh2", "rimraf": "2.x.x", "underscore": "1.7.0", "uuid": "1.4.x", From 4dfca58247ca4b8e547dc5e308e490425d507e95 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Fri, 24 Apr 2015 01:23:39 +0530 Subject: [PATCH 21/73] Support building on Windows --- lib/build.js | 24 ++++++++++++++++-------- templates/linux/deploy.sh | 1 + 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/build.js b/lib/build.js index 3451449..1d07ffa 100644 --- a/lib/build.js +++ b/lib/build.js @@ -5,16 +5,16 @@ var pathResolve = require('path').resolve; var _ = require('underscore'); function buildApp(buildLocaltion, callback) { - //// check for cordova app and restore them with firefoxos - // var platformsFilePath = pathResolve('.meteor', 'platforms'); - // var platformsFileContent = fs.readFileSync(platformsFilePath); - // if(/(ios|android|firefoxos)/.test(platformsFileContent)) { - // fs.writeFileSync(platformsFilePath, "server\r\nbrowser\r\nfirefoxos\r\n"); - // } + // check for cordova app and restore them with firefoxos + var platformsFilePath = pathResolve('.meteor', 'platforms'); + var platformsFileContent = fs.readFileSync(platformsFilePath); + if(/(ios|android|firefoxos)/.test(platformsFileContent)) { + fs.writeFileSync(platformsFilePath, "server\r\nbrowser\r\nfirefoxos\r\n"); + } // restore platforms file var restorePlatformsFile = _.once(function() { - // fs.writeFileSync(platformsFilePath, platformsFileContent); + fs.writeFileSync(platformsFilePath, platformsFileContent); }); buildMeteorApp(buildLocaltion, function(code) { @@ -36,11 +36,19 @@ function buildApp(buildLocaltion, callback) { } function buildMeteorApp(buildLocaltion, callback) { + var executabe = "meteor"; var args = [ "build", "--directory", buildLocaltion, "--server", "http://localhost:3000" ]; - var meteor = spawn("meteor", args); + + var isWin = /^win/.test(process.platform); + if(isWin) { + executabe = "cmd.exe"; + args = ["/c", "meteor"].concat(args); + } + + var meteor = spawn(executabe, args); var stdout = ""; var stderr = ""; diff --git a/templates/linux/deploy.sh b/templates/linux/deploy.sh index eaa7e9b..5cb6f6f 100644 --- a/templates/linux/deploy.sh +++ b/templates/linux/deploy.sh @@ -81,6 +81,7 @@ BUNDLE_DIR=${TMP_DIR}/bundle cd ${TMP_DIR} sudo rm -rf bundle sudo tar xvzf bundle.tar.gz > /dev/null +sudo chmod -R +x * sudo chown -R ${USER} ${BUNDLE_DIR} # rebuilding fibers From 1e196bc6fe5e6e0a25e68f4c9abce85bef6f2b89 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Fri, 24 Apr 2015 11:45:40 +0530 Subject: [PATCH 22/73] Use apppath to build the app --- lib/actions.js | 6 ++---- lib/build.js | 13 +++++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/actions.js b/lib/actions.js index d38ad7b..c01b4db 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -97,9 +97,6 @@ Actions.prototype.deploy = function() { var buildLocation = path.resolve('/tmp', uuid.v4()); var bundlePath = path.resolve(buildLocation, 'bundle.tar.gz'); - var options = { - cwd: this.config.app, - }; // spawn inherits env vars from process.env // so we can simply set them like this process.env.BUILD_LOCATION = buildLocation; @@ -108,9 +105,10 @@ Actions.prototype.deploy = function() { var appName = this.config.appName; var setupNginx = this.config.setupNginx || false; var ssl = this.config.ssl || false; + var appPath = this.config.app; console.log('Building Started: ' + this.config.app); - buildApp(buildLocation, function(err) { + buildApp(appPath, buildLocation, function(err) { if(err) { process.exit(1); } else { diff --git a/lib/build.js b/lib/build.js index 1d07ffa..be20d0b 100644 --- a/lib/build.js +++ b/lib/build.js @@ -4,9 +4,9 @@ var fs = require('fs'); var pathResolve = require('path').resolve; var _ = require('underscore'); -function buildApp(buildLocaltion, callback) { +function buildApp(appPath, buildLocaltion, callback) { // check for cordova app and restore them with firefoxos - var platformsFilePath = pathResolve('.meteor', 'platforms'); + var platformsFilePath = pathResolve(appPath, '.meteor', 'platforms'); var platformsFileContent = fs.readFileSync(platformsFilePath); if(/(ios|android|firefoxos)/.test(platformsFileContent)) { fs.writeFileSync(platformsFilePath, "server\r\nbrowser\r\nfirefoxos\r\n"); @@ -17,7 +17,7 @@ function buildApp(buildLocaltion, callback) { fs.writeFileSync(platformsFilePath, platformsFileContent); }); - buildMeteorApp(buildLocaltion, function(code) { + buildMeteorApp(appPath, buildLocaltion, function(code) { restorePlatformsFile(); if(code == 0) { archiveIt(buildLocaltion, callback); @@ -35,7 +35,7 @@ function buildApp(buildLocaltion, callback) { }); } -function buildMeteorApp(buildLocaltion, callback) { +function buildMeteorApp(appPath, buildLocaltion, callback) { var executabe = "meteor"; var args = [ "build", "--directory", buildLocaltion, @@ -48,7 +48,8 @@ function buildMeteorApp(buildLocaltion, callback) { args = ["/c", "meteor"].concat(args); } - var meteor = spawn(executabe, args); + var options = {cwd: appPath}; + var meteor = spawn(executabe, args, options); var stdout = ""; var stderr = ""; @@ -67,7 +68,7 @@ function archiveIt(buildLocaltion, callback) { var archive = archiver('tar', { gzip: true, gzipOptions: { - level: 1 + level: 6 } }); From 0cf7e25d1f1e96d3b89c5e214e4119fb8932c9db Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Fri, 24 Apr 2015 13:47:09 +0530 Subject: [PATCH 23/73] Use nodemiral keepAlive for ssh session caching --- lib/actions.js | 87 ++++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 39 deletions(-) diff --git a/lib/actions.js b/lib/actions.js index c01b4db..532b17a 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -28,9 +28,6 @@ function Actions(config, cwd) { Actions.prototype._createSessionsMap = function(config) { var sessionsMap = {}; - var options = { - ssh: {'StrictHostKeyChecking': 'no', 'UserKnownHostsFile': '/dev/null'} - }; config.servers.forEach(function(server) { var host = server.host; @@ -42,11 +39,10 @@ Actions.prototype._createSessionsMap = function(config) { auth.password = server.password; } - if(server.sshOptions) { - for(var key in server.sshOptions) { - options.ssh[key] = server.sshOptions[key]; - } - } + var nodemiralOptions = { + ssh: server.sshOptions, + keepAlive: true + }; if(!sessionsMap[server.os]) { sessionsMap[server.os] = { @@ -55,7 +51,7 @@ Actions.prototype._createSessionsMap = function(config) { }; } - var session = nodemiral.session(host, auth, options); + var session = nodemiral.session(host, auth, nodemiralOptions); session._serverConfig = server; sessionsMap[server.os].sessions.push(session); }); @@ -79,15 +75,25 @@ Actions.prototype._showKadiraLink = function() { } } -Actions.prototype.setup = function() { +Actions.prototype._executePararell = function(actionName, args) { var self = this; - self._showKadiraLink(); + var sessionInfoList = _.values(self.sessionsMap); + async.map( + sessionInfoList, + function(sessionsInfo, callback) { + var taskList = sessionsInfo.taskListsBuilder[actionName] + .apply(sessionsInfo.taskListsBuilder, args); + taskList.run(sessionsInfo.sessions, function(summaryMap) { + callback(null, summaryMap); + }); + }, + whenAfterCompleted + ); +}; - for(var os in self.sessionsMap) { - var sessionsInfo = self.sessionsMap[os]; - var taskList = sessionsInfo.taskListsBuilder.setup(self.config); - taskList.run(sessionsInfo.sessions); - } +Actions.prototype.setup = function() { + this._showKadiraLink(); + this._executePararell("setup", [this.config]); }; Actions.prototype.deploy = function() { @@ -136,7 +142,7 @@ Actions.prototype.deploy = function() { callback(null, summaryMap); }); }, - whenAfterCompleted(buildLocation) + whenAfterDeployed(buildLocation) ) } }); @@ -144,42 +150,41 @@ Actions.prototype.deploy = function() { Actions.prototype.reconfig = function() { var self = this; + var sessionInfoList = []; for(var os in self.sessionsMap) { var sessionsInfo = self.sessionsMap[os]; sessionsInfo.sessions.forEach(function(session) { var env = _.extend({}, self.config.env, session._serverConfig.env); var taskList = sessionsInfo.taskListsBuilder.reconfig( env, self.config.appName, self.config.setupNginx); - taskList.run(session); + sessionInfoList.push({ + taskList: taskList, + session: session + }); }); } + + async.mapSeries( + sessionsInfoList, + function(sessionsInfo, callback) { + sessionsInfo.taskList.run(taskList.session, function(summaryMap) { + callback(null, summaryMap); + }); + }, + whenAfterCompleted + ); }; Actions.prototype.restart = function() { - var self = this; - for(var os in self.sessionsMap) { - var sessionsInfo = self.sessionsMap[os]; - var taskList = sessionsInfo.taskListsBuilder.restart(self.config.appName); - taskList.run(sessionsInfo.sessions); - } + this._executePararell("restart", [this.config.appName]); }; Actions.prototype.stop = function() { - var self = this; - for(var os in self.sessionsMap) { - var sessionsInfo = self.sessionsMap[os]; - var taskList = sessionsInfo.taskListsBuilder.stop(self.config.appName); - taskList.run(sessionsInfo.sessions); - } + this._executePararell("stop", [this.config.appName]); }; Actions.prototype.start = function() { - var self = this; - for(var os in self.sessionsMap) { - var sessionsInfo = self.sessionsMap[os]; - var taskList = sessionsInfo.taskListsBuilder.start(self.config.appName); - taskList.run(sessionsInfo.sessions); - } + this._executePararell("start", [this.config.appName]); }; Actions.prototype.logs = function() { @@ -243,14 +248,18 @@ function storeLastNChars(vars, field, limit, color) { } } -function whenAfterCompleted(buildLocation) { +function whenAfterDeployed(buildLocation) { return function(error, summaryMaps) { rimraf.sync(buildLocation); - var errorCode = error || haveSummaryMapsErrors(summaryMaps) ? 1 : 0; - process.exit(errorCode); + whenAfterCompleted(error, summaryMaps); }; } +function whenAfterCompleted(error, summaryMaps) { + var errorCode = error || haveSummaryMapsErrors(summaryMaps) ? 1 : 0; + process.exit(errorCode); +} + function haveSummaryMapsErrors(summaryMaps) { return _.some(summaryMaps, hasSummaryMapErrors); } From 2cae3dfb74ba29528fe5c264430b06ab95e05141 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Fri, 24 Apr 2015 18:40:18 +0530 Subject: [PATCH 24/73] Add progress bar --- lib/taskLists/linux.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/taskLists/linux.js b/lib/taskLists/linux.js index c8f507f..b7fb02f 100644 --- a/lib/taskLists/linux.js +++ b/lib/taskLists/linux.js @@ -137,7 +137,8 @@ exports.deploy = function(bundlePath, env, deployCheckWaitTime, appName, setupNg taskList.copy('Uploading bundle', { src: bundlePath, - dest: '/opt/' + appName + '/tmp/bundle.tar.gz' + dest: '/opt/' + appName + '/tmp/bundle.tar.gz', + progressBar: true }); taskList.copy('Setting up Environment Variables', { From d24309eb3016748531812891b7d19bbeaf645d33 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sat, 25 Apr 2015 07:43:00 +0530 Subject: [PATCH 25/73] use nodemiral 1.x --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7c4ffdd..0a1f604 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "async": "^0.9.0", "cjson": "0.3.x", "colors": "0.6.x", - "nodemiral": "arunoda/nodemiral#ssh2", + "nodemiral": "1.x.x", "rimraf": "2.x.x", "underscore": "1.7.0", "uuid": "1.4.x", From f91b67d2a1c513b558de260d01418d2bda76c92f Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sat, 25 Apr 2015 07:55:48 +0530 Subject: [PATCH 26/73] 0.10.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0a1f604..4017eca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.9.7", + "version": "0.10.0", "description": "Production Quality Meteor Deployments", "dependencies": { "async": "^0.9.0", From 238012b654dbf194c536cf9ce00eb5e25a31c9d8 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sat, 25 Apr 2015 08:04:26 +0530 Subject: [PATCH 27/73] Update README --- README.md | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index aba9f16..0e5ef04 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ #### Production Quality Meteor Deployments -> **Note: Meteor Up does not support Windows yet!** - Meteor Up (mup for short) is a command line tool that allows you to deploy any [Meteor](http://meteor.com) app to your own server. It supports only Debian/Ubuntu flavours and Open Solaris at the moments. (PRs are welcome) +You can use install and use Meteor Up from Linux, Mac and Windows. + > Screencast: [How to deploy a Meteor app with Meteor Up (by Sacha Greif)](https://www.youtube.com/watch?v=WLGdXtZMmiI) **Table of Contents** @@ -17,8 +17,9 @@ Meteor Up (mup for short) is a command line tool that allows you to deploy any [ - [Creating a Meteor Up Project](#creating-a-meteor-up-project) - [Example File](#example-file) - [Setting Up a Server](#setting-up-a-server) - - [Server Setup Details](#server-setup-details) - [Deploying an App](#deploying-an-app) +- [Additional Setup/Deploy Information](#additional-setupdeploy-information) + - [Server Setup Details](#server-setup-details) - [Deploy Wait Time](#deploy-wait-time) - [Multiple Deployment Targets](#multiple-deployment-targets) - [Access Logs](#access-logs) @@ -65,8 +66,6 @@ Meteor Up (mup for short) is a command line tool that allows you to deploy any [ npm install -g mup -If you are looking for password-based authentication, you need to [install sshpass](https://gist.github.com/arunoda/7790979) on your local development machine. - ### Creating a Meteor Up Project mkdir ~/my-meteor-deployment @@ -146,7 +145,21 @@ This will create two files in your Meteor Up project directory: This will setup the server for the `mup` deployments. It will take around 2-5 minutes depending on the server's performance and network availability. -#### Ssh based authentication +### Deploying an App + + mup deploy + +This will bundle the Meteor project and deploy it to the server. + +### Additional Setup/Deploy Information + +#### Deploy Wait Time + +Meteor Up checks if the deployment is successful or not just after the deployment. By default, it will wait 10 seconds before the check. You can configure the wait time with the `deployCheckWaitTime` option in the `mup.json` + +#### Ssh based authentication with `sudo` + +**If your username is `root`, you don't need to follow these steps** Please ensure your key file (pem) is not protected by a passphrase. Also the setup process will require NOPASSWD access to sudo. (Since Meteor needs port 80, sudo access is required.) @@ -183,16 +196,6 @@ This is how Meteor Up will configure the server for you based on the given `appN For more information see [`lib/taskLists.js`](https://github.com/arunoda/meteor-up/blob/master/lib/taskLists.js). -### Deploying an App - - mup deploy - -This will bundle the Meteor project and deploy it to the server. - -#### Deploy Wait Time - -Meteor Up checks if the deployment is successful or not just after the deployment. By default, it will wait 10 seconds before the check. You can configure the wait time with the `deployCheckWaitTime` option in the `mup.json`. - #### Multiple Deployment Targets You can use an array to deploy to multiple servers at once. From fc1d24b4771d3d1d9623335e47af9162c5ba211c Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sat, 25 Apr 2015 18:53:46 +0530 Subject: [PATCH 28/73] Remove platform change logic. Now we don't change the Meteor's platform code We did it before to allow to deploy app without installing the platform. Specially on CI boxes. Now, it has raised issues and we think, it needs to be handled in somewhere else. Not by mup. --- lib/build.js | 22 +--------------------- lib/build.sh | 43 ------------------------------------------- 2 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 lib/build.sh diff --git a/lib/build.js b/lib/build.js index be20d0b..d924c80 100644 --- a/lib/build.js +++ b/lib/build.js @@ -5,34 +5,14 @@ var pathResolve = require('path').resolve; var _ = require('underscore'); function buildApp(appPath, buildLocaltion, callback) { - // check for cordova app and restore them with firefoxos - var platformsFilePath = pathResolve(appPath, '.meteor', 'platforms'); - var platformsFileContent = fs.readFileSync(platformsFilePath); - if(/(ios|android|firefoxos)/.test(platformsFileContent)) { - fs.writeFileSync(platformsFilePath, "server\r\nbrowser\r\nfirefoxos\r\n"); - } - - // restore platforms file - var restorePlatformsFile = _.once(function() { - fs.writeFileSync(platformsFilePath, platformsFileContent); - }); - buildMeteorApp(appPath, buildLocaltion, function(code) { - restorePlatformsFile(); if(code == 0) { archiveIt(buildLocaltion, callback); } else { - console.log("\n=> Build Error"); + console.log("\n=> Build Error. Check the logs printed above."); callback(new Error("build-error")); } }); - - // make sure to restore platforms file - ['exit', 'SIGINT'].forEach(function(fn) { - process.once(fn, function() { - restorePlatformsFile(); - }); - }); } function buildMeteorApp(appPath, buildLocaltion, callback) { diff --git a/lib/build.sh b/lib/build.sh deleted file mode 100644 index 563c8b3..0000000 --- a/lib/build.sh +++ /dev/null @@ -1,43 +0,0 @@ -CURR_DIR=$(pwd) - -setTemporaryPlatforms() { - cp ./.meteor/platforms ./.meteor/platforms-copy - echo server$'\n'browser$'\n'firefoxos > ./.meteor/platforms -} - -setOriginalPlatforms() { - cd $CURR_DIR - mv ./.meteor/platforms-copy ./.meteor/platforms -} - -buildMeteorApp() { - meteor build --directory $BUILD_LOCATION -} - -buildMeteorAppForCordova() { - # when building for cordova, we are using firefoxos - # and it does not need ios and android deps to build web.cordova - # so it's possible to build for the server bundle inside a build box as well - - setTemporaryPlatforms - trap setOriginalPlatforms EXIT - # we need to give it a dummy --server values to start building - meteor build --directory $BUILD_LOCATION --server "http://localhost:3000" -} - -if [ -f ./.meteor/platforms ]; then - # build for 0.9.4+ - # remove mobile platforms while building - have_cordova=$(cat ./.meteor/platforms | grep 'ios\|android\|firefoxos') - if [ "$have_cordova" ]; then - buildMeteorAppForCordova - else - buildMeteorApp - fi -else - # build for 0.9.3 - buildMeteorApp -fi - -cd $BUILD_LOCATION -tar czf bundle.tar.gz bundle \ No newline at end of file From 2cfef59fe217fba6a20755b55f613a129dd625b0 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sat, 25 Apr 2015 18:54:04 +0530 Subject: [PATCH 29/73] 0.10.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4017eca..0a9b20c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.10.0", + "version": "0.10.1", "description": "Production Quality Meteor Deployments", "dependencies": { "async": "^0.9.0", From f33f877870c79ae8c30462f51835804d43df6b3b Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sun, 26 Apr 2015 14:23:12 +0530 Subject: [PATCH 30/73] Remove ssh-pass lookup --- bin/mup | 16 +--------------- lib/config.js | 3 --- lib/helpers.js | 10 ---------- 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/bin/mup b/bin/mup index be0d346..7136c21 100755 --- a/bin/mup +++ b/bin/mup @@ -18,21 +18,7 @@ if(action == 'init') { var cwd = path.resolve('.'); //read config and validate it var config = Config.read(); - - if(config._passwordExists) { - //check for sshpass - helpers.checkSshPassExists(function(exists) { - if(exists) { - runActions(config, cwd); - } else { - var errorMessage = "sshpass required for password based authentication: refer http://git.io/_vHbvQ"; - console.error(errorMessage.bold.red); - process.exit(1); - } - }); - } else { - runActions(config, cwd); - } + runActions(config, cwd); } diff --git a/lib/config.js b/lib/config.js index bcb5ca8..db2ba99 100644 --- a/lib/config.js +++ b/lib/config.js @@ -55,9 +55,6 @@ exports.read = function() { if(server.pem) { server.pem = rewriteHome(server.pem); - } else { - //hint mup bin script to check whether sshpass installed or not - mupJson._passwordExists = true; } server.env = server.env || {}; diff --git a/lib/helpers.js b/lib/helpers.js index 6a01242..7c501a3 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -1,15 +1,5 @@ var exec = require('child_process').exec; -exports.checkSshPassExists = function(callback) { - exec('sshpass -V', function(err, stdout, stderr) { - if(err) { - callback(false); - } else { - callback(true); - } - }); -}; - exports.printHelp = function() { console.error('\nValid Actions'); console.error('-------------'); From 06b0eeb40e41073d064fb391bf4028d35c87dd11 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sun, 26 Apr 2015 14:23:22 +0530 Subject: [PATCH 31/73] 0.10.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0a9b20c..4b7bb41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.10.1", + "version": "0.10.2", "description": "Production Quality Meteor Deployments", "dependencies": { "async": "^0.9.0", From 3f8b07ccd38667199a00727cf3bb096d309c618a Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sun, 26 Apr 2015 22:12:15 +0530 Subject: [PATCH 32/73] Use full path of cmd.exe if available --- lib/build.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/build.js b/lib/build.js index d924c80..f7b3b5d 100644 --- a/lib/build.js +++ b/lib/build.js @@ -24,7 +24,9 @@ function buildMeteorApp(appPath, buildLocaltion, callback) { var isWin = /^win/.test(process.platform); if(isWin) { - executabe = "cmd.exe"; + // Sometimes cmd.exe not available in the path + // See: http://goo.gl/ADmzoD + executabe = process.env.comspec || "cmd.exe"; args = ["/c", "meteor"].concat(args); } From 58318e9f2f3dcd00474cc3fe0cf95a079105551d Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sun, 26 Apr 2015 22:12:25 +0530 Subject: [PATCH 33/73] 0.10.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4b7bb41..62ad88e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.10.2", + "version": "0.10.3", "description": "Production Quality Meteor Deployments", "dependencies": { "async": "^0.9.0", From f31f4ca1b15f5f6bab186408848f803b17740104 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Mon, 27 Apr 2015 06:41:35 +0530 Subject: [PATCH 34/73] Fix typo errors and support HOME rewrite in windows --- lib/actions.js | 6 +++--- lib/build.js | 6 +++--- lib/config.js | 6 +++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/actions.js b/lib/actions.js index 532b17a..130a925 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -165,9 +165,9 @@ Actions.prototype.reconfig = function() { } async.mapSeries( - sessionsInfoList, - function(sessionsInfo, callback) { - sessionsInfo.taskList.run(taskList.session, function(summaryMap) { + sessionInfoList, + function(sessionInfo, callback) { + sessionInfo.taskList.run(sessionInfo.session, function(summaryMap) { callback(null, summaryMap); }); }, diff --git a/lib/build.js b/lib/build.js index f7b3b5d..d5ba763 100644 --- a/lib/build.js +++ b/lib/build.js @@ -16,7 +16,7 @@ function buildApp(appPath, buildLocaltion, callback) { } function buildMeteorApp(appPath, buildLocaltion, callback) { - var executabe = "meteor"; + var executable = "meteor"; var args = [ "build", "--directory", buildLocaltion, "--server", "http://localhost:3000" @@ -26,12 +26,12 @@ function buildMeteorApp(appPath, buildLocaltion, callback) { if(isWin) { // Sometimes cmd.exe not available in the path // See: http://goo.gl/ADmzoD - executabe = process.env.comspec || "cmd.exe"; + executable = process.env.comspec || "cmd.exe"; args = ["/c", "meteor"].concat(args); } var options = {cwd: appPath}; - var meteor = spawn(executabe, args, options); + var meteor = spawn(executable, args, options); var stdout = ""; var stderr = ""; diff --git a/lib/config.js b/lib/config.js index db2ba99..c6efd99 100644 --- a/lib/config.js +++ b/lib/config.js @@ -98,7 +98,11 @@ exports.read = function() { }; function rewriteHome(location) { - return location.replace('~', process.env.HOME); + if(/win/.test(process.platform)) { + return location.replace('~', process.env.USERPROFILE); + } else { + return location.replace('~', process.env.HOME); + } } function mupErrorLog(message) { From cf378cddd829d080d8f995d8691998c6643f820f Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Mon, 27 Apr 2015 06:44:18 +0530 Subject: [PATCH 35/73] 0.10.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 62ad88e..df54d22 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.10.3", + "version": "0.10.4", "description": "Production Quality Meteor Deployments", "dependencies": { "async": "^0.9.0", From 25fde94de31bdf7882c81eae41e86f45daef67bd Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Mon, 27 Apr 2015 09:36:28 +0530 Subject: [PATCH 36/73] fix a rewriteHome bug where it does not idenitfy dawin and windows --- lib/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/config.js b/lib/config.js index c6efd99..d02e7de 100644 --- a/lib/config.js +++ b/lib/config.js @@ -98,7 +98,7 @@ exports.read = function() { }; function rewriteHome(location) { - if(/win/.test(process.platform)) { + if(/^win/.test(process.platform)) { return location.replace('~', process.env.USERPROFILE); } else { return location.replace('~', process.env.HOME); From d80d0f91a79759d620033fb411d8ac58182913d8 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Mon, 27 Apr 2015 09:36:37 +0530 Subject: [PATCH 37/73] 0.10.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index df54d22..4de52ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.10.4", + "version": "0.10.5", "description": "Production Quality Meteor Deployments", "dependencies": { "async": "^0.9.0", From 762a64f9c151d51c6b06a3da503a2d7b17cf2f46 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Thu, 30 Apr 2015 04:14:49 +0530 Subject: [PATCH 38/73] Use nodemiral version 1.0.1 and up --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4de52ae..2c1e748 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "async": "^0.9.0", "cjson": "0.3.x", "colors": "0.6.x", - "nodemiral": "1.x.x", + "nodemiral": "^1.0.1", "rimraf": "2.x.x", "underscore": "1.7.0", "uuid": "1.4.x", From b9021a19143ca35a435c73afbc406d98cf5c01b7 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Thu, 30 Apr 2015 04:15:00 +0530 Subject: [PATCH 39/73] 0.10.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2c1e748..5d95575 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.10.5", + "version": "0.10.6", "description": "Production Quality Meteor Deployments", "dependencies": { "async": "^0.9.0", From 64542f08af18d8dc9a71fd06490b8c0301f21ba7 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Fri, 1 May 2015 11:10:16 +0530 Subject: [PATCH 40/73] Change sshOption port field name --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e5ef04..231c876 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ This will create two files in your Meteor Up project directory: // WARNING: Keys protected by a passphrase are not supported //"pem": "~/.ssh/id_rsa" // Also, for non-standard ssh port use this - //"sshOptions": { "Port" : 49154 }, + //"sshOptions": { "port" : 49154 }, // server specific environment variables "env": {} } From 37e75c1e569608fe428cdfff35f27c76ac9c1313 Mon Sep 17 00:00:00 2001 From: Samuel Bolduc Date: Mon, 4 May 2015 16:19:23 -0400 Subject: [PATCH 41/73] Changed progressbars to false --- lib/taskLists/linux.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/taskLists/linux.js b/lib/taskLists/linux.js index b7fb02f..8657dd4 100644 --- a/lib/taskLists/linux.js +++ b/lib/taskLists/linux.js @@ -138,7 +138,7 @@ exports.deploy = function(bundlePath, env, deployCheckWaitTime, appName, setupNg taskList.copy('Uploading bundle', { src: bundlePath, dest: '/opt/' + appName + '/tmp/bundle.tar.gz', - progressBar: true + progressBar: false }); taskList.copy('Setting up Environment Variables', { From 702ccfd1fbbc533f1559b7a330d136ff5744c480 Mon Sep 17 00:00:00 2001 From: Samuel Bolduc Date: Mon, 4 May 2015 16:46:37 -0400 Subject: [PATCH 42/73] Added uploadProgressBar option --- lib/actions.js | 13 +++++++------ lib/config.js | 3 +++ lib/taskLists/linux.js | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/actions.js b/lib/actions.js index 130a925..f952cbb 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -73,7 +73,7 @@ Actions.prototype._showKadiraLink = function() { ); } } -} +}; Actions.prototype._executePararell = function(actionName, args) { var self = this; @@ -112,6 +112,7 @@ Actions.prototype.deploy = function() { var setupNginx = this.config.setupNginx || false; var ssl = this.config.ssl || false; var appPath = this.config.app; + var uploadProgressBar = this.config.uploadProgressBar; console.log('Building Started: ' + this.config.app); buildApp(appPath, buildLocation, function(err) { @@ -133,17 +134,17 @@ Actions.prototype.deploy = function() { sessionsData, function (sessionData, callback) { var session = sessionData.session; - var taskListsBuilder = sessionData.taskListsBuilder + var taskListsBuilder = sessionData.taskListsBuilder; var env = _.extend({}, self.config.env, session._serverConfig.env); var taskList = taskListsBuilder.deploy( bundlePath, env, - deployCheckWaitTime, appName, setupNginx, ssl); + deployCheckWaitTime, appName, setupNginx, ssl, uploadProgressBar); taskList.run(session, function (summaryMap) { callback(null, summaryMap); }); }, whenAfterDeployed(buildLocation) - ) + ); } }); }; @@ -245,7 +246,7 @@ function storeLastNChars(vars, field, limit, color) { if(vars[field].length > 1000) { vars[field] = vars[field].substring(vars[field].length - 1000); } - } + }; } function whenAfterDeployed(buildLocation) { @@ -267,5 +268,5 @@ function haveSummaryMapsErrors(summaryMaps) { function hasSummaryMapErrors(summaryMap) { return _.some(summaryMap, function (summary) { return summary.error; - }) + }); } diff --git a/lib/config.js b/lib/config.js index d02e7de..182217d 100644 --- a/lib/config.js +++ b/lib/config.js @@ -27,6 +27,9 @@ exports.read = function() { if(typeof mupJson.appName === "undefined") { mupJson.appName = "meteor"; } + if(typeof mupJson.uploadProgressBar === "undefined") { + mupJson.uploadProgressBar = true; + } // make sure a PORT and ROOT_URL is specified for Nginx config if (mupJson.setupNginx) { diff --git a/lib/taskLists/linux.js b/lib/taskLists/linux.js index 8657dd4..0c3f85a 100644 --- a/lib/taskLists/linux.js +++ b/lib/taskLists/linux.js @@ -74,7 +74,7 @@ exports.setup = function(config) { return taskList; }; -exports.deploy = function(bundlePath, env, deployCheckWaitTime, appName, setupNginx, ssl) { +exports.deploy = function(bundlePath, env, deployCheckWaitTime, appName, setupNginx, ssl, uploadProgressBar) { var taskList = nodemiral.taskList("Deploy app '" + appName + "' (linux)"); if (setupNginx) { @@ -138,7 +138,7 @@ exports.deploy = function(bundlePath, env, deployCheckWaitTime, appName, setupNg taskList.copy('Uploading bundle', { src: bundlePath, dest: '/opt/' + appName + '/tmp/bundle.tar.gz', - progressBar: false + progressBar: uploadProgressBar }); taskList.copy('Setting up Environment Variables', { From 5f8f0d6ffa45555d5f42a4c479b05f142321ec0d Mon Sep 17 00:00:00 2001 From: Samuel Bolduc Date: Tue, 5 May 2015 08:59:54 -0400 Subject: [PATCH 43/73] Changed uploadProgressBar to enableUploadProgressBar and add documentation for it --- README.md | 4 ++++ example/mup.json | 6 ++++++ lib/actions.js | 4 ++-- lib/config.js | 4 ++-- lib/taskLists/linux.js | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 231c876..777e894 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,10 @@ This will create two files in your Meteor Up project directory: // Note: Port must not be 80 as Nginx will proxy_forward to port 80 per ROOT_URL (e.g. 3000, 3001, 3002, etc) "setupNginx": true, + // Show a progress bar during the upload of the bundle to the server. + // Might cause an error in some rare cases if set to true, for instance in Shippable CI + "enableUploadProgressBar": true, + // Application name (no spaces). "appName": "meteor", diff --git a/example/mup.json b/example/mup.json index 5a4327c..d921262 100644 --- a/example/mup.json +++ b/example/mup.json @@ -22,9 +22,15 @@ // Install PhantomJS in the server "setupPhantom": true, +<<<<<<< HEAD // Install Nginx on the server (Requires a unique PORT and ROOT_URL in the environment settings // Note: Port must not be 80 as Nginx will proxy_forward to port 80 per ROOT_URL (e.g. 3000, 3001, 3002, etc) "setupNginx": false, +======= + // Show a progress bar during the upload of the bundle to the server. + // Might cause an error in some rare cases if set to true, for instance in Shippable CI + "enableUploadProgressBar": true, +>>>>>>> Changed uploadProgressBar to enableUploadProgressBar and add documentation for it // Application name (No spaces) "appName": "meteor", diff --git a/lib/actions.js b/lib/actions.js index f952cbb..3c1eb51 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -112,7 +112,7 @@ Actions.prototype.deploy = function() { var setupNginx = this.config.setupNginx || false; var ssl = this.config.ssl || false; var appPath = this.config.app; - var uploadProgressBar = this.config.uploadProgressBar; + var enableUploadProgressBar = this.config.enableUploadProgressBar; console.log('Building Started: ' + this.config.app); buildApp(appPath, buildLocation, function(err) { @@ -138,7 +138,7 @@ Actions.prototype.deploy = function() { var env = _.extend({}, self.config.env, session._serverConfig.env); var taskList = taskListsBuilder.deploy( bundlePath, env, - deployCheckWaitTime, appName, setupNginx, ssl, uploadProgressBar); + deployCheckWaitTime, appName, setupNginx, ssl, enableUploadProgressBar); taskList.run(session, function (summaryMap) { callback(null, summaryMap); }); diff --git a/lib/config.js b/lib/config.js index 182217d..a8811fb 100644 --- a/lib/config.js +++ b/lib/config.js @@ -27,8 +27,8 @@ exports.read = function() { if(typeof mupJson.appName === "undefined") { mupJson.appName = "meteor"; } - if(typeof mupJson.uploadProgressBar === "undefined") { - mupJson.uploadProgressBar = true; + if(typeof mupJson.enableUploadProgressBar === "undefined") { + mupJson.enableUploadProgressBar = true; } // make sure a PORT and ROOT_URL is specified for Nginx config diff --git a/lib/taskLists/linux.js b/lib/taskLists/linux.js index 0c3f85a..4734823 100644 --- a/lib/taskLists/linux.js +++ b/lib/taskLists/linux.js @@ -74,7 +74,7 @@ exports.setup = function(config) { return taskList; }; -exports.deploy = function(bundlePath, env, deployCheckWaitTime, appName, setupNginx, ssl, uploadProgressBar) { +exports.deploy = function(bundlePath, env, deployCheckWaitTime, appName, setupNginx, ssl, enableUploadProgressBar) { var taskList = nodemiral.taskList("Deploy app '" + appName + "' (linux)"); if (setupNginx) { @@ -138,7 +138,7 @@ exports.deploy = function(bundlePath, env, deployCheckWaitTime, appName, setupNg taskList.copy('Uploading bundle', { src: bundlePath, dest: '/opt/' + appName + '/tmp/bundle.tar.gz', - progressBar: uploadProgressBar + progressBar: enableUploadProgressBar }); taskList.copy('Setting up Environment Variables', { From 59f3fba11759afe13c69306b0460095842e8840b Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Tue, 5 May 2015 18:40:45 +0530 Subject: [PATCH 44/73] 0.10.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5d95575..c94c782 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.10.6", + "version": "0.10.7", "description": "Production Quality Meteor Deployments", "dependencies": { "async": "^0.9.0", From 035e3cbc942d450209ecc2b12cf7d8c94a292f67 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Wed, 6 May 2015 17:31:58 +0530 Subject: [PATCH 45/73] Add a notice about Mupx --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 777e894..b5436ae 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Meteor Up +> We are working on the next version of Meteor Up with more stability and fast deployments. +> For that we use Docker behind the scene. +> Check it out: https://github.com/arunoda/meteor-up/tree/mupx# + #### Production Quality Meteor Deployments Meteor Up (mup for short) is a command line tool that allows you to deploy any [Meteor](http://meteor.com) app to your own server. It supports only Debian/Ubuntu flavours and Open Solaris at the moments. (PRs are welcome) From 8f6f5c5e5fb774620c14c240660bbf288a6c906b Mon Sep 17 00:00:00 2001 From: Ethan Willis Date: Thu, 14 May 2015 09:08:28 -0500 Subject: [PATCH 46/73] Fixed Typo Changed Strating to Starting --- lib/taskLists/linux.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/taskLists/linux.js b/lib/taskLists/linux.js index 4734823..11503be 100644 --- a/lib/taskLists/linux.js +++ b/lib/taskLists/linux.js @@ -277,7 +277,7 @@ function configureStud(taskList, pemFilePath, port) { }); //restart stud - taskList.execute('Strating Stud', { + taskList.execute('Starting Stud', { command: '(sudo stop stud || :) && (sudo start stud || :)' }); } From 73ec829ad756c3bff375f4991e5c102767b5b5ca Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Fri, 15 May 2015 23:10:15 +0530 Subject: [PATCH 47/73] Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1a95dcc --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 MeteorHacks Pvt Ltd (Sri Lanka). + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. From 801bb52dff4b6e932d1f7d99117bf8d2d5d17720 Mon Sep 17 00:00:00 2001 From: Sacha Greif Date: Thu, 21 May 2015 10:40:40 +0900 Subject: [PATCH 48/73] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index b5436ae..f702227 100644 --- a/README.md +++ b/README.md @@ -352,6 +352,10 @@ You should try and keep `mup` up to date in order to keep up with the latest Met ### Troubleshooting +#### Check Access + +Your issue might not always be related to Meteor Up. So make sure you can connect to your instance first, and that your credentials are working properly. + #### Check Logs If you suddenly can't deploy your app anymore, first use the `mup logs -f` command to check the logs for error messages. From 90138660c9edcc325b6bf817339396ad455ae47f Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 16 Jun 2015 10:07:31 -0700 Subject: [PATCH 49/73] Fixed bug where meteorBinary setting was ignored --- lib/actions.js | 3 ++- lib/build.js | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/actions.js b/lib/actions.js index 3c1eb51..bf32902 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -113,9 +113,10 @@ Actions.prototype.deploy = function() { var ssl = this.config.ssl || false; var appPath = this.config.app; var enableUploadProgressBar = this.config.enableUploadProgressBar; + var meteorBinary = this.config.meteorBinary; console.log('Building Started: ' + this.config.app); - buildApp(appPath, buildLocation, function(err) { + buildApp(appPath, meteorBinary, buildLocation, function(err) { if(err) { process.exit(1); } else { diff --git a/lib/build.js b/lib/build.js index d5ba763..c266d6a 100644 --- a/lib/build.js +++ b/lib/build.js @@ -4,8 +4,8 @@ var fs = require('fs'); var pathResolve = require('path').resolve; var _ = require('underscore'); -function buildApp(appPath, buildLocaltion, callback) { - buildMeteorApp(appPath, buildLocaltion, function(code) { +function buildApp(appPath, meteorBinary, buildLocaltion, callback) { + buildMeteorApp(appPath, meteorBinary, buildLocaltion, function(code) { if(code == 0) { archiveIt(buildLocaltion, callback); } else { @@ -15,8 +15,8 @@ function buildApp(appPath, buildLocaltion, callback) { }); } -function buildMeteorApp(appPath, buildLocaltion, callback) { - var executable = "meteor"; +function buildMeteorApp(appPath, meteorBinary, buildLocaltion, callback) { + var executable = meteorBinary; var args = [ "build", "--directory", buildLocaltion, "--server", "http://localhost:3000" @@ -65,4 +65,4 @@ function archiveIt(buildLocaltion, callback) { archive.directory(sourceDir, 'bundle').finalize(); } -module.exports = buildApp; \ No newline at end of file +module.exports = buildApp; From f7949017e57b77007cf7d0859d8e82d2998e7e24 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Fri, 19 Jun 2015 06:33:10 +0530 Subject: [PATCH 50/73] 0.10.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c94c782..7d36c3e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.10.7", + "version": "0.10.8", "description": "Production Quality Meteor Deployments", "dependencies": { "async": "^0.9.0", From 38091bdf89a5d108cde4a2d290a0b312b2f68eb5 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Tue, 23 Jun 2015 00:42:49 +0530 Subject: [PATCH 51/73] Add ssh-agent support --- README.md | 15 +++++++++++++++ lib/config.js | 12 ++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f702227..196c7f4 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,21 @@ This will bundle the Meteor project and deploy it to the server. Meteor Up checks if the deployment is successful or not just after the deployment. By default, it will wait 10 seconds before the check. You can configure the wait time with the `deployCheckWaitTime` option in the `mup.json` +#### SSH keys with paraphrase (or ssh-agent support) + +> This only tested with Mac/Linux + +It's common to use paraphrase enabled SSH keys to add an extra layer of protection to your SSH keys. You can use those keys with `mup` too. In order to do that, you need to use a `ssh-agent`. + +Here's the process: + +* First remove your `pem` field from the `mup.json`. So, your `mup.json` only has the username and host only. +* Then start a ssh agent with eval `eval $(ssh-agent)` +* Then add your ssh key with `ssh-add ` +* Then you'll asked to enter the paraphrase to the key +* After that simply invoke `mup` commands and they'll just work +* Once you've deployed your app kill the ssh agent with `ssh-agent -k` + #### Ssh based authentication with `sudo` **If your username is `root`, you don't need to follow these steps** diff --git a/lib/config.js b/lib/config.js index a8811fb..c0120c1 100644 --- a/lib/config.js +++ b/lib/config.js @@ -44,12 +44,20 @@ exports.read = function() { mupErrorLog('Server information does not exist'); } else { mupJson.servers.forEach(function(server) { + var sshAgentExists = false; + var sshAgent = process.env.SSH_AUTH_SOCK; + if(sshAgent) { + sshAgentExists = fs.existsSync(sshAgent); + server.sshOptions = server.sshOptions || {}; + server.sshOptions.agent = sshAgent; + } + if(!server.host) { mupErrorLog('Server host does not exist'); } else if(!server.username) { mupErrorLog('Server username does not exist'); - } else if(!server.password && !server.pem) { - mupErrorLog('Server password or pem does not exist'); + } else if(!server.password && !server.pem && !sshAgentExists) { + mupErrorLog('Server password, pem or a ssh agent does not exist'); } else if(!mupJson.app) { mupErrorLog('Path to app does not exist'); } From fcd25f8a68309e5fc3b7b58133c093740a43c3e1 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Tue, 23 Jun 2015 00:42:57 +0530 Subject: [PATCH 52/73] 0.11.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7d36c3e..a927e2d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.10.8", + "version": "0.11.0", "description": "Production Quality Meteor Deployments", "dependencies": { "async": "^0.9.0", From e04142b63e627f6f50c29f762d1bcebd8c681938 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Tue, 23 Jun 2015 02:52:10 +0530 Subject: [PATCH 53/73] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 196c7f4..23c712d 100644 --- a/README.md +++ b/README.md @@ -174,7 +174,7 @@ It's common to use paraphrase enabled SSH keys to add an extra layer of protecti Here's the process: * First remove your `pem` field from the `mup.json`. So, your `mup.json` only has the username and host only. -* Then start a ssh agent with eval `eval $(ssh-agent)` +* Then start a ssh agent with `eval $(ssh-agent)` * Then add your ssh key with `ssh-add ` * Then you'll asked to enter the paraphrase to the key * After that simply invoke `mup` commands and they'll just work From 29d42880d06313871612b2da3c31827545194054 Mon Sep 17 00:00:00 2001 From: Adam Monsen Date: Tue, 30 Jun 2015 16:58:21 -0700 Subject: [PATCH 54/73] README: fix typo: SSH key "passphrase" Also, simplify intro to this section. The benefit of encryption should be obvious in this context. --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 23c712d..559ae81 100644 --- a/README.md +++ b/README.md @@ -165,18 +165,19 @@ This will bundle the Meteor project and deploy it to the server. Meteor Up checks if the deployment is successful or not just after the deployment. By default, it will wait 10 seconds before the check. You can configure the wait time with the `deployCheckWaitTime` option in the `mup.json` -#### SSH keys with paraphrase (or ssh-agent support) +#### SSH keys with passphrase (or ssh-agent support) > This only tested with Mac/Linux -It's common to use paraphrase enabled SSH keys to add an extra layer of protection to your SSH keys. You can use those keys with `mup` too. In order to do that, you need to use a `ssh-agent`. +With the help of `ssh-agent`, `mup` can use SSH keys encrypted with a +passphrase. Here's the process: * First remove your `pem` field from the `mup.json`. So, your `mup.json` only has the username and host only. * Then start a ssh agent with `eval $(ssh-agent)` * Then add your ssh key with `ssh-add ` -* Then you'll asked to enter the paraphrase to the key +* Then you'll asked to enter the passphrase to the key * After that simply invoke `mup` commands and they'll just work * Once you've deployed your app kill the ssh agent with `ssh-agent -k` From a6099ed2f2bab833d45fc750f806ccd85660f4b9 Mon Sep 17 00:00:00 2001 From: ethan kennedy Date: Wed, 8 Jul 2015 14:25:30 -0500 Subject: [PATCH 55/73] use single equals sign for POSIX-compatible string comparison in gyp_rebuild_inside_node_modules() --- templates/linux/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 templates/linux/deploy.sh diff --git a/templates/linux/deploy.sh b/templates/linux/deploy.sh old mode 100644 new mode 100755 index 5cb6f6f..5f05332 --- a/templates/linux/deploy.sh +++ b/templates/linux/deploy.sh @@ -27,7 +27,7 @@ gyp_rebuild_inside_node_modules () { check_for_binary_modules - if [ $isBinaryModule == "yes" ]; then + if [ $isBinaryModule = "yes" ]; then echo " > $npmModule: npm install due to binary npm modules" rm -rf node_modules if [ -f binding.gyp ]; then From b984a89b222fc511a50fb951215c7ccfc2c86aa2 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Thu, 9 Jul 2015 05:38:51 +0530 Subject: [PATCH 56/73] 0.11.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a927e2d..d06f763 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.11.0", + "version": "0.11.1", "description": "Production Quality Meteor Deployments", "dependencies": { "async": "^0.9.0", From ce027ff33978c9feafda041e365324b840c04b78 Mon Sep 17 00:00:00 2001 From: Fabian Vilers Date: Mon, 20 Jul 2015 09:14:46 +0200 Subject: [PATCH 57/73] Added missing commas from config sample --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 559ae81..e4ac16f 100644 --- a/README.md +++ b/README.md @@ -92,10 +92,10 @@ This will create two files in your Meteor Up project directory: { "host": "hostname", "username": "root", - "password": "password" + "password": "password", // or pem file (ssh based authentication) // WARNING: Keys protected by a passphrase are not supported - //"pem": "~/.ssh/id_rsa" + //"pem": "~/.ssh/id_rsa", // Also, for non-standard ssh port use this //"sshOptions": { "port" : 49154 }, // server specific environment variables @@ -272,7 +272,7 @@ It is possible to provide server specific environment variables. Add the `env` o { "host": "hostname", "username": "root", - "password": "password" + "password": "password", "env": { "SOME_ENV": "the-value" } From bbe8b041ad750eee80e1964585c948a2720a7096 Mon Sep 17 00:00:00 2001 From: Tom Malone Date: Mon, 10 Aug 2015 17:54:56 -0400 Subject: [PATCH 58/73] Added a sub-link under 'Server Configuration' in the Table of Contents to the passphrase-protected ssh-key-based authentication instructions. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e4ac16f..abbfc55 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ You can use install and use Meteor Up from Linux, Mac and Windows. - [Features](#features) - [Server Configuration](#server-configuration) + - [SSH-key-based authentication (with passphrase)](#ssh-keys-with-passphrase-or-ssh-agent-support) - [Nginx Multiple App Hosting](#server-nginx) - [Installation](#installation) - [Creating a Meteor Up Project](#creating-a-meteor-up-project) @@ -370,7 +371,7 @@ You should try and keep `mup` up to date in order to keep up with the latest Met #### Check Access -Your issue might not always be related to Meteor Up. So make sure you can connect to your instance first, and that your credentials are working properly. +Your issue might not always be related to Meteor Up. So make sure you can connect to your instance first, and that your credentials are working properly. #### Check Logs If you suddenly can't deploy your app anymore, first use the `mup logs -f` command to check the logs for error messages. From 04159dfca5798fc761167583d51fcfa0b0113d50 Mon Sep 17 00:00:00 2001 From: Tom Malone Date: Mon, 10 Aug 2015 17:56:52 -0400 Subject: [PATCH 59/73] Removed the warning about passphrase-protected SSH keys being unsupported from the JS comments in the example mup.json config file. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index abbfc55..fc2ee04 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,6 @@ This will create two files in your Meteor Up project directory: "username": "root", "password": "password", // or pem file (ssh based authentication) - // WARNING: Keys protected by a passphrase are not supported //"pem": "~/.ssh/id_rsa", // Also, for non-standard ssh port use this //"sshOptions": { "port" : 49154 }, From 51b7f8affca6809d51f2fb34126e8afe62298080 Mon Sep 17 00:00:00 2001 From: Capensis Date: Wed, 19 Aug 2015 00:29:45 +0100 Subject: [PATCH 60/73] Fixed Broken link to ssl combine guide! .html was appended and redirect to 404 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc2ee04..67fc017 100644 --- a/README.md +++ b/README.md @@ -334,7 +334,7 @@ Meteor Up has the built in SSL support. It uses [stud](https://github.com/bumpte * When asked to select your SSL server type, select it as nginx. * Then you'll get a set of files (your domain certificate and CA files). -Now you need combine SSL certificate(s) with the private key and save it in the mup config directory as `ssl.pem`. Check this [guide](http://alexnj.com/blog/configuring-a-positivessl-certificate-with-stud.html) to do that. +Now you need combine SSL certificate(s) with the private key and save it in the mup config directory as `ssl.pem`. Check this [guide](http://alexnj.com/blog/configuring-a-positivessl-certificate-with-stud) to do that. Then add following configuration to your `mup.json` file. From 756f2b42b8187794eae17b413a4ba2452794f282 Mon Sep 17 00:00:00 2001 From: Fabian Vilers Date: Tue, 1 Sep 2015 09:59:25 +0200 Subject: [PATCH 61/73] Updated build location path to use OS tmp directory --- lib/actions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/actions.js b/lib/actions.js index bf32902..7fa94b6 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -10,6 +10,7 @@ var extend = require('util')._extend; var _ = require('underscore'); var async = require('async'); var buildApp = require('./build.js'); +var os = require('os'); require('colors'); module.exports = Actions; @@ -100,7 +101,7 @@ Actions.prototype.deploy = function() { var self = this; self._showKadiraLink(); - var buildLocation = path.resolve('/tmp', uuid.v4()); + var buildLocation = path.resolve(os.tmpdir(), uuid.v4()); var bundlePath = path.resolve(buildLocation, 'bundle.tar.gz'); // spawn inherits env vars from process.env From 73bc8d00da6d4380fd41b2e1ddad4e8e49e7259e Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Tue, 1 Sep 2015 13:35:48 +0530 Subject: [PATCH 62/73] 0.11.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d06f763..aa6a771 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.11.1", + "version": "0.11.2", "description": "Production Quality Meteor Deployments", "dependencies": { "async": "^0.9.0", From c4d78b3a9565da3a7eb3dd311f4d394c766b4c8d Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Fri, 25 Sep 2015 16:19:29 +0530 Subject: [PATCH 63/73] Update nodemiral --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aa6a771..85b610a 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "async": "^0.9.0", "cjson": "0.3.x", "colors": "0.6.x", - "nodemiral": "^1.0.1", + "nodemiral": "^1.1.1", "rimraf": "2.x.x", "underscore": "1.7.0", "uuid": "1.4.x", From c3b1aeef9f2dc071ff073dda5801b4cb6a3741fe Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Fri, 25 Sep 2015 16:19:38 +0530 Subject: [PATCH 64/73] 0.11.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 85b610a..963b86a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup", - "version": "0.11.2", + "version": "0.11.3", "description": "Production Quality Meteor Deployments", "dependencies": { "async": "^0.9.0", From e987721055d6d1cec59e4f9ec62cd4f6aea911c7 Mon Sep 17 00:00:00 2001 From: Aaron Thorp Date: Mon, 23 Feb 2015 17:04:20 +1100 Subject: [PATCH 65/73] add nginx multiple app support --- README.md | 4 ++++ example/mup.json | 8 ++++++++ lib/actions.js | 2 ++ lib/taskLists/linux.js | 20 +++++++++++++++++++ templates/linux/nginx.conf | 10 ---------- web/mup.json | 41 ++++++++++++++++++++++++++++++++++++++ web/settings.json | 5 +++++ 7 files changed, 80 insertions(+), 10 deletions(-) create mode 100644 web/mup.json create mode 100644 web/settings.json diff --git a/README.md b/README.md index 67fc017..a395c28 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,10 @@ This will create two files in your Meteor Up project directory: // Might cause an error in some rare cases if set to true, for instance in Shippable CI "enableUploadProgressBar": true, + // Install Nginx on the server (Requires a unique PORT and ROOT_URL in the environment settings + // Note: Port must not be 80 as Nginx will proxy_forward to port 80 per ROOT_URL (e.g. 3000, 3001, 3002, etc) + "setupNginx": true, + // Application name (no spaces). "appName": "meteor", diff --git a/example/mup.json b/example/mup.json index d921262..00b3a1c 100644 --- a/example/mup.json +++ b/example/mup.json @@ -22,16 +22,24 @@ // Install PhantomJS in the server "setupPhantom": true, +<<<<<<< HEAD <<<<<<< HEAD // Install Nginx on the server (Requires a unique PORT and ROOT_URL in the environment settings // Note: Port must not be 80 as Nginx will proxy_forward to port 80 per ROOT_URL (e.g. 3000, 3001, 3002, etc) "setupNginx": false, ======= // Show a progress bar during the upload of the bundle to the server. +======= + // Show a progress bar during the upload of the bundle to the server. +>>>>>>> add nginx multiple app support // Might cause an error in some rare cases if set to true, for instance in Shippable CI "enableUploadProgressBar": true, >>>>>>> Changed uploadProgressBar to enableUploadProgressBar and add documentation for it + // Install Nginx on the server (Requires a unique PORT and ROOT_URL in the environment settings + // Note: Port must not be 80 as Nginx will proxy_forward to port 80 per ROOT_URL (e.g. 3000, 3001, 3002, etc) + "setupNginx": false, + // Application name (No spaces) "appName": "meteor", diff --git a/lib/actions.js b/lib/actions.js index 7fa94b6..f9354bc 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -115,6 +115,7 @@ Actions.prototype.deploy = function() { var appPath = this.config.app; var enableUploadProgressBar = this.config.enableUploadProgressBar; var meteorBinary = this.config.meteorBinary; + var setupNginx = this.config.setupNginx || false; console.log('Building Started: ' + this.config.app); buildApp(appPath, meteorBinary, buildLocation, function(err) { @@ -142,6 +143,7 @@ Actions.prototype.deploy = function() { bundlePath, env, deployCheckWaitTime, appName, setupNginx, ssl, enableUploadProgressBar); taskList.run(session, function (summaryMap) { + rimraf.sync(buildLocation); callback(null, summaryMap); }); }, diff --git a/lib/taskLists/linux.js b/lib/taskLists/linux.js index 11503be..aff8ca0 100644 --- a/lib/taskLists/linux.js +++ b/lib/taskLists/linux.js @@ -208,6 +208,26 @@ exports.reconfig = function(env, appName, setupNginx) { command: '(sudo stop ' + appName + ' || :) && (sudo start ' + appName + ')' }); + if (setupNginx) { + //configure nginx + taskList.copy('Configuring Nginx (App Instance)', { + src: path.resolve(TEMPLATES_DIR, 'nginx.conf'), + dest: '/etc/nginx/sites-available/' + appName + '.conf', + vars: { + appPort: env['PORT'] || 80, + appRoot: env['ROOT_URL'].replace(/.*?:\/\//g, "") + } + }); + + taskList.executeScript('Configuring Nginx (Enabling Site)', { + script: path.resolve(SCRIPT_DIR, 'setup-nginx.sh'), + vars: { + appName: appName + } + }); + + } + return taskList; }; diff --git a/templates/linux/nginx.conf b/templates/linux/nginx.conf index 5f543a5..f462434 100644 --- a/templates/linux/nginx.conf +++ b/templates/linux/nginx.conf @@ -13,14 +13,4 @@ server { proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } - - ## serve static files by nginx instead of Meteor (the public/ folder) - Thanks @yauh :) - #location ~ \.(jpg|jpeg|png|gif|mp3|ico|pdf) { - # root /opt/<%= appName %>/app/programs/web.browser/app; # this should point at the content from the public folder - # access_log off; - # expires 30d; - # add_header Pragma public; - # add_header Cache-Control "public"; - #} - } diff --git a/web/mup.json b/web/mup.json new file mode 100644 index 0000000..c732b33 --- /dev/null +++ b/web/mup.json @@ -0,0 +1,41 @@ +{ + // Server authentication info + "servers": [ + { + "host": "46.101.153.105", + "username": "root" + } + ], + + // Install MongoDB in the server, does not destroy local MongoDB on future setup + "setupMongo": true, + + // WARNING: Node.js is required! Only skip if you already have Node.js installed on server. + "setupNode": true, + + // WARNING: If nodeVersion omitted will setup 0.10.33 by default. Do not use v, only version number. + "nodeVersion": "0.10.40", + + // Install PhantomJS in the server + "setupPhantom": false, + + // Install Nginx on the server (Requires a unique PORT and ROOT_URL in the environment settings + // Note: Port must not be 80 as Nginx will proxy_forward to port 80 per ROOT_URL (e.g. 3000, 3001, 3002, etc) + "setupNginx": true, + + // Application name (No spaces) + "appName": "meteor", + + // Location of app (local directory) + "app": ".", + + // Configure environment + "env": { + "ROOT_URL": "http://myapp.com", + "PORT": 3000 + }, + + // Meteor Up checks if the app comes online just after the deployment + // before mup checks that, it will wait for no. of seconds configured below + "deployCheckWaitTime": 3 +} diff --git a/web/settings.json b/web/settings.json new file mode 100644 index 0000000..d9891ce --- /dev/null +++ b/web/settings.json @@ -0,0 +1,5 @@ +{ + "public": { + + } +} \ No newline at end of file From b40450db74e6fe46e84ff0b88c1befef6497d8bf Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Wed, 14 Oct 2015 13:47:39 +0200 Subject: [PATCH 66/73] Fixed duplicate. --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index a395c28..3a2546b 100644 --- a/README.md +++ b/README.md @@ -115,10 +115,6 @@ This will create two files in your Meteor Up project directory: // Install PhantomJS on the server "setupPhantom": true, - // Install Nginx on the server (Requires a unique PORT and ROOT_URL in the environment settings - // Note: Port must not be 80 as Nginx will proxy_forward to port 80 per ROOT_URL (e.g. 3000, 3001, 3002, etc) - "setupNginx": true, - // Show a progress bar during the upload of the bundle to the server. // Might cause an error in some rare cases if set to true, for instance in Shippable CI "enableUploadProgressBar": true, From 90b5de68ec9de9279317a1956f4950811ef6193b Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Wed, 14 Oct 2015 14:49:00 +0200 Subject: [PATCH 67/73] Removed conflict issues and duplicate code. --- example/mup.json | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/example/mup.json b/example/mup.json index 00b3a1c..9166447 100644 --- a/example/mup.json +++ b/example/mup.json @@ -22,23 +22,13 @@ // Install PhantomJS in the server "setupPhantom": true, -<<<<<<< HEAD -<<<<<<< HEAD // Install Nginx on the server (Requires a unique PORT and ROOT_URL in the environment settings // Note: Port must not be 80 as Nginx will proxy_forward to port 80 per ROOT_URL (e.g. 3000, 3001, 3002, etc) "setupNginx": false, -======= - // Show a progress bar during the upload of the bundle to the server. -======= + // Show a progress bar during the upload of the bundle to the server. ->>>>>>> add nginx multiple app support // Might cause an error in some rare cases if set to true, for instance in Shippable CI "enableUploadProgressBar": true, ->>>>>>> Changed uploadProgressBar to enableUploadProgressBar and add documentation for it - - // Install Nginx on the server (Requires a unique PORT and ROOT_URL in the environment settings - // Note: Port must not be 80 as Nginx will proxy_forward to port 80 per ROOT_URL (e.g. 3000, 3001, 3002, etc) - "setupNginx": false, // Application name (No spaces) "appName": "meteor", From e27a19ef10e35499ba69abdd78188c0f9d958f6f Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Wed, 14 Oct 2015 15:07:49 +0200 Subject: [PATCH 68/73] Removed sample files. --- web/mup.json | 41 ----------------------------------------- web/settings.json | 5 ----- 2 files changed, 46 deletions(-) delete mode 100644 web/mup.json delete mode 100644 web/settings.json diff --git a/web/mup.json b/web/mup.json deleted file mode 100644 index c732b33..0000000 --- a/web/mup.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - // Server authentication info - "servers": [ - { - "host": "46.101.153.105", - "username": "root" - } - ], - - // Install MongoDB in the server, does not destroy local MongoDB on future setup - "setupMongo": true, - - // WARNING: Node.js is required! Only skip if you already have Node.js installed on server. - "setupNode": true, - - // WARNING: If nodeVersion omitted will setup 0.10.33 by default. Do not use v, only version number. - "nodeVersion": "0.10.40", - - // Install PhantomJS in the server - "setupPhantom": false, - - // Install Nginx on the server (Requires a unique PORT and ROOT_URL in the environment settings - // Note: Port must not be 80 as Nginx will proxy_forward to port 80 per ROOT_URL (e.g. 3000, 3001, 3002, etc) - "setupNginx": true, - - // Application name (No spaces) - "appName": "meteor", - - // Location of app (local directory) - "app": ".", - - // Configure environment - "env": { - "ROOT_URL": "http://myapp.com", - "PORT": 3000 - }, - - // Meteor Up checks if the app comes online just after the deployment - // before mup checks that, it will wait for no. of seconds configured below - "deployCheckWaitTime": 3 -} diff --git a/web/settings.json b/web/settings.json deleted file mode 100644 index d9891ce..0000000 --- a/web/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "public": { - - } -} \ No newline at end of file From 39f9986751639672a3e73ff5b2c865b8338190a0 Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Tue, 27 Oct 2015 08:51:32 +0100 Subject: [PATCH 69/73] Update package.json --- package.json | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 963b86a..0e69a2f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "mup", + "name": "mup-multi", "version": "0.11.3", - "description": "Production Quality Meteor Deployments", + "description": "Production Quality Meteor Deployments using Nginx", "dependencies": { "async": "^0.9.0", "cjson": "0.3.x", @@ -13,12 +13,15 @@ "archiver": "0.14.x" }, "bin": { - "mup": "./bin/mup" + "mup-multi": "./bin/mup" }, - "author": "Arunoda Susiripala ", + "author": [ + "Arunoda Susiripala ", + "Tim Brandin " + ], "repository": { "type": "git", - "url": "git://github.com/arunoda/meteor-up.git" + "url": "git://github.com/studiointeract/meteor-up-multi.git" }, "license": "MIT" } From 2a908a16820b756713752711a4e1f88760331d25 Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Tue, 3 Nov 2015 11:10:02 +0100 Subject: [PATCH 70/73] Added rights to index.html to be able to deploy from other user than root. --- scripts/linux/install-nginx.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/linux/install-nginx.sh b/scripts/linux/install-nginx.sh index 2dca8b7..7ed6e7a 100644 --- a/scripts/linux/install-nginx.sh +++ b/scripts/linux/install-nginx.sh @@ -13,3 +13,5 @@ sudo apt-get install nginx -y # Restart nginx sudo service nginx stop || : sudo service nginx start + +sudo chmod g+w /usr/share/nginx/html/index.html From 83e021d94d4761475bcfbc5355e04317d6d65722 Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Tue, 3 Nov 2015 11:47:58 +0100 Subject: [PATCH 71/73] Fixed issues with permissions when deploying as a non-root user. --- scripts/linux/install-nginx.sh | 2 +- scripts/linux/setup-env-nginx.sh | 8 ++++++++ scripts/linux/setup-nginx.sh | 7 +++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/linux/install-nginx.sh b/scripts/linux/install-nginx.sh index 7ed6e7a..5811ea3 100644 --- a/scripts/linux/install-nginx.sh +++ b/scripts/linux/install-nginx.sh @@ -14,4 +14,4 @@ sudo apt-get install nginx -y sudo service nginx stop || : sudo service nginx start -sudo chmod g+w /usr/share/nginx/html/index.html +sudo chmod o+w /usr/share/nginx/html/index.html diff --git a/scripts/linux/setup-env-nginx.sh b/scripts/linux/setup-env-nginx.sh index d2d25bd..59110ad 100644 --- a/scripts/linux/setup-env-nginx.sh +++ b/scripts/linux/setup-env-nginx.sh @@ -7,3 +7,11 @@ sudo mkdir -p /opt/<%= appName %>/tmp sudo mkdir -p /opt/<%= appName %>/ssl sudo chown ${USER} /opt/<%= appName %> -R + +sudo chmod o-w /usr/share/nginx/html/index.html +sudo chmod -R a+w /etc/nginx/sites-available/ +sudo chmod -R a+w /etc/nginx/sites-enabled/ +sudo chmod -R a+w /var/log/nginx/ + +sudo chown ${USER} /run/nginx.pid +sudo chmod u+rwx /run/nginx.pid diff --git a/scripts/linux/setup-nginx.sh b/scripts/linux/setup-nginx.sh index 6eb8a17..973d2e7 100644 --- a/scripts/linux/setup-nginx.sh +++ b/scripts/linux/setup-nginx.sh @@ -40,7 +40,7 @@ if [ -r $SITE_AVAILABLE ]; then fi ## Test for a well formed configuration. echo "Testing nginx configuration..." - $NGINX -t && STATUS=0 + sudo $NGINX -t && STATUS=0 if [ $STATUS ]; then echo -n "Site $1 has been enabled. " else @@ -52,7 +52,7 @@ else fi echo "Testing nginx configuration..." -$NGINX -t && STATUS=0 +sudo $NGINX -t && STATUS=0 if [ $STATUS ]; then echo -n "Site $1 has been enabled. " else @@ -60,3 +60,6 @@ else fi sudo service nginx reload + +sudo chmod -R og-w /etc/nginx/sites-available/ +sudo chmod -R og-w /etc/nginx/sites-enabled/ From cfa6c5581341df7a93bbfcab61dc277b16c6c957 Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Fri, 6 Nov 2015 14:34:01 +0100 Subject: [PATCH 72/73] Added redirect to with or without www. --- lib/taskLists/linux.js | 3 ++- templates/linux/nginx.conf | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/taskLists/linux.js b/lib/taskLists/linux.js index aff8ca0..51674fb 100644 --- a/lib/taskLists/linux.js +++ b/lib/taskLists/linux.js @@ -121,7 +121,8 @@ exports.deploy = function(bundlePath, env, deployCheckWaitTime, appName, setupNg vars: { appName: appName, appPort: env['PORT'], - appRoot: env['ROOT_URL'].replace(/.*?:\/\//g, "") + appRoot: env['ROOT_URL'].replace(/.*?:\/\//g, ""), + hostName: ((env['ROOT_URL']).match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i) || [,''])[1] } }); diff --git a/templates/linux/nginx.conf b/templates/linux/nginx.conf index f462434..49cd8fb 100644 --- a/templates/linux/nginx.conf +++ b/templates/linux/nginx.conf @@ -14,3 +14,14 @@ server { proxy_cache_bypass $http_upgrade; } } +<% if (/^www\./i.test(hostName)) { %> +server { + server_name <%= hostName.replace(/^www\./i, '') %>; + return 301 $scheme://<%= hostName %>$request_uri; +} +<% } else { %> +server { + server_name www.<%= hostName %>; + return 301 $scheme://<%= hostName %>$request_uri; +} +<% } %> From 7e25b97927d983a95736dc86d25470c5d600e6e6 Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Sat, 7 Nov 2015 16:04:35 +0100 Subject: [PATCH 73/73] Version bump. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0e69a2f..2f24343 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mup-multi", - "version": "0.11.3", + "version": "0.11.4", "description": "Production Quality Meteor Deployments using Nginx", "dependencies": { "async": "^0.9.0",