Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make mup compatible with Meteor 1.3 #942

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Meteor Up

> This version is no longer maintaining.<br/>
> [Mupx](https://github.com/arunoda/meteor-up/tree/mupx) is the stable version. <br/>
> New development is moved to here: https://github.com/kadirahq/meteor-up.
> This is a Meteor 1.4-ready fork of initial meteor-up project.<br/>
> It uses Node 4.4.7 and MongoDB 3.2 by default.
> Docker-enabled version is developed by KadiraHQ here: https://github.com/kadirahq/meteor-up.

#### Production Quality Meteor Deployments

Expand Down Expand Up @@ -59,7 +59,12 @@ You can use install and use Meteor Up from Linux, Mac and Windows.

### Installation

npm install -g mup
**Note:** These instructions are for installing this fork of meteor-up.

npm remove -g mup # Only if you already installed mup before
git clone https://github.com/M4v3R/meteor-up
cd meteor-up
npm install -g

### Creating a Meteor Up Project

Expand Down Expand Up @@ -99,8 +104,8 @@ 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.36 if omitted. Do not use v, just the version number.
"nodeVersion": "0.10.36",
// WARNING: nodeVersion defaults to 0.10.43 if omitted. Do not use v, just the version number.
"nodeVersion": "4.4.7",

// Install PhantomJS on the server
"setupPhantom": true,
Expand Down Expand Up @@ -145,6 +150,12 @@ This will setup the server for the `mup` deployments. It will take around 2-5 mi

This will bundle the Meteor project and deploy it to the server.

#### Deploying prebuilt bundle

While deploying you can omit the building phase if you already have a prebuilt bundle. Just append its path to the deploy command:

mup deploy /path/to/bundle.tar.gz

### Additional Setup/Deploy Information

#### Deploy Wait Time
Expand Down
6 changes: 3 additions & 3 deletions example/mup.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
// 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.36 by default. Do not use v, only version number.
"nodeVersion": "0.10.36",
// WARNING: If nodeVersion omitted will setup 0.10.43 by default. Do not use v, only version number.
"nodeVersion": "4.4.7",

// Install PhantomJS in the server
"setupPhantom": true,

// 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.
// Might cause an error in some rare cases if set to true, for instance in Shippable CI
"enableUploadProgressBar": true,

Expand Down
77 changes: 47 additions & 30 deletions lib/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,40 +113,57 @@ Actions.prototype.deploy = function() {
var appPath = this.config.app;
var enableUploadProgressBar = this.config.enableUploadProgressBar;
var meteorBinary = this.config.meteorBinary;
var prebuiltBundle = process.argv.slice(3).join(" ");
if (prebuiltBundle && !fs.existsSync(prebuiltBundle)) {
console.error('Error: bundle not found!'.bold.red);
process.exit(1);
}

console.log('Building Started: ' + this.config.app);
buildApp(appPath, meteorBinary, buildLocation, function(err) {
if(err) {
process.exit(1);
} else {
var sessionsData = [];
_.forEach(self.sessionsMap, function (sessionsInfo) {
var taskListsBuilder = sessionsInfo.taskListsBuilder;
_.forEach(sessionsInfo.sessions, function (session) {
sessionsData.push({
taskListsBuilder: taskListsBuilder,
session: session
});
var deployFunc = function() {
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 = taskListsBuilder.deploy(
bundlePath, env,
deployCheckWaitTime, appName, enableUploadProgressBar);
taskList.run(session, function (summaryMap) {
callback(null, summaryMap);
});
},
whenAfterDeployed(buildLocation)
);
}
});
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 = taskListsBuilder.deploy(
bundlePath, env,
deployCheckWaitTime, appName, enableUploadProgressBar);
taskList.run(session, function (summaryMap) {
callback(null, summaryMap);
});
},
whenAfterDeployed(buildLocation)
);
}

if (!prebuiltBundle) {
console.log('Building Started: ' + this.config.app);
console.log('Bundle path: ' + bundlePath);
buildApp(appPath, meteorBinary, buildLocation, function(err) {
if(err) {
process.exit(1);
} else {
deployFunc();
}
});
}
else {
console.log('Deploying prebuilt bundle: ' + bundlePath);
bundlePath = prebuiltBundle;
deployFunc();
}
};

Actions.prototype.reconfig = function() {
Expand Down
2 changes: 1 addition & 1 deletion lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports.printHelp = function() {
console.error('init - Initialize a Meteor Up project');
console.error('setup - Setup the server');
console.error('');
console.error('deploy - Deploy app to server');
console.error('deploy [path] - Deploy app to server (optionally with prebuilt bundle.tar.gz)');
console.error('reconfig - Reconfigure the server and restart');
console.error('');
console.error('logs [-f -n] - Access logs');
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mup",
"version": "0.11.3",
"version": "0.11.4",
"description": "Production Quality Meteor Deployments",
"dependencies": {
"async": "^0.9.0",
Expand All @@ -10,7 +10,7 @@
"rimraf": "2.x.x",
"underscore": "1.7.0",
"uuid": "1.4.x",
"archiver": "0.14.x"
"archiver": "^1.3.0"
},
"bin": {
"mup": "./bin/mup"
Expand Down
4 changes: 2 additions & 2 deletions scripts/linux/install-mongodb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ sudo rm /var/cache/apt/archives/lock > /dev/null
sudo dpkg --configure -a
set -e

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update -y
sudo apt-get install mongodb-org mongodb-org-server mongodb-org-shell mongodb-org-tools -y

Expand Down
6 changes: 5 additions & 1 deletion scripts/linux/install-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sudo apt-get update
<% if (nodeVersion) { %>
NODE_VERSION=<%= nodeVersion %>
<% } else {%>
NODE_VERSION=0.10.36
NODE_VERSION=0.10.43
<% } %>

ARCH=$(python -c 'import platform; print platform.architecture()[0]')
Expand All @@ -36,3 +36,7 @@ sudo mv ${NODE_DIST} /opt/nodejs

sudo ln -sf /opt/nodejs/bin/node /usr/bin/node
sudo ln -sf /opt/nodejs/bin/npm /usr/bin/npm

# Install node-gyp and remove old files if necessary
sudo npm install -g node-gyp
sudo rm -rf ~/.node-gyp*
4 changes: 2 additions & 2 deletions scripts/linux/install-phantomjs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ set -e
# Install PhantomJS
sudo apt-get -y install libfreetype6 libfreetype6-dev fontconfig > /dev/null
ARCH=`uname -m`
PHANTOMJS_VERSION=1.9.8
PHANTOMJS_VERSION=2.1.1

cd /usr/local/share/
sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-${PHANTOMJS_VERSION}-linux-${ARCH}.tar.bz2 > /dev/null
sudo curl -L -O https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-${PHANTOMJS_VERSION}-linux-${ARCH}.tar.bz2 > /dev/null
sudo tar xjf phantomjs-${PHANTOMJS_VERSION}-linux-${ARCH}.tar.bz2 > /dev/null
sudo ln -s -f /usr/local/share/phantomjs-${PHANTOMJS_VERSION}-linux-${ARCH}/bin/phantomjs /usr/local/share/phantomjs
sudo ln -s -f /usr/local/share/phantomjs-${PHANTOMJS_VERSION}-linux-${ARCH}/bin/phantomjs /usr/local/bin/phantomjs
Expand Down
2 changes: 1 addition & 1 deletion scripts/sunos/install-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<% if (nodeVersion) { %>
NODE_VERSION=<%= nodeVersion %>
<% } else {%>
NODE_VERSION=0.10.36
NODE_VERSION=0.10.43
<% } %>

ARCH=$(python -c 'import platform; print platform.architecture()[0]')
Expand Down
24 changes: 18 additions & 6 deletions templates/linux/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ gyp_rebuild_inside_node_modules () {
if [ $isBinaryModule != "yes" ]; then
if [ -d ./node_modules ]; then
cd ./node_modules
for module in ./*; do
cd $module
check_for_binary_modules
cd ..
done
if [ "$(ls ./ )" ]; then
for module in ./*; do
cd $module
check_for_binary_modules
cd ..
done
fi
cd ../
fi
fi
Expand Down Expand Up @@ -52,6 +54,10 @@ rebuild_binary_npm_modules () {
cd $package/node_modules
gyp_rebuild_inside_node_modules
cd ../../../
elif [ -d $package ]; then # Meteor 1.3
cd $package
rebuild_binary_npm_modules
cd ..
fi
done
}
Expand Down Expand Up @@ -89,7 +95,13 @@ cd ${BUNDLE_DIR}/programs/server

if [ -d ./npm ]; then
cd npm
rebuild_binary_npm_modules
if [ -d ./node_modules ]; then # Meteor 1.3
cd node_modules
rebuild_binary_npm_modules
cd ..
else
rebuild_binary_npm_modules
fi
cd ../
fi

Expand Down