Skip to content

MongoDB version option to mup.json #1023

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

Open
wants to merge 9 commits into
base: mupx
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
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Meteor Up X (Stable Version)

> The latest development version of mup is https://github.com/kadirahq/meteor-up.
# Meteor Up Dockerized (Stable Version)

#### Production Quality Meteor Deployments

Expand Down Expand Up @@ -54,13 +52,13 @@ This version of Meteor Up is powered by [Docker](http://www.docker.com/) and it

### Installation

npm install -g mupx
npm install -g mupd

### Creating a Meteor Up Project

mkdir ~/my-meteor-deployment
cd ~/my-meteor-deployment
mupx init
mupd init

This will create two files in your Meteor Up project directory:

Expand Down Expand Up @@ -91,6 +89,8 @@ This will create two files in your Meteor Up project directory:

// Install MongoDB on the server. Does not destroy the local MongoDB on future setups
"setupMongo": true,
// Set MongoDB version, check what version of Mongo you are using in development "meteor mongo"
"mongoVersion": 2.6.7,

// Application name (no spaces).
"appName": "meteor",
Expand Down Expand Up @@ -119,23 +119,23 @@ This will create two files in your Meteor Up project directory:

### Setting Up a Server

mupx setup
mupd setup

This will setup the server for the `mupx` deployments. It will take around 2-5 minutes depending on the server's performance and network availability.
This will setup the server for the `mupd` deployments. It will take around 2-5 minutes depending on the server's performance and network availability.

### Deploying an App

mupx deploy
mupd deploy

This will bundle the Meteor project and deploy it to the server. Bundling process is very similar to how `meteor deploy` do it.

### Other Utility Commands

* `mupx reconfig` - reconfigure app with new environment variables and Meteor settings
* `mupx stop` - stop the app
* `mupx start` - start the app
* `mupx restart` - restart the app
* `mupx logs [-f --tail=50]` - get logs
* `mupd reconfig` - reconfigure app with new environment variables and Meteor settings
* `mupd stop` - stop the app
* `mupd start` - start the app
* `mupd restart` - restart the app
* `mupd logs [-f --tail=50]` - get logs

### Build Options

Expand Down Expand Up @@ -217,7 +217,7 @@ Meteor Up uses Docker to run and manage your app. It uses [MeteorD](https://gith
* If you decided to use MongoDB, it'll be also running as a Docker conatiner. It's bound to the local interface and port 27017 (you cannot access from the outside)
* the database is named `<appName>`

For more information see [`lib/taskLists.js`](https://github.com/arunoda/meteor-up/blob/mupx/lib/taskLists/linux.js).
For more information see [`lib/taskLists.js`](https://github.com/arunoda/meteor-up/blob/mupd/lib/taskLists/linux.js).

#### Multiple Deployment Targets

Expand Down Expand Up @@ -303,29 +303,29 @@ To learn more about the SSL setup refer to the [`mup-frontend-server`](https://g

### Updating Mup

To update `mupx` to the latest version, just type:
To update `mupd` to the latest version, just type:

npm update mupx -g
npm update mupd -g

You should try and keep `mupx` up to date in order to keep up with the latest Meteor changes.
You should try and keep `mupd` up to date in order to keep up with the latest Meteor changes.

### Troubleshooting

#### Check Logs
If you suddenly can't deploy your app anymore, first use the `mupx logs -f` command to check the logs for error messages.
If you suddenly can't deploy your app anymore, first use the `mupd logs -f` command to check the logs for error messages.

One of the most common problems is your Node version getting out of date. In that case, see “Updating” section above.

#### Verbose Output
If you need to see the output of `mupx` (to see more precisely where it's failing or hanging, for example), run it like so:
If you need to see the output of `mupd` (to see more precisely where it's failing or hanging, for example), run it like so:

DEBUG=* mupx <command>
DEBUG=* mupd <command>

where `<command>` is one of the `mupx` commands such as `setup`, `deploy`, etc.
where `<command>` is one of the `mupd` commands such as `setup`, `deploy`, etc.

### Migrating from Meteor Up 0.x

`mupx` is not fully backward compatible with Meteor Up 0.x. But most of the `mup.json` remain the same. Here are some of the changes:
`mupd` is not fully backward compatible with Meteor Up 0.x. But most of the `mup.json` remain the same. Here are some of the changes:

* Docker is the now runtime for Meteor Up
* We don't have use Upstart any more
Expand All @@ -347,4 +347,4 @@ Let's assume our appName is `meteor`
* Stop mongodb if you are using: `stop mongod`
* Remove MongoDB with: `apt-get remove mongodb`

Then do `mupx setup` and then `mupx deploy`.
Then do `mupd setup` and then `mupd deploy`.
18 changes: 0 additions & 18 deletions lib/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,6 @@ Actions.prototype._createSessionsMap = function(config) {
return sessionsMap;
};

var kadiraRegex = /^meteorhacks:kadira/m;
Actions.prototype._showKadiraLink = function() {
var versionsFile = path.join(this.config.app, '.meteor/versions');
if(fs.existsSync(versionsFile)) {
var packages = fs.readFileSync(versionsFile, 'utf-8');
var hasKadira = kadiraRegex.test(packages);
if(!hasKadira) {
console.log(
"“ Checkout " + "Kadira".bold + "!"+
"\n It's the best way to monitor performance of your app."+
"\n Visit: " + "https://kadira.io/mup".underline + " ”\n"
);
}
}
}

Actions.prototype._executePararell = function(actionName, args) {
var self = this;
var sessionInfoList = _.values(self.sessionsMap);
Expand All @@ -94,13 +78,11 @@ Actions.prototype._executePararell = function(actionName, args) {
};

Actions.prototype.setup = function() {
this._showKadiraLink();
this._executePararell("setup", [this.config]);
};

Actions.prototype.deploy = function() {
var self = this;
self._showKadiraLink();

var buildLocation = path.resolve('/tmp', uuid.v4());
var bundlePath = path.resolve(buildLocation, 'bundle.tar.gz');
Expand Down
9 changes: 6 additions & 3 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ exports.read = function(configFileName) {
mupJson.env = mupJson.env || {};
mupJson.env['PORT'] = mupJson.env['PORT'] || 80;

// Get mongo version or default to 2.6.7
mupJson.mongoVersion = mupJson.mongoVersion || "2.6.7"

if(typeof mupJson.setupNode === "undefined") {
mupJson.setupNode = true;
}
Expand Down Expand Up @@ -94,12 +97,12 @@ exports.read = function(configFileName) {
helpers.printHelp();
process.exit(1);
}

function rewritePath(location, errorMessage) {
if(!location) {
return mupErrorLog(errorMessage);
}

var homeLocation = process.env.HOME;
if(/^win/.test(process.platform)) {
homeLocation = process.env.USERPROFILE;
Expand Down Expand Up @@ -127,4 +130,4 @@ exports.read = function(configFileName) {
console.error(errorMessage.red.bold);
process.exit(1);
}
};
};
7 changes: 5 additions & 2 deletions lib/taskLists/linux.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ exports.setup = function(config) {
});

taskList.executeScript('Installing MongoDB', {
script: path.resolve(SCRIPT_DIR, 'install-mongodb.sh')
script: path.resolve(SCRIPT_DIR, 'install-mongodb.sh'),
vars: {
mongoVersion: config.mongoVersion
}
});
}

Expand Down Expand Up @@ -189,4 +192,4 @@ function deployAndVerify(taskList, appName, port, deployCheckWaitTime) {
port: port
}
});
}
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mupx",
"version": "1.5.2",
"name": "mupd",
"version": "1.5.6",
"description": "Production Quality Meteor Deployments",
"dependencies": {
"async": "^0.9.0",
Expand All @@ -15,12 +15,12 @@
"minimist": "1.1.1"
},
"bin": {
"mupx": "./bin/mup"
"mupd": "./bin/mup"
},
"author": "Arunoda Susiripala <arunoda.susiripala@gmail.com>",
"author": "Ville Jyrkkä <vjyrkka@gmail.com>",
"repository": {
"type": "git",
"url": "git://github.com/arunoda/meteor-up.git"
"url": "git://github.com/jykae/meteor-up.git"
},
"license": "MIT"
}
4 changes: 2 additions & 2 deletions scripts/linux/install-mongodb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set -e
# we use this data directory for the backward compatibility
# older mup uses mongodb from apt-get and they used this data directory
sudo mkdir -p /var/lib/mongodb
sudo docker pull mongo:<%= mongoVersion %>

sudo docker pull mongo:latest
set +e
sudo docker rm -f mongodb
set -e
Expand All @@ -17,4 +17,4 @@ sudo docker run \
--volume=/var/lib/mongodb:/data/db \
--volume=/opt/mongodb/mongodb.conf:/mongodb.conf \
--name=mongodb \
mongo mongod -f /mongodb.conf
mongo:<%= mongoVersion %> mongod -f /mongodb.conf
8 changes: 4 additions & 4 deletions templates/linux/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ docker rm -f $APPNAME-frontend

# We don't need to fail the deployment because of a docker hub downtime
set +e
docker pull meteorhacks/meteord:base
docker pull abernix/meteord:base
set -e

if [ "$USE_LOCAL_MONGO" == "1" ]; then
Expand All @@ -29,7 +29,7 @@ if [ "$USE_LOCAL_MONGO" == "1" ]; then
--hostname="$HOSTNAME-$APPNAME" \
--env=MONGO_URL=mongodb://mongodb:27017/$APPNAME \
--name=$APPNAME \
meteorhacks/meteord:base
abernix/meteord:base
else
docker run \
-d \
Expand All @@ -39,7 +39,7 @@ else
--hostname="$HOSTNAME-$APPNAME" \
--env-file=$ENV_FILE \
--name=$APPNAME \
meteorhacks/meteord:base
abernix/meteord:base
fi

<% if(typeof sslConfig === "object") { %>
Expand All @@ -56,4 +56,4 @@ fi
--publish=<%= sslConfig.port %>:443 \
--name=$APPNAME-frontend \
meteorhacks/mup-frontend-server /start.sh
<% } %>
<% } %>